From 680445699d37e105d9bc70bac542c958518adbe7 Mon Sep 17 00:00:00 2001 From: codat-sdk-codegen Date: Fri, 7 Aug 2026 11:56:22 +0000 Subject: [PATCH] lending: regenerate with the in-house pipeline @ b5f2513, version 11.0.1 -> 11.0.2 --- lending/RELEASES.md | 12 +- lending/USAGE.md | 104 +- lending/docs/models/errors/errormessage.md | 30 +- .../docs/models/operations/bankingaccount.md | 18 + .../models/operations/bankingtransactions.md | 12 + .../models/operations/createaccountrequest.md | 22 +- .../createbankaccountmappingrequest.md | 18 +- .../operations/createbankaccountrequest.md | 24 +- .../createbanktransactionsrequest.md | 24 +- .../models/operations/createcompanyrequest.md | 8 + .../operations/createconnectionrequest.md | 16 +- .../operations/createconnectionrequestbody.md | 16 +- .../operations/createdirectcostrequest.md | 22 +- .../models/operations/createpaymentrequest.md | 24 +- .../operations/createsourceaccountrequest.md | 18 +- .../createsourceaccountrequestbody.md | 34 +- .../createsourceaccountresponsebody.md | 38 +- .../operations/createsupplierrequest.md | 24 +- .../operations/createtransferrequest.md | 24 +- .../models/operations/deletecompanyrequest.md | 14 +- .../operations/deleteconnectionrequest.md | 16 +- ...downloadaccountingbillattachmentrequest.md | 20 +- ...loadaccountingcustomerattachmentrequest.md | 20 +- ...adaccountingdirectcostattachmentrequest.md | 20 +- ...accountingdirectincomeattachmentrequest.md | 20 +- ...nloadaccountinginvoiceattachmentrequest.md | 20 +- .../downloadaccountinginvoicepdfrequest.md | 16 +- ...loadaccountingsupplierattachmentrequest.md | 20 +- ...oadcategorizedbankstatementexcelrequest.md | 10 + .../downloadcreditmodelexcelrequest.md | 10 + .../operations/downloadexcelreportrequest.md | 16 +- .../models/operations/downloadfilesrequest.md | 16 +- .../endbankstatementuploadsessionrequest.md | 22 +- .../operations/generateexcelreportrequest.md | 16 +- .../operations/generateloansummaryrequest.md | 18 +- .../generateloantransactionsrequest.md | 18 +- .../operations/generatereportrequest.md | 18 +- .../operations/getaccountingaccountrequest.md | 16 +- .../getaccountingaccounttransactionrequest.md | 18 +- ...getaccountingagedcreditorsreportrequest.md | 22 +- .../getaccountingageddebtorsreportrequest.md | 22 +- .../getaccountingbalancesheetrequest.md | 20 +- .../getaccountingbankaccountrequest.md | 18 +- .../getaccountingbillattachmentrequest.md | 20 +- .../getaccountingbillcreditnoterequest.md | 16 +- .../getaccountingbillpaymentrequest.md | 16 +- .../operations/getaccountingbillrequest.md | 16 +- .../getaccountingcashflowstatementrequest.md | 20 +- .../getaccountingcreditnoterequest.md | 16 +- .../getaccountingcustomerattachmentrequest.md | 20 +- .../getaccountingcustomerrequest.md | 16 +- ...etaccountingdirectcostattachmentrequest.md | 20 +- .../getaccountingdirectcostrequest.md | 18 +- ...accountingdirectincomeattachmentrequest.md | 22 +- .../getaccountingdirectincomerequest.md | 18 +- .../getaccountinginvoiceattachmentrequest.md | 20 +- .../operations/getaccountinginvoicerequest.md | 16 +- .../getaccountingjournalentryrequest.md | 16 +- .../operations/getaccountingjournalrequest.md | 16 +- .../operations/getaccountingpaymentrequest.md | 16 +- .../operations/getaccountingprofilerequest.md | 14 +- .../getaccountingprofitandlossrequest.md | 20 +- .../getaccountingsupplierattachmentrequest.md | 20 +- .../getaccountingsupplierrequest.md | 16 +- .../getaccountingtransferrequest.md | 18 +- .../getbankaccountmappingrequest.md | 16 +- .../operations/getbankingaccountrequest.md | 18 +- .../getbankingtransactioncategoryrequest.md | 18 +- .../getbankingtransactionrequest.md | 18 +- ...bankstatementuploadconfigurationrequest.md | 16 +- ...categorizedbalancesheetstatementrequest.md | 18 +- .../getcategorizedbankstatementrequest.md | 20 +- ...gorizedbankstatementtransactionsrequest.md | 14 + ...ategorizedprofitandlossstatementrequest.md | 18 +- .../operations/getcommercecustomerrequest.md | 18 +- ...commercecustomerretentionmetricsrequest.md | 26 +- .../operations/getcommercedisputerequest.md | 18 +- .../getcommercelifetimevaluemetricsrequest.md | 26 +- .../operations/getcommercelocationrequest.md | 18 +- .../operations/getcommerceorderrequest.md | 18 +- .../getcommerceordersreportrequest.md | 26 +- .../getcommercepaymentmethodrequest.md | 18 +- .../operations/getcommercepaymentrequest.md | 18 +- .../getcommerceproductcategoryrequest.md | 18 +- .../operations/getcommerceproductrequest.md | 18 +- .../operations/getcommerceprofilerequest.md | 16 +- .../getcommercerefundsreportrequest.md | 26 +- .../getcommercerevenuemetricsrequest.md | 26 +- .../getcommercetransactionrequest.md | 18 +- .../models/operations/getcompanyrequest.md | 14 +- .../models/operations/getconnectionrequest.md | 16 +- .../getcreatebanktransactionsmodelrequest.md | 18 +- .../getcreatechartofaccountsmodelrequest.md | 16 +- .../getcreatedirectcostsmodelrequest.md | 16 +- .../operations/getcreateoperationrequest.md | 16 +- .../getcreatepaymentmodelrequest.md | 16 +- .../getcreatetransfersmodelrequest.md | 16 +- ...getcreateupdatebankaccountsmodelrequest.md | 16 +- .../getcreateupdatesuppliersmodelrequest.md | 16 +- .../getdataintegritystatusrequest.md | 18 +- .../getdataintegritysummariesrequest.md | 18 +- .../operations/getdatastatusdatastatuses.md | 59 +- .../models/operations/getdatastatusrequest.md | 14 +- .../getexcelreportgenerationstatusrequest.md | 16 +- .../operations/getfinancialsummaryrequest.md | 9 + .../getloansummaryqueryparamsourcetype.md | 36 +- .../operations/getloansummaryrequest.md | 18 +- .../operations/getpulloperationrequest.md | 16 +- .../operations/getreportstatusrequest.md | 11 + .../isagedcreditorsreportavailablerequest.md | 14 +- .../isageddebtorsreportavailablerequest.md | 14 +- .../listaccountingaccountsrequest.md | 22 +- ...istaccountingaccounttransactionsrequest.md | 24 +- .../listaccountingbankaccountsrequest.md | 24 +- ...ccountingbankaccounttransactionsrequest.md | 26 +- .../listaccountingbillattachmentsrequest.md | 18 +- .../listaccountingbillcreditnotesrequest.md | 22 +- .../listaccountingbillpaymentsrequest.md | 22 +- .../operations/listaccountingbillsrequest.md | 22 +- .../listaccountingcreditnotesrequest.md | 22 +- ...istaccountingcustomerattachmentsrequest.md | 18 +- .../listaccountingcustomersrequest.md | 22 +- ...taccountingdirectcostattachmentsrequest.md | 18 +- .../listaccountingdirectcostsrequest.md | 24 +- ...ccountingdirectincomeattachmentsrequest.md | 18 +- .../listaccountingdirectincomesrequest.md | 24 +- ...listaccountinginvoiceattachmentsrequest.md | 18 +- .../listaccountinginvoicesrequest.md | 22 +- .../listaccountingjournalentriesrequest.md | 22 +- .../listaccountingjournalsrequest.md | 22 +- .../listaccountingpaymentsrequest.md | 22 +- ...istaccountingsupplierattachmentsrequest.md | 18 +- .../listaccountingsuppliersrequest.md | 22 +- .../listaccountingtransfersrequest.md | 24 +- .../listbankingaccountbalancesrequest.md | 24 +- .../operations/listbankingaccountsrequest.md | 24 +- ...listbankingtransactioncategoriesrequest.md | 24 +- .../listbankingtransactionsrequest.md | 24 +- ...categorizedbankstatementaccountsrequest.md | 14 + .../listcommercecustomersrequest.md | 24 +- .../operations/listcommercedisputesrequest.md | 24 +- .../listcommercelocationsrequest.md | 16 +- .../operations/listcommerceordersrequest.md | 24 +- .../listcommercepaymentmethodsrequest.md | 24 +- .../operations/listcommercepaymentsrequest.md | 24 +- .../listcommerceproductcategoriesrequest.md | 24 +- .../operations/listcommerceproductsrequest.md | 24 +- .../listcommercetransactionsrequest.md | 24 +- .../models/operations/listcompaniesrequest.md | 22 +- .../operations/listconnectionsrequest.md | 22 +- .../operations/listcreateoperationsrequest.md | 22 +- .../listdataintegritydetailsrequest.md | 24 +- .../models/operations/listfilesrequest.md | 14 +- ...istloantransactionsqueryparamsourcetype.md | 36 +- .../operations/listloantransactionsrequest.md | 18 +- .../operations/listpulloperationsrequest.md | 22 +- .../listreconciledinvoicesrequest.md | 20 +- .../models/operations/listreportsrequest.md | 22 +- .../models/operations/queryparamsourcetype.md | 36 +- .../operations/refreshalldatatypesrequest.md | 14 +- .../operations/refreshdatatyperequest.md | 18 +- .../operations/replacecompanyrequest.md | 18 +- ...bankstatementuploadconfigurationrequest.md | 18 +- .../docs/models/operations/sourceaccount.md | 18 + .../sourceaccountprototype.md} | 56 +- .../docs/models/operations/sourceaccountv2.md | 20 + .../operations/sourceaccountv2prototype.md | 17 + lending/docs/models/operations/sourcetype.md | 36 +- .../startbankstatementuploadsessionrequest.md | 20 +- .../operations/unlinkconnectionrequest.md | 20 +- .../unlinkconnectionupdateconnection.md | 15 +- .../models/operations/updatecompanyrequest.md | 18 +- .../uploadbankstatementdatarequest.md | 24 +- .../uploadbankstatementdatarequestbody.md | 46 +- .../models/operations/uploadfilesrequest.md | 20 +- ...sponseaccountingsupplier.md => account.md} | 43 +- lending/docs/models/shared/accountbalance.md | 20 +- .../models/shared/accountbalanceamounts.md | 23 +- .../shared/accountcategoriesupdatedwebhook.md | 34 +- .../accountcategoriesupdatedwebhookdata.md | 14 +- .../models/shared/accountcategorylevel.md | 20 +- .../docs/models/shared/accountidentifiers.md | 31 +- .../models/shared/accountidentifiertype.md | 44 +- lending/docs/models/shared/accountinfo.md | 20 +- .../docs/models/shared/accountingaccount.md | 100 +- .../docs/models/shared/accountingaccounts.md | 22 +- .../shared/accountingaccounttransaction.md | 70 +- .../accountingaccounttransactiondatatype.md | 26 + .../shared/accountingaccounttransactions.md | 22 +- .../accountingaccounttransactionstatus.md | 38 +- .../accountingaccountvaliddatatypelinks.md | 50 - .../docs/models/shared/accountingaddress.md | 26 +- .../models/shared/accountingaddresstype.md | 36 +- .../shared/accountingagedcreditorreport.md | 84 +- .../shared/accountingageddebtorreport.md | 84 +- .../models/shared/accountingattachment.md | 64 +- .../models/shared/accountingbalancesheet.md | 55 +- .../models/shared/accountingbankaccount.md | 76 +- .../models/shared/accountingbankaccounts.md | 22 +- .../shared/accountingbankaccounttype.md | 42 +- .../shared/accountingbanktransaction.md | 62 +- .../shared/accountingbanktransactions.md | 22 +- lending/docs/models/shared/accountingbill.md | 90 +- .../models/shared/accountingbillcreditnote.md | 88 +- .../shared/accountingbillcreditnotes.md | 22 +- .../models/shared/accountingbillpayment.md | 342 +- .../models/shared/accountingbillpayments.md | 22 +- lending/docs/models/shared/accountingbills.md | 22 +- .../shared/accountingcashflowstatement.md | 48 +- .../models/shared/accountingcompanyinfo.md | 52 +- .../shared/accountingcreateaccountresponse.md | 40 +- ...ccountingcreateaccountresponseallofdata.md | 23 + ...createaccountresponsevaliddatatypelinks.md | 50 - .../accountingcreatebankaccountresponse.md | 40 +- ...tingcreatebankaccountresponseallofdata.md} | 48 +- ...accountingcreatebankaccounttransactions.md | 18 +- .../accountingcreatebanktransactions.md | 16 +- ...ccountingcreatebanktransactionsresponse.md | 40 +- .../accountingcreatedirectcostresponse.md | 40 +- ...ntingcreatedirectcostresponseallofdata.md} | 60 +- .../shared/accountingcreatepaymentresponse.md | 40 +- ...countingcreatepaymentresponseallofdata.md} | 723 +--- .../accountingcreatesupplierresponse.md | 40 +- ...countingcreatesupplierresponseallofdata.md | 21 + .../accountingcreatetransferresponse.md | 40 +- ...countingcreatetransferresponseallofdata.md | 20 + .../accountingcreatetransferresponsestatus.md | 38 +- .../models/shared/accountingcreditnote.md | 82 +- .../models/shared/accountingcreditnotes.md | 22 +- .../docs/models/shared/accountingcustomer.md | 56 +- .../models/shared/accountingcustomerref.md | 16 +- .../docs/models/shared/accountingcustomers.md | 22 +- .../models/shared/accountingdirectcost.md | 68 +- .../models/shared/accountingdirectcosts.md | 22 +- .../models/shared/accountingdirectincome.md | 72 +- .../models/shared/accountingdirectincomes.md | 22 +- .../docs/models/shared/accountinginvoice.md | 120 +- .../shared/accountinginvoicedatatype.md | 32 +- .../docs/models/shared/accountinginvoices.md | 22 +- .../docs/models/shared/accountingjournal.md | 78 +- .../models/shared/accountingjournalentries.md | 22 +- .../models/shared/accountingjournalentry.md | 78 +- .../shared/accountingjournalentrydatatype.md | 17 + .../docs/models/shared/accountingjournals.md | 22 +- .../docs/models/shared/accountingpayment.md | 1396 +++---- .../shared/accountingpaymentallocation.md | 18 +- ... accountingpaymentallocationallocation.md} | 20 +- .../models/shared/accountingpaymentmethod.md | 18 + .../docs/models/shared/accountingpayments.md | 22 +- .../shared/accountingprofitandlossreport.md | 64 +- .../docs/models/shared/accountingrecordref.md | 24 +- .../docs/models/shared/accountingsupplier.md | 48 +- .../docs/models/shared/accountingsuppliers.md | 22 +- .../shared/accountingtrackingcategory.md | 142 + .../docs/models/shared/accountingtransfer.md | 42 +- .../docs/models/shared/accountingtransfers.md | 22 +- .../models/shared/accountingtransferstatus.md | 38 +- .../docs/models/shared/accountinstitution.md | 21 +- .../docs/models/shared/accountprototype.md | 36 +- lending/docs/models/shared/accountref.md | 18 +- lending/docs/models/shared/accounts.md | 26 +- .../models/shared/accountspayabletracking.md | 26 +- .../shared/accountsreceivabletracking.md | 28 +- lending/docs/models/shared/accountstatus.md | 40 +- .../models/shared/accounttransactionline.md | 20 +- .../shared/accounttransactionlinerecordref.md | 20 +- ...accounttransactionlinerecordrefdatatype.md | 54 +- lending/docs/models/shared/accounttype.md | 46 +- lending/docs/models/shared/agedcreditor.md | 18 +- .../models/shared/agedcurrencyoutstanding.md | 16 +- lending/docs/models/shared/ageddebtor.md | 18 +- .../models/shared/agedoutstandingamount.md | 20 +- .../shared/agedoutstandingamountdetail.md | 16 +- lending/docs/models/shared/attachments.md | 14 +- lending/docs/models/shared/balancesheet.md | 24 +- .../models/shared/bankaccountprototype.md | 19 + lending/docs/models/shared/bankaccountref.md | 18 +- .../docs/models/shared/bankaccountstatus.md | 38 +- .../shared/bankfeedbankaccountmapping.md | 19 +- .../bankfeedbankaccountmappingresponse.md | 21 +- lending/docs/models/shared/bankfeedmapping.md | 37 +- lending/docs/models/shared/bankingaccount.md | 42 +- .../models/shared/bankingaccountbalance.md | 42 +- .../models/shared/bankingaccountbalances.md | 22 +- lending/docs/models/shared/bankingaccounts.md | 22 +- .../docs/models/shared/bankingtransaction.md | 44 +- .../shared/bankingtransactioncategories.md | 22 +- .../shared/bankingtransactioncategory.md | 34 +- .../models/shared/bankingtransactionref.md | 28 +- .../docs/models/shared/bankingtransactions.md | 22 +- .../bankstatementuploadconfiguration.md | 23 +- .../docs/models/shared/banktransactiontype.md | 68 +- .../models/shared/billcreditnotelineitem.md | 44 +- .../models/shared/billcreditnotestatus.md | 42 +- lending/docs/models/shared/billedtotype.md | 38 +- lending/docs/models/shared/billedtotype1.md | 36 +- lending/docs/models/shared/billlineitem.md | 46 +- .../models/shared/billlineitemdatatype.md | 36 +- ...illlineitempurchaseorderlinerefdatatype.md | 17 + lending/docs/models/shared/billpaymentline.md | 20 +- .../docs/models/shared/billpaymentlinelink.md | 22 +- .../models/shared/billpaymentlinelinktype.md | 50 +- lending/docs/models/shared/billstatus.md | 42 +- .../docs/models/shared/cashflowstatement.md | 20 +- .../docs/models/shared/cashflowtransaction.md | 38 +- .../categorizedbankstatementaccounts.md | 18 + .../categorizedbankstatementtransactions.md | 18 + .../models/shared/clientratelimitwebhook.md | 20 +- .../shared/clientratelimitwebhookpayload.md | 18 +- lending/docs/models/shared/codatfile.md | 20 +- lending/docs/models/shared/commerceaddress.md | 26 +- .../docs/models/shared/commerceaddresstype.md | 40 +- .../docs/models/shared/commercecompanyinfo.md | 46 +- .../docs/models/shared/commercecustomer.md | 36 +- .../docs/models/shared/commercecustomerref.md | 20 +- .../docs/models/shared/commercecustomers.md | 22 +- lending/docs/models/shared/commercedispute.md | 46 +- .../docs/models/shared/commercedisputes.md | 22 +- .../docs/models/shared/commercelocation.md | 30 +- .../docs/models/shared/commercelocations.md | 22 +- lending/docs/models/shared/commerceorder.md | 56 +- lending/docs/models/shared/commerceorders.md | 22 +- lending/docs/models/shared/commercepayment.md | 46 +- .../models/shared/commercepaymentmethod.md | 26 +- .../models/shared/commercepaymentmethods.md | 22 +- .../shared/commercepaymentmethodstatus.md | 36 +- .../docs/models/shared/commercepayments.md | 22 +- lending/docs/models/shared/commerceproduct.md | 32 +- .../shared/commerceproductcategories.md | 22 +- .../models/shared/commerceproductcategory.md | 28 +- .../docs/models/shared/commerceproducts.md | 22 +- .../docs/models/shared/commercerecordref.md | 16 +- lending/docs/models/shared/commercereport.md | 106 +- .../models/shared/commercereportcomponent.md | 24 +- .../models/shared/commercereportdimension.md | 20 +- .../shared/commercereportdimensionitems.md | 14 +- .../docs/models/shared/commercereporterror.md | 18 +- .../models/shared/commercereportmeasure.md | 20 +- .../models/shared/commercetaxcomponent.md | 15 + .../docs/models/shared/commercetransaction.md | 52 +- .../models/shared/commercetransactions.md | 22 +- lending/docs/models/shared/companies.md | 22 +- lending/docs/models/shared/company.md | 48 +- lending/docs/models/shared/companydetails.md | 18 + .../docs/models/shared/companyreference.md | 22 +- .../models/shared/companyreferencelinks.md | 18 +- .../docs/models/shared/companyrequestbody.md | 18 +- .../models/shared/companyupdaterequest.md | 18 +- lending/docs/models/shared/connection.md | 59 +- lending/docs/models/shared/connections.md | 22 +- lending/docs/models/shared/contact.md | 26 +- lending/docs/models/shared/contactref.md | 16 +- .../docs/models/shared/contactrefdatatype.md | 36 +- .../docs/models/shared/contactreference.md | 16 +- .../shared/createbankaccounttransaction.md | 24 +- .../models/shared/createconnectionrequest.md | 8 + lending/docs/models/shared/createddate.md | 8 + .../shared/createsourceaccount200response.md | 11 + .../shared/createsourceaccountrequest.md | 11 + .../docs/models/shared/creditnotelineitem.md | 42 +- .../docs/models/shared/creditnotestatus.md | 44 +- lending/docs/models/shared/currentstatus.md | 36 + lending/docs/models/shared/customerstatus.md | 36 +- .../docs/models/shared/dataconnectionerror.md | 24 +- .../models/shared/dataconnectionstatus.md | 40 +- .../models/shared/dataintegrityamounts.md | 22 +- .../models/shared/dataintegritybyamount.md | 22 +- .../models/shared/dataintegritybycount.md | 20 +- .../shared/dataintegrityconnectionid.md | 16 +- .../models/shared/dataintegritydatatype.md | 36 +- .../docs/models/shared/dataintegritydates.md | 24 +- .../docs/models/shared/dataintegritydetail.md | 28 +- .../models/shared/dataintegritydetails.md | 22 +- .../docs/models/shared/dataintegritymatch.md | 28 +- .../docs/models/shared/dataintegritystatus.md | 22 +- .../models/shared/dataintegritystatuses.md | 14 +- .../models/shared/dataintegritystatusinfo.md | 20 +- .../models/shared/dataintegritysummaries.md | 14 +- .../models/shared/dataintegritysummary.md | 18 +- .../docs/models/shared/dataintegritytype.md | 8 + lending/docs/models/shared/datasetstatus.md | 74 +- lending/docs/models/shared/datasource.md | 14 +- lending/docs/models/shared/datastatus.md | 26 +- lending/docs/models/shared/datastatuses.md | 50 + lending/docs/models/shared/datatype.md | 135 +- lending/docs/models/shared/datatypes.md | 118 +- .../docs/models/shared/directcostlineitem.md | 40 +- .../docs/models/shared/directcostprototype.md | 38 +- .../models/shared/directincomelineitem.md | 38 +- lending/docs/models/shared/disputestatus.md | 52 +- .../models/shared/enduploadsessionrequest.md | 14 +- .../shared/enduploadsessionrequeststatus.md | 34 +- .../models/shared/enhancedcashflowitem.md | 14 +- .../shared/enhancedcashflowtransactions.md | 30 +- .../models/shared/enhancedfinancialreport.md | 16 +- .../shared/enhancedinvoicereportitem.md | 40 +- .../models/shared/enhancedinvoicesreport.md | 20 +- .../shared/enhancedreportaccountcategory.md | 16 +- .../docs/models/shared/enhancedreportinfo.md | 22 +- lending/docs/models/shared/errormessage.md | 14 + lending/docs/models/shared/errorstatus.md | 36 +- lending/docs/models/shared/errorvalidation.md | 18 +- .../docs/models/shared/errorvalidationitem.md | 18 +- .../docs/models/shared/excelreporttypes.md | 38 +- lending/docs/models/shared/excelstatus.md | 28 +- lending/docs/models/shared/file.md | 21 +- lending/docs/models/shared/fileupload.md | 14 +- .../docs/models/shared/financialsummary.md | 9 + .../shared/financialsummaryaccountingscore.md | 11 + .../shared/financialsummarybookscloseddate.md | 11 + lending/docs/models/shared/halref.md | 14 +- lending/docs/models/shared/integritystatus.md | 38 +- lending/docs/models/shared/invoicelineitem.md | 42 +- lending/docs/models/shared/invoicestatus.md | 48 +- lending/docs/models/shared/itemref.md | 18 +- lending/docs/models/shared/itemreference.md | 20 +- lending/docs/models/shared/items.md | 16 +- .../models/shared/journalentryrecordref.md | 20 +- .../shared/journalentryrecordrefdatatype.md | 52 +- lending/docs/models/shared/journalline.md | 28 +- .../docs/models/shared/journallinedatatype.md | 36 +- .../docs/models/shared/journallinetracking.md | 18 +- .../shared/journallinetrackingdatatype.md | 18 + ...countingaccount.md => journalprototype.md} | 66 +- lending/docs/models/shared/journalref.md | 19 +- lending/docs/models/shared/journalstatus.md | 36 +- .../docs/models/shared/lendingcustomerref.md | 16 +- lending/docs/models/shared/links.md | 20 +- lending/docs/models/shared/loanref.md | 18 +- lending/docs/models/shared/loansummary.md | 16 +- .../shared/loansummaryintegrationtype.md | 36 +- .../models/shared/loansummaryrecordref.md | 22 +- .../models/shared/loansummaryrecordreftype.md | 40 +- .../models/shared/loansummaryreportinfo.md | 18 +- .../models/shared/loansummaryreportitem.md | 28 +- .../docs/models/shared/loantransactions.md | 16 +- .../shared/loantransactionsreportinfo.md | 24 +- .../docs/models/shared/loantransactiontype.md | 38 +- lending/docs/models/shared/locationref.md | 20 +- lending/docs/models/shared/metadata.md | 14 +- lending/docs/models/shared/model0.md | 8 + lending/docs/models/shared/model3.md | 9 + .../models/shared/orderdiscountallocation.md | 18 +- lending/docs/models/shared/orderlineitem.md | 34 +- lending/docs/models/shared/paginginfo.md | 11 + lending/docs/models/shared/path.md | 30 +- lending/docs/models/shared/payment.md | 28 +- .../models/shared/paymentallocationpayment.md | 30 +- lending/docs/models/shared/paymentline.md | 18 +- lending/docs/models/shared/paymentlinelink.md | 21 +- lending/docs/models/shared/paymentlinktype.md | 72 +- .../docs/models/shared/paymentmethodref.md | 20 +- .../docs/models/shared/paymentmethodtype.md | 22 + lending/docs/models/shared/paymentref.md | 34 +- lending/docs/models/shared/paymentstatus.md | 42 +- lending/docs/models/shared/paymenttype.md | 54 +- lending/docs/models/shared/periodunit.md | 36 +- lending/docs/models/shared/phonenumber.md | 16 +- lending/docs/models/shared/phonenumbertype.md | 42 +- .../docs/models/shared/productinventory.md | 20 +- .../models/shared/productinventorylocation.md | 16 +- lending/docs/models/shared/productprice.md | 18 +- lending/docs/models/shared/productref.md | 20 +- lending/docs/models/shared/productvariant.md | 45 +- .../docs/models/shared/productvariantref.md | 20 +- .../models/shared/productvariantstatus.md | 36 +- .../docs/models/shared/profitandlossreport.md | 37 +- lending/docs/models/shared/projectref.md | 16 +- .../models/shared/propertieaccounttype.md | 42 +- .../docs/models/shared/propertieitemref.md | 11 - lending/docs/models/shared/pulloperation.md | 42 +- lending/docs/models/shared/pulloperations.md | 22 +- .../models/shared/purchaseorderreference.md | 17 +- lending/docs/models/shared/pushchangetype.md | 42 +- .../docs/models/shared/pushfieldvalidation.md | 19 +- lending/docs/models/shared/pushoperation.md | 38 +- .../docs/models/shared/pushoperationchange.md | 20 +- .../docs/models/shared/pushoperationref.md | 19 +- lending/docs/models/shared/pushoperations.md | 22 +- .../docs/models/shared/pushoperationstatus.md | 40 +- lending/docs/models/shared/pushoption.md | 26 +- .../docs/models/shared/pushoptionchoice.md | 22 +- .../docs/models/shared/pushoptionproperty.md | 26 +- lending/docs/models/shared/pushoptiontype.md | 46 +- .../docs/models/shared/pushvalidationinfo.md | 17 +- .../docs/models/shared/recordlinereference.md | 24 +- .../shared/recordlinereferencedatatype.md | 17 + lending/docs/models/shared/reportbasis.md | 38 +- .../models/shared/reportcomponentmeasure.md | 18 +- .../models/shared/reportgenerationpayload.md | 18 +- lending/docs/models/shared/reportinfo.md | 26 +- lending/docs/models/shared/reportinput.md | 36 +- lending/docs/models/shared/reportitem.md | 22 +- lending/docs/models/shared/reportitems.md | 26 +- lending/docs/models/shared/reportline.md | 20 +- lending/docs/models/shared/reportoperation.md | 28 +- .../models/shared/reportoperationstatus.md | 36 +- .../docs/models/shared/reportoperationtype.md | 36 +- lending/docs/models/shared/reports.md | 24 +- .../models/shared/reportsourcereference.md | 18 +- lending/docs/models/shared/reporttype.md | 32 +- lending/docs/models/shared/routinginfo.md | 22 +- .../docs/models/shared/salesorderreference.md | 16 +- lending/docs/models/shared/schema.md | 22 +- lending/docs/models/shared/schemadatatype.md | 118 +- lending/docs/models/shared/security.md | 16 +- lending/docs/models/shared/servicecharge.md | 28 +- .../docs/models/shared/servicechargetype.md | 38 +- lending/docs/models/shared/source.md | 32 +- lending/docs/models/shared/sourceaccount.md | 37 +- .../models/shared/sourceaccountprototype.md | 30 +- .../docs/models/shared/sourceaccountstatus.md | 40 +- lending/docs/models/shared/sourceaccountv2.md | 41 +- .../shared/sourceaccountv2accounttype.md | 42 +- .../models/shared/sourceaccountv2prototype.md | 34 +- .../models/shared/sourceaccountv2status.md | 40 +- .../docs/models/shared/sourceaccountv2type.md | 28 + lending/docs/models/shared/sourceref.md | 16 +- lending/docs/models/shared/sourcetype.md | 46 +- .../shared/startuploadsessionrequest.md | 14 +- .../startuploadsessionrequestdatatype.md | 34 +- lending/docs/models/shared/status.md | 72 +- .../docs/models/shared/supplementaldata.md | 24 +- lending/docs/models/shared/supplierref.md | 18 +- lending/docs/models/shared/supplierstatus.md | 36 +- .../docs/models/shared/targetaccountoption.md | 22 +- .../models/shared/taxcomponentallocation.md | 16 +- lending/docs/models/shared/taxcomponentref.md | 20 +- lending/docs/models/shared/taxrateref.md | 29 +- .../docs/models/shared/taxratereference.md | 40 +- lending/docs/models/shared/tracking.md | 21 +- .../docs/models/shared/trackingcategoryref.md | 20 +- .../docs/models/shared/trackingrecordref.md | 20 +- .../shared/trackingrecordrefdatatype.md | 38 +- .../docs/models/shared/transactioncategory.md | 18 +- .../models/shared/transactioncategoryref.md | 18 +- .../shared/transactioncategorystatus.md | 36 +- lending/docs/models/shared/transactioncode.md | 60 +- .../models/shared/transactionsourceref.md | 18 +- .../models/shared/transactionsourcetype.md | 40 +- lending/docs/models/shared/transactiontype.md | 54 +- lending/docs/models/shared/transferaccount.md | 22 +- lending/docs/models/shared/type.md | 58 +- .../docs/models/shared/updateconnection.md | 9 + .../shared/uploadbankstatementdatarequest.md | 12 + lending/docs/models/shared/validation.md | 20 +- lending/docs/models/shared/validationitem.md | 19 +- .../docs/models/shared/validdatatypelinks.md | 98 +- lending/docs/models/shared/weblink.md | 20 +- lending/docs/models/shared/weblinktype.md | 36 +- lending/docs/models/shared/withholdingtax.md | 16 +- lending/docs/models/shared/zero.md | 14 - lending/docs/models/shared/zerodatatype.md | 34 +- lending/docs/models/utils/retryconfig.md | 46 +- ...neratesuccessfulreportgenerationwebhook.md | 20 +- lending/docs/sdks/accountbalances/README.md | 86 - .../README.md | 490 +-- lending/docs/sdks/accounts/README.md | 654 ---- lending/docs/sdks/accountspayable/README.md | 5 + .../docs/sdks/accountsreceivable/README.md | 5 + .../docs/sdks/accounttransactions/README.md | 311 -- lending/docs/sdks/balancesheet/README.md | 481 --- lending/docs/sdks/bankaccounts/README.md | 305 -- lending/docs/sdks/banking/README.md | 5 + lending/docs/sdks/bankstatements/README.md | 702 ++-- lending/docs/sdks/banktransactions/README.md | 125 - lending/docs/sdks/billcreditnotes/README.md | 724 ---- lending/docs/sdks/billpayments/README.md | 771 ---- lending/docs/sdks/bills/README.md | 1029 ----- lending/docs/sdks/cashflow/README.md | 181 - .../docs/sdks/categorizedstatement/README.md | 58 - .../docs/sdks/codatlendingaccounts/README.md | 163 - .../codatlendingbankingtransactions/README.md | 164 - .../docs/sdks/codatlendingcustomers/README.md | 556 --- .../sdks/codatlendingdirectcosts/README.md | 713 ---- .../README.md | 911 ----- .../README.md | 333 -- .../docs/sdks/codatlendingpayments/README.md | 626 --- .../docs/sdks/codatlendingreports/README.md | 153 - .../sdks/codatlendingsalespayments/README.md | 507 --- .../docs/sdks/codatlendingsuppliers/README.md | 459 --- .../sdks/codatlendingtransactions/README.md | 360 -- .../docs/sdks/codatlendingtransfers/README.md | 507 --- lending/docs/sdks/companies/README.md | 1136 +++--- lending/docs/sdks/companyinfo/README.md | 212 +- lending/docs/sdks/connections/README.md | 546 ++- lending/docs/sdks/createoperations/README.md | 103 - lending/docs/sdks/creditnotes/README.md | 724 ---- lending/docs/sdks/customers/README.md | 1068 ------ lending/docs/sdks/dataintegrity/README.md | 334 +- lending/docs/sdks/directcosts/README.md | 642 ---- lending/docs/sdks/directincomes/README.md | 613 --- lending/docs/sdks/disputes/README.md | 164 - lending/docs/sdks/excelreports/README.md | 347 +- lending/docs/sdks/fileupload/README.md | 302 +- .../docs/sdks/financialstatements/README.md | 5 + lending/docs/sdks/financialsummary/README.md | 119 + lending/docs/sdks/invoices/README.md | 1180 ------ lending/docs/sdks/journalentries/README.md | 677 ---- lending/docs/sdks/journals/README.md | 301 -- lending/docs/sdks/liabilities/README.md | 414 +- lending/docs/sdks/loanwriteback/README.md | 5 + lending/docs/sdks/locations/README.md | 254 -- lending/docs/sdks/managedata/README.md | 104 +- lending/docs/sdks/managereports/README.md | 263 +- lending/docs/sdks/metrics/README.md | 231 -- lending/docs/sdks/orders/README.md | 703 ---- lending/docs/sdks/paymentmethods/README.md | 458 --- lending/docs/sdks/payments/README.md | 865 ----- lending/docs/sdks/productcategories/README.md | 115 - lending/docs/sdks/products/README.md | 556 --- lending/docs/sdks/profitandloss/README.md | 506 --- lending/docs/sdks/pulloperations/README.md | 103 - lending/docs/sdks/refresh/README.md | 102 - lending/docs/sdks/reports/README.md | 878 ----- lending/docs/sdks/sales/README.md | 5 + lending/docs/sdks/sourceaccounts/README.md | 286 -- lending/docs/sdks/suppliers/README.md | 1070 ------ .../docs/sdks/transactioncategories/README.md | 164 - lending/docs/sdks/transactions/README.md | 5 + lending/docs/sdks/transfers/README.md | 400 -- lending/pyproject.toml | 55 +- lending/src/codat_lending/__init__.py | 439 ++- lending/src/codat_lending/_hooks/__init__.py | 31 +- lending/src/codat_lending/_hooks/sdkhooks.py | 111 +- lending/src/codat_lending/_hooks/types.py | 68 +- lending/src/codat_lending/_httpx_transport.py | 130 + lending/src/codat_lending/_version.py | 13 +- lending/src/codat_lending/account_balances.py | 226 +- .../src/codat_lending/account_transactions.py | 444 +-- lending/src/codat_lending/accounts.py | 436 +-- lending/src/codat_lending/accounts_payable.py | 34 +- .../src/codat_lending/accounts_receivable.py | 40 +- lending/src/codat_lending/api/__init__.py | 63 + .../src/codat_lending/api/account_balances.py | 301 ++ .../codat_lending/api/account_transactions.py | 524 +++ .../codat_lending/api/accounting_bank_data.py | 312 ++ lending/src/codat_lending/api/accounts.py | 523 +++ .../src/codat_lending/api/accounts_payable.py | 29 + .../codat_lending/api/accounts_receivable.py | 35 + .../src/codat_lending/api/balance_sheet.py | 513 +++ .../src/codat_lending/api/bank_accounts.py | 519 +++ .../src/codat_lending/api/bank_statements.py | 1990 ++++++++++ .../codat_lending/api/bank_transactions.py | 531 +++ lending/src/codat_lending/api/banking.py | 32 + .../src/codat_lending/api/banking_accounts.py | 524 +++ .../codat_lending/api/bill_credit_notes.py | 512 +++ .../src/codat_lending/api/bill_payments.py | 512 +++ lending/src/codat_lending/api/bills.py | 1210 ++++++ lending/src/codat_lending/api/cash_flow.py | 286 ++ .../api/categorized_statement.py | 286 ++ lending/src/codat_lending/api/companies.py | 1390 +++++++ lending/src/codat_lending/api/company_info.py | 478 +++ lending/src/codat_lending/api/connections.py | 1186 ++++++ .../codat_lending/api/create_operations.py | 510 +++ lending/src/codat_lending/api/credit_notes.py | 512 +++ lending/src/codat_lending/api/customers.py | 1210 ++++++ .../src/codat_lending/api/data_integrity.py | 741 ++++ lending/src/codat_lending/api/direct_costs.py | 519 +++ .../src/codat_lending/api/direct_incomes.py | 1230 ++++++ lending/src/codat_lending/api/disputes.py | 524 +++ .../src/codat_lending/api/excel_reports.py | 703 ++++ lending/src/codat_lending/api/file_upload.py | 740 ++++ .../codat_lending/api/financial_statements.py | 29 + .../api/financial_statements_accounts.py | 512 +++ .../codat_lending/api/financial_summary.py | 513 +++ lending/src/codat_lending/api/invoices.py | 1657 ++++++++ .../src/codat_lending/api/journal_entries.py | 512 +++ lending/src/codat_lending/api/journals.py | 512 +++ lending/src/codat_lending/api/liabilities.py | 922 +++++ .../src/codat_lending/api/loan_writeback.py | 44 + .../api/loan_writeback_accounts.py | 519 +++ .../api/loan_writeback_payments.py | 519 +++ .../api/loan_writeback_suppliers.py | 519 +++ lending/src/codat_lending/api/locations.py | 490 +++ lending/src/codat_lending/api/manage_data.py | 268 ++ .../src/codat_lending/api/manage_reports.py | 742 ++++ lending/src/codat_lending/api/metrics.py | 820 ++++ lending/src/codat_lending/api/orders.py | 524 +++ .../src/codat_lending/api/payment_methods.py | 524 +++ lending/src/codat_lending/api/payments.py | 512 +++ .../codat_lending/api/product_categories.py | 524 +++ lending/src/codat_lending/api/products.py | 524 +++ .../src/codat_lending/api/profit_and_loss.py | 513 +++ .../src/codat_lending/api/pull_operations.py | 510 +++ lending/src/codat_lending/api/refresh.py | 488 +++ lending/src/codat_lending/api/reports.py | 956 +++++ lending/src/codat_lending/api/sales.py | 50 + .../src/codat_lending/api/sales_customers.py | 524 +++ .../src/codat_lending/api/sales_payments.py | 524 +++ .../src/codat_lending/api/sales_reports.py | 564 +++ .../codat_lending/api/sales_transactions.py | 524 +++ .../src/codat_lending/api/source_accounts.py | 751 ++++ lending/src/codat_lending/api/suppliers.py | 1210 ++++++ .../api/transaction_categories.py | 524 +++ lending/src/codat_lending/api/transactions.py | 524 +++ .../api/transactions_direct_costs.py | 1222 ++++++ .../codat_lending/api/transactions_group.py | 32 + .../api/transactions_transfers.py | 524 +++ lending/src/codat_lending/api/transfers.py | 519 +++ lending/src/codat_lending/api_client.py | 803 ++++ lending/src/codat_lending/api_response.py | 21 + lending/src/codat_lending/balance_sheet.py | 416 +- lending/src/codat_lending/bank_accounts.py | 452 +-- lending/src/codat_lending/bank_statements.py | 1114 +----- .../src/codat_lending/bank_transactions.py | 456 +-- lending/src/codat_lending/banking.py | 45 +- lending/src/codat_lending/basesdk.py | 393 -- .../src/codat_lending/bill_credit_notes.py | 436 +-- lending/src/codat_lending/bill_payments.py | 436 +-- lending/src/codat_lending/bills.py | 1075 +----- lending/src/codat_lending/cash_flow.py | 212 +- .../codat_lending/categorized_statement.py | 224 +- .../codatlending_accounting_bank_data.py | 242 +- .../codat_lending/codatlending_accounts.py | 426 +-- .../codatlending_banking_transactions.py | 432 +-- .../codat_lending/codatlending_customers.py | 428 +-- .../codatlending_direct_costs.py | 1073 +----- ...atlending_financial_statements_accounts.py | 426 +-- .../codatlending_loan_writeback_accounts.py | 448 +-- .../codat_lending/codatlending_payments.py | 444 +-- .../src/codat_lending/codatlending_reports.py | 498 +-- .../codatlending_sales_payments.py | 428 +-- .../codat_lending/codatlending_suppliers.py | 452 +-- .../codatlending_transactions.py | 432 +-- .../codat_lending/codatlending_transfers.py | 432 +-- lending/src/codat_lending/companies.py | 1284 +------ lending/src/codat_lending/company_info.py | 414 +- lending/src/codat_lending/configuration.py | 596 +++ lending/src/codat_lending/connections.py | 1026 +---- .../src/codat_lending/create_operations.py | 404 +- lending/src/codat_lending/credit_notes.py | 436 +-- lending/src/codat_lending/customers.py | 1063 +----- lending/src/codat_lending/data_integrity.py | 636 +--- lending/src/codat_lending/direct_costs.py | 452 +-- lending/src/codat_lending/direct_incomes.py | 1069 +----- lending/src/codat_lending/disputes.py | 428 +-- lending/src/codat_lending/excel_reports.py | 656 +--- lending/src/codat_lending/exceptions.py | 200 + lending/src/codat_lending/file_upload.py | 639 +--- .../src/codat_lending/financial_statements.py | 38 +- lending/src/codat_lending/invoices.py | 1503 +------- lending/src/codat_lending/journal_entries.py | 436 +-- lending/src/codat_lending/journals.py | 428 +-- lending/src/codat_lending/liabilities.py | 840 +--- lending/src/codat_lending/loan_writeback.py | 63 +- lending/src/codat_lending/locations.py | 424 +-- lending/src/codat_lending/manage_data.py | 229 +- lending/src/codat_lending/manage_reports.py | 410 +- lending/src/codat_lending/metrics.py | 750 +--- lending/src/codat_lending/models/__init__.py | 359 +- .../codat_lending/models/_compat/__init__.py | 3 + .../accounttransactionlinerecordref.py | 18 + .../models/_compat/billlineitem.py | 9 + .../models/_compat/contactref.py | 9 + .../models/_compat/journalline.py | 9 + .../models/_compat/phonenumber.py | 12 + .../models/_compat/propertie_accounttype.py | 12 + .../models/_compat/schema_datatype.py | 50 + .../models/_compat/sourceaccountv2.py | 12 + .../models/_compat/trackingrecordref.py | 10 + lending/src/codat_lending/models/account.py | 133 + .../account_transaction_line_record_ref.py | 114 + ...ccounting_account_transaction_data_type.py | 18 + .../accounting_account_transaction_status.py | 11 + ..._bill_payment_all_of_payment_method_ref.py | 5 + ...unting_bill_payment_all_of_supplier_ref.py | 5 + ...ing_create_account_response_all_of_data.py | 163 + ...reate_bank_account_response_all_of_data.py | 159 + ..._bank_transactions_response_all_of_data.py | 5 + ...create_direct_cost_response_all_of_data.py | 174 + ...ing_create_payment_response_all_of_data.py | 171 + ...ng_create_supplier_response_all_of_data.py | 155 + .../accounting_create_transfer_response.py | 171 + ...ng_create_transfer_response_all_of_data.py | 181 + .../models/accounting_invoice_data_type.py | 8 + .../accounting_journal_entry_data_type.py | 9 + ...ccounting_payment_allocation_allocation.py | 110 + .../models/accounting_payment_method.py | 123 + .../models/accounting_tracking_category.py | 125 + .../models/accounting_transfer_status.py | 11 + ...accountingcreatebankaccounttransactions.py | 30 + .../models/bank_account_prototype.py | 136 + .../codat_lending/models/bill_line_item.py | 182 + .../bill_line_item_purchase_order_line_ref.py | 5 + ..._item_purchase_order_line_ref_data_type.py | 9 + .../models/cash_flow_transaction.py | 151 + .../categorized_bank_statement_accounts.py | 124 + ...categorized_bank_statement_transactions.py | 124 + .../models/commerce_payment_method_status.py | 10 + .../models/commerce_report_dimension_items.py | 99 + .../models/commerce_tax_component.py | 116 + .../codat_lending/models/company_details.py | 141 + .../models/company_reference_links.py | 99 + .../src/codat_lending/models/contact_ref.py | 120 + .../codat_lending/models/contact_reference.py | 120 + .../models/create_connection_request.py | 110 + .../create_source_account200_response.py | 152 + .../models/create_source_account_request.py | 152 + .../src/codat_lending/models/created_date.py | 99 + .../codat_lending/models/current_status.py | 28 + .../models/data_integrity_type.py | 99 + .../src/codat_lending/models/data_statuses.py | 362 ++ .../src/codat_lending/models/data_types.py | 50 + .../codat_lending/models/dataset_status.py | 28 + .../end_upload_session_request_status.py | 9 + .../src/codat_lending/models/error_message.py | 121 + .../src/codat_lending/models/error_status.py | 9 + .../codat_lending/models/errors/__init__.py | 35 +- .../models/errors/codatlendingerror.py | 74 +- .../models/errors/errormessage.py | 74 +- .../models/errors/no_response_error.py | 11 +- .../models/errors/responsevalidationerror.py | 45 +- .../codat_lending/models/errors/sdkerror.py | 55 +- .../codat_lending/models/financial_summary.py | 110 + .../financial_summary_accounting_score.py | 104 + .../financial_summary_books_closed_date.py | 103 + .../get_report_status_report_id_parameter.py | 42 + .../codat_lending/models/item_reference.py | 108 + .../journal_entry_record_ref_data_type.py | 18 + .../src/codat_lending/models/journal_line.py | 139 + .../models/journal_line_tracking.py | 112 + .../models/journal_line_tracking_data_type.py | 10 + .../codat_lending/models/journal_prototype.py | 118 + .../models/loan_transaction_type.py | 11 + lending/src/codat_lending/models/model0.py | 99 + lending/src/codat_lending/models/model3.py | 102 + .../models/operations/__init__.py | 1664 +++----- .../models/operations/create_account.py | 82 +- .../models/operations/create_bank_account.py | 101 +- .../operations/create_bank_account_mapping.py | 61 +- .../operations/create_bank_transactions.py | 101 +- .../models/operations/create_connection.py | 81 +- .../models/operations/create_direct_cost.py | 86 +- .../models/operations/create_payment.py | 99 +- .../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 + .../models/operations/create_supplier.py | 99 +- .../models/operations/create_transfer.py | 99 +- .../models/operations/delete_company.py | 23 +- .../models/operations/delete_connection.py | 32 +- .../download_accounting_bill_attachment.py | 50 +- ...download_accounting_customer_attachment.py | 50 +- ...nload_accounting_direct_cost_attachment.py | 50 +- ...oad_accounting_direct_income_attachment.py | 50 +- .../download_accounting_invoice_attachment.py | 50 +- .../download_accounting_invoice_pdf.py | 32 +- ...download_accounting_supplier_attachment.py | 50 +- .../operations/download_excel_report.py | 33 +- .../models/operations/download_files.py | 50 +- .../end_bank_statement_upload_session.py | 70 +- .../operations/generate_excel_report.py | 33 +- .../operations/generate_loan_summary.py | 39 +- .../operations/generate_loan_transactions.py | 39 +- .../models/operations/generate_report.py | 33 +- .../operations/get_accounting_account.py | 32 +- .../get_accounting_account_transaction.py | 41 +- .../get_accounting_aged_creditors_report.py | 69 +- .../get_accounting_aged_debtors_report.py | 69 +- .../get_accounting_balance_sheet.py | 68 +- .../operations/get_accounting_bank_account.py | 41 +- .../models/operations/get_accounting_bill.py | 32 +- .../get_accounting_bill_attachment.py | 50 +- .../get_accounting_bill_credit_note.py | 32 +- .../operations/get_accounting_bill_payment.py | 32 +- .../get_accounting_cash_flow_statement.py | 68 +- .../operations/get_accounting_credit_note.py | 32 +- .../operations/get_accounting_customer.py | 32 +- .../get_accounting_customer_attachment.py | 50 +- .../operations/get_accounting_direct_cost.py | 41 +- .../get_accounting_direct_cost_attachment.py | 50 +- .../get_accounting_direct_income.py | 41 +- ...get_accounting_direct_income_attachment.py | 77 +- .../operations/get_accounting_invoice.py | 32 +- .../get_accounting_invoice_attachment.py | 50 +- .../operations/get_accounting_journal.py | 32 +- .../get_accounting_journal_entry.py | 32 +- .../operations/get_accounting_payment.py | 32 +- .../operations/get_accounting_profile.py | 23 +- .../get_accounting_profit_and_loss.py | 68 +- .../operations/get_accounting_supplier.py | 32 +- .../get_accounting_supplier_attachment.py | 50 +- .../operations/get_accounting_transfer.py | 41 +- .../operations/get_bank_account_mapping.py | 32 +- ...get_bank_statement_upload_configuration.py | 32 +- .../models/operations/get_banking_account.py | 41 +- .../operations/get_banking_transaction.py | 41 +- .../get_banking_transaction_category.py | 41 +- ...get_categorized_balance_sheet_statement.py | 59 +- .../get_categorized_bank_statement.py | 66 +- ...t_categorized_profit_and_loss_statement.py | 59 +- .../operations/get_commerce_customer.py | 41 +- ...get_commerce_customer_retention_metrics.py | 96 +- .../models/operations/get_commerce_dispute.py | 41 +- .../get_commerce_lifetime_value_metrics.py | 96 +- .../operations/get_commerce_location.py | 41 +- .../models/operations/get_commerce_order.py | 41 +- .../operations/get_commerce_orders_report.py | 96 +- .../models/operations/get_commerce_payment.py | 41 +- .../operations/get_commerce_payment_method.py | 41 +- .../models/operations/get_commerce_product.py | 41 +- .../get_commerce_product_category.py | 41 +- .../models/operations/get_commerce_profile.py | 32 +- .../operations/get_commerce_refunds_report.py | 96 +- .../get_commerce_revenue_metrics.py | 96 +- .../operations/get_commerce_transaction.py | 41 +- .../models/operations/get_company.py | 23 +- .../models/operations/get_connection.py | 32 +- .../get_create_bank_transactions_model.py | 41 +- .../get_create_chartofaccounts_model.py | 32 +- .../get_create_directcosts_model.py | 32 +- .../models/operations/get_create_operation.py | 32 +- .../operations/get_create_payment_model.py | 32 +- .../operations/get_create_transfers_model.py | 32 +- .../get_create_update_bankaccounts_model.py | 32 +- .../get_create_update_suppliers_model.py | 32 +- .../operations/get_data_integrity_status.py | 35 +- .../get_data_integrity_summaries.py | 61 +- .../models/operations/get_data_status.py | 404 +- .../get_excel_report_generation_status.py | 33 +- .../models/operations/get_loan_summary.py | 39 +- .../models/operations/get_pull_operation.py | 32 +- .../is_aged_creditors_report_available.py | 23 +- .../is_aged_debtors_report_available.py | 23 +- .../list_accounting_account_transactions.py | 84 +- .../operations/list_accounting_accounts.py | 75 +- ...st_accounting_bank_account_transactions.py | 93 +- .../list_accounting_bank_accounts.py | 84 +- .../list_accounting_bill_attachments.py | 41 +- .../list_accounting_bill_credit_notes.py | 75 +- .../list_accounting_bill_payments.py | 75 +- .../operations/list_accounting_bills.py | 75 +- .../list_accounting_credit_notes.py | 75 +- .../list_accounting_customer_attachments.py | 41 +- .../operations/list_accounting_customers.py | 75 +- ...list_accounting_direct_cost_attachments.py | 41 +- .../list_accounting_direct_costs.py | 84 +- ...st_accounting_direct_income_attachments.py | 41 +- .../list_accounting_direct_incomes.py | 84 +- .../list_accounting_invoice_attachments.py | 41 +- .../operations/list_accounting_invoices.py | 75 +- .../list_accounting_journal_entries.py | 75 +- .../operations/list_accounting_journals.py | 75 +- .../operations/list_accounting_payments.py | 75 +- .../list_accounting_supplier_attachments.py | 41 +- .../operations/list_accounting_suppliers.py | 75 +- .../operations/list_accounting_transfers.py | 84 +- .../list_banking_account_balances.py | 84 +- .../operations/list_banking_accounts.py | 84 +- .../list_banking_transaction_categories.py | 84 +- .../operations/list_banking_transactions.py | 84 +- .../operations/list_commerce_customers.py | 84 +- .../operations/list_commerce_disputes.py | 84 +- .../operations/list_commerce_locations.py | 32 +- .../models/operations/list_commerce_orders.py | 84 +- .../list_commerce_payment_methods.py | 84 +- .../operations/list_commerce_payments.py | 84 +- .../list_commerce_product_categories.py | 84 +- .../operations/list_commerce_products.py | 84 +- .../operations/list_commerce_transactions.py | 84 +- .../models/operations/list_companies.py | 74 +- .../models/operations/list_connections.py | 75 +- .../operations/list_create_operations.py | 75 +- .../operations/list_data_integrity_details.py | 87 +- .../models/operations/list_files.py | 23 +- .../operations/list_loan_transactions.py | 39 +- .../models/operations/list_pull_operations.py | 75 +- .../operations/list_reconciled_invoices.py | 66 +- .../models/operations/list_reports.py | 75 +- .../operations/refresh_all_data_types.py | 23 +- .../models/operations/refresh_data_type.py | 60 +- .../models/operations/replace_company.py | 50 +- ...set_bank_statement_upload_configuration.py | 63 +- .../start_bank_statement_upload_session.py | 61 +- .../models/operations/unlink_connection.py | 87 +- .../models/operations/update_company.py | 52 +- .../operations/upload_bank_statement_data.py | 103 +- ...upload_bank_statement_data_request_body.py | 7 + ..._statement_data_request_body_typed_dict.py | 7 + .../models/operations/upload_files.py | 57 +- .../src/codat_lending/models/paging_info.py | 113 + .../models/payment_method_type.py | 43 + .../src/codat_lending/models/phone_number.py | 116 + .../models/purchase_order_reference.py | 121 + .../models/record_line_reference.py | 117 + .../models/record_line_reference_data_type.py | 9 + .../src/codat_lending/models/report_item.py | 117 + .../models/report_operation_status.py | 10 + .../models/report_operation_type.py | 10 + .../models/report_source_reference.py | 99 + .../models/sales_order_reference.py | 113 + .../codat_lending/models/shared/__init__.py | 3391 +++++++---------- .../models/shared/accountbalance.py | 151 +- .../models/shared/accountbalanceamounts.py | 184 +- .../shared/accountcategoriesupdatedwebhook.py | 201 +- .../accountcategoriesupdatedwebhookdata.py | 150 +- .../models/shared/accountcategorylevel.py | 129 +- .../models/shared/accountidentifiers.py | 210 +- .../models/shared/accountidentifiertype.py | 47 +- .../models/shared/accountinfo.py | 183 +- .../models/shared/accountingaccount.py | 534 +-- .../models/shared/accountingaccounts.py | 149 +- .../shared/accountingaccounttransaction.py | 452 +-- .../shared/accountingaccounttransactions.py | 152 +- .../models/shared/accountingaddress.py | 186 +- .../models/shared/accountingaddresstype.py | 37 +- .../shared/accountingagedcreditorreport.py | 274 +- .../shared/accountingageddebtorreport.py | 274 +- .../models/shared/accountingattachment.py | 258 +- .../models/shared/accountingbalancesheet.py | 276 +- .../models/shared/accountingbankaccount.py | 401 +- .../models/shared/accountingbankaccounts.py | 149 +- .../shared/accountingbankaccounttype.py | 38 +- .../shared/accountingbanktransaction.py | 286 +- .../shared/accountingbanktransactions.py | 152 +- .../models/shared/accountingbill.py | 599 +-- .../models/shared/accountingbillcreditnote.py | 652 +--- .../shared/accountingbillcreditnotes.py | 152 +- .../models/shared/accountingbillpayment.py | 660 +--- .../models/shared/accountingbillpayments.py | 149 +- .../models/shared/accountingbills.py | 149 +- .../shared/accountingcashflowstatement.py | 278 +- .../models/shared/accountingcompanyinfo.py | 443 +-- .../shared/accountingcreateaccountresponse.py | 751 +--- .../accountingcreatebankaccountresponse.py | 627 +-- .../accountingcreatebanktransactions.py | 129 +- ...ccountingcreatebanktransactionsresponse.py | 401 +- .../accountingcreatedirectcostresponse.py | 668 +--- .../shared/accountingcreatepaymentresponse.py | 1982 +--------- .../accountingcreatesupplierresponse.py | 513 +-- .../accountingcreatetransferresponse.py | 417 +- .../models/shared/accountingcreditnote.py | 647 +--- .../models/shared/accountingcreditnotes.py | 149 +- .../models/shared/accountingcustomer.py | 329 +- .../models/shared/accountingcustomerref.py | 151 +- .../models/shared/accountingcustomers.py | 149 +- .../models/shared/accountingdirectcost.py | 459 +-- .../models/shared/accountingdirectcosts.py | 149 +- .../models/shared/accountingdirectincome.py | 461 +-- .../models/shared/accountingdirectincomes.py | 152 +- .../models/shared/accountinginvoice.py | 810 +--- .../models/shared/accountinginvoices.py | 149 +- .../models/shared/accountingjournal.py | 300 +- .../models/shared/accountingjournalentries.py | 152 +- .../models/shared/accountingjournalentry.py | 409 +- .../models/shared/accountingjournals.py | 149 +- .../models/shared/accountingpayment.py | 1772 +-------- .../shared/accountingpaymentallocation.py | 293 +- .../models/shared/accountingpayments.py | 149 +- .../shared/accountingprofitandlossreport.py | 270 +- .../models/shared/accountingrecordref.py | 121 +- .../models/shared/accountingsupplier.py | 289 +- .../models/shared/accountingsuppliers.py | 149 +- .../models/shared/accountingtransfer.py | 343 +- .../models/shared/accountingtransfers.py | 149 +- .../models/shared/accountinstitution.py | 130 +- .../models/shared/accountprototype.py | 439 +-- .../codat_lending/models/shared/accountref.py | 116 +- .../codat_lending/models/shared/accounts.py | 228 +- .../models/shared/accountspayabletracking.py | 166 +- .../shared/accountsreceivabletracking.py | 185 +- .../models/shared/accountstatus.py | 39 +- .../models/shared/accounttransactionline.py | 175 +- .../shared/accounttransactionlinerecordref.py | 67 +- .../models/shared/accounttype.py | 18 +- .../models/shared/agedcreditor.py | 140 +- .../models/shared/agedcurrencyoutstanding.py | 139 +- .../codat_lending/models/shared/ageddebtor.py | 140 +- .../models/shared/agedoutstandingamount.py | 227 +- .../shared/agedoutstandingamountdetail.py | 126 +- .../models/shared/attachments.py | 142 +- .../models/shared/balancesheet.py | 193 +- .../models/shared/bankaccountref.py | 116 +- .../models/shared/bankaccountstatus.py | 39 +- .../shared/bankfeedbankaccountmapping.py | 189 +- .../bankfeedbankaccountmappingresponse.py | 179 +- .../models/shared/bankfeedmapping.py | 311 +- .../models/shared/bankingaccount.py | 241 +- .../models/shared/bankingaccountbalance.py | 179 +- .../models/shared/bankingaccountbalances.py | 149 +- .../models/shared/bankingaccounts.py | 149 +- .../models/shared/bankingtransaction.py | 330 +- .../shared/bankingtransactioncategories.py | 152 +- .../shared/bankingtransactioncategory.py | 184 +- .../models/shared/bankingtransactionref.py | 211 +- .../models/shared/bankingtransactions.py | 149 +- .../bankstatementuploadconfiguration.py | 157 +- .../models/shared/banktransactiontype.py | 69 +- .../models/shared/billcreditnotelineitem.py | 488 +-- .../models/shared/billcreditnotestatus.py | 44 +- .../models/shared/billedtotype.py | 39 +- .../models/shared/billedtotype1.py | 37 +- .../models/shared/billlineitem.py | 318 +- .../models/shared/billpaymentline.py | 190 +- .../models/shared/billpaymentlinelink.py | 223 +- .../models/shared/billpaymentlinelinktype.py | 53 +- .../codat_lending/models/shared/billstatus.py | 45 +- .../models/shared/cashflowstatement.py | 213 +- .../models/shared/clientratelimitwebhook.py | 155 +- .../shared/clientratelimitwebhookpayload.py | 143 +- .../codat_lending/models/shared/codatfile.py | 59 +- .../models/shared/commerceaddress.py | 157 +- .../models/shared/commerceaddresstype.py | 41 +- .../models/shared/commercecompanyinfo.py | 313 +- .../models/shared/commercecustomer.py | 260 +- .../models/shared/commercecustomerref.py | 116 +- .../models/shared/commercecustomers.py | 149 +- .../models/shared/commercedispute.py | 309 +- .../models/shared/commercedisputes.py | 149 +- .../models/shared/commercelocation.py | 150 +- .../models/shared/commercelocations.py | 149 +- .../models/shared/commerceorder.py | 452 +-- .../models/shared/commerceorders.py | 149 +- .../models/shared/commercepayment.py | 334 +- .../models/shared/commercepaymentmethod.py | 159 +- .../models/shared/commercepaymentmethods.py | 149 +- .../models/shared/commercepayments.py | 149 +- .../models/shared/commerceproduct.py | 195 +- .../shared/commerceproductcategories.py | 152 +- .../models/shared/commerceproductcategory.py | 167 +- .../models/shared/commerceproducts.py | 148 +- .../models/shared/commercerecordref.py | 108 +- .../models/shared/commercereport.py | 259 +- .../models/shared/commercereportcomponent.py | 179 +- .../models/shared/commercereportdimension.py | 147 +- .../models/shared/commercereporterror.py | 122 +- .../models/shared/commercereportmeasure.py | 131 +- .../models/shared/commercetransaction.py | 361 +- .../models/shared/commercetransactions.py | 149 +- .../codat_lending/models/shared/companies.py | 148 +- .../codat_lending/models/shared/company.py | 344 +- .../models/shared/companyreference.py | 149 +- .../models/shared/companyrequestbody.py | 130 +- .../models/shared/companyupdaterequest.py | 133 +- .../codat_lending/models/shared/connection.py | 368 +- .../models/shared/connections.py | 148 +- .../codat_lending/models/shared/contact.py | 223 +- .../codat_lending/models/shared/contactref.py | 67 +- .../shared/createbankaccounttransaction.py | 189 +- .../models/shared/creditnotelineitem.py | 382 +- .../models/shared/creditnotestatus.py | 44 +- .../models/shared/customerstatus.py | 37 +- .../models/shared/dataconnectionerror.py | 253 +- .../models/shared/dataconnectionstatus.py | 39 +- .../models/shared/dataintegrityamounts.py | 138 +- .../models/shared/dataintegritybyamount.py | 176 +- .../models/shared/dataintegritybycount.py | 160 +- .../shared/dataintegrityconnectionid.py | 116 +- .../models/shared/dataintegritydatatype.py | 12 +- .../models/shared/dataintegritydates.py | 287 +- .../models/shared/dataintegritydetail.py | 239 +- .../models/shared/dataintegritydetails.py | 148 +- .../models/shared/dataintegritymatch.py | 165 +- .../models/shared/dataintegritystatus.py | 163 +- .../models/shared/dataintegritystatuses.py | 115 +- .../models/shared/dataintegritystatusinfo.py | 147 +- .../models/shared/dataintegritysummaries.py | 115 +- .../models/shared/dataintegritysummary.py | 135 +- .../codat_lending/models/shared/datasource.py | 117 +- .../codat_lending/models/shared/datastatus.py | 240 +- .../codat_lending/models/shared/datatype.py | 134 +- .../models/shared/directcostlineitem.py | 368 +- .../models/shared/directcostprototype.py | 392 +- .../models/shared/directincomelineitem.py | 355 +- .../models/shared/disputestatus.py | 55 +- .../models/shared/enduploadsessionrequest.py | 121 +- .../models/shared/enhancedcashflowitem.py | 309 +- .../shared/enhancedcashflowtransactions.py | 158 +- .../models/shared/enhancedfinancialreport.py | 226 +- .../shared/enhancedinvoicereportitem.py | 375 +- .../models/shared/enhancedinvoicesreport.py | 140 +- .../shared/enhancedreportaccountcategory.py | 123 +- .../models/shared/enhancedreportinfo.py | 167 +- .../models/shared/errorvalidation.py | 154 +- .../models/shared/errorvalidationitem.py | 156 +- .../models/shared/excelreporttypes.py | 38 +- .../models/shared/excelstatus.py | 222 +- .../src/codat_lending/models/shared/file.py | 197 +- .../codat_lending/models/shared/fileupload.py | 31 +- .../src/codat_lending/models/shared/halref.py | 108 +- .../models/shared/integritystatus.py | 39 +- .../models/shared/invoicelineitem.py | 379 +- .../models/shared/invoicestatus.py | 46 +- .../codat_lending/models/shared/itemref.py | 127 +- .../src/codat_lending/models/shared/items.py | 119 +- .../models/shared/journalentryrecordref.py | 149 +- .../models/shared/journalline.py | 219 +- .../codat_lending/models/shared/journalref.py | 156 +- .../models/shared/journalstatus.py | 37 +- .../models/shared/lendingcustomerref.py | 152 +- .../src/codat_lending/models/shared/links.py | 137 +- .../codat_lending/models/shared/loanref.py | 127 +- .../models/shared/loansummary.py | 135 +- .../shared/loansummaryintegrationtype.py | 37 +- .../models/shared/loansummaryrecordref.py | 143 +- .../models/shared/loansummaryrecordreftype.py | 39 +- .../models/shared/loansummaryreportinfo.py | 143 +- .../models/shared/loansummaryreportitem.py | 228 +- .../models/shared/loantransactions.py | 138 +- .../shared/loantransactionsreportinfo.py | 174 +- .../models/shared/locationref.py | 116 +- .../codat_lending/models/shared/metadata.py | 142 +- .../models/shared/orderdiscountallocation.py | 132 +- .../models/shared/orderlineitem.py | 266 +- .../src/codat_lending/models/shared/path.py | 6 +- .../codat_lending/models/shared/payment.py | 326 +- .../models/shared/paymentallocationpayment.py | 319 +- .../models/shared/paymentline.py | 190 +- .../models/shared/paymentlinelink.py | 280 +- .../models/shared/paymentlinktype.py | 60 +- .../models/shared/paymentmethodref.py | 116 +- .../codat_lending/models/shared/paymentref.py | 313 +- .../models/shared/paymentstatus.py | 45 +- .../models/shared/paymenttype.py | 57 +- .../codat_lending/models/shared/periodunit.py | 12 +- .../models/shared/phonenumber.py | 61 +- .../models/shared/productinventory.py | 172 +- .../models/shared/productinventorylocation.py | 136 +- .../models/shared/productprice.py | 134 +- .../codat_lending/models/shared/productref.py | 116 +- .../models/shared/productvariant.py | 280 +- .../models/shared/productvariantref.py | 116 +- .../models/shared/productvariantstatus.py | 37 +- .../models/shared/profitandlossreport.py | 332 +- .../codat_lending/models/shared/projectref.py | 142 +- .../models/shared/propertie_accounttype.py | 12 +- .../models/shared/propertie_itemref.py | 56 - .../models/shared/pulloperation.py | 338 +- .../models/shared/pulloperations.py | 148 +- .../models/shared/pushchangetype.py | 40 +- .../models/shared/pushfieldvalidation.py | 163 +- .../models/shared/pushoperation.py | 353 +- .../models/shared/pushoperationchange.py | 164 +- .../models/shared/pushoperationref.py | 145 +- .../models/shared/pushoperations.py | 148 +- .../models/shared/pushoperationstatus.py | 38 +- .../codat_lending/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/reportbasis.py | 37 +- .../models/shared/reportcomponentmeasure.py | 137 +- .../models/shared/reportgenerationpayload.py | 48 +- .../codat_lending/models/shared/reportinfo.py | 156 +- .../models/shared/reportinput.py | 37 +- .../models/shared/reportitems.py | 222 +- .../codat_lending/models/shared/reportline.py | 182 +- .../models/shared/reportoperation.py | 274 +- .../codat_lending/models/shared/reports.py | 148 +- .../codat_lending/models/shared/reporttype.py | 8 +- .../models/shared/routinginfo.py | 181 +- .../src/codat_lending/models/shared/schema.py | 103 +- .../models/shared/schema_datatype.py | 50 +- .../codat_lending/models/shared/security.py | 24 +- .../models/shared/servicecharge.py | 210 +- .../models/shared/servicechargetype.py | 39 +- .../models/shared/sourceaccount.py | 350 +- .../models/shared/sourceaccountprototype.py | 245 +- .../models/shared/sourceaccountv2.py | 220 +- .../models/shared/sourceaccountv2prototype.py | 264 +- .../codat_lending/models/shared/sourceref.py | 113 +- .../shared/startuploadsessionrequest.py | 126 +- .../src/codat_lending/models/shared/status.py | 74 +- .../models/shared/supplementaldata.py | 136 +- .../models/shared/supplierref.py | 151 +- .../models/shared/supplierstatus.py | 37 +- .../models/shared/targetaccountoption.py | 187 +- .../models/shared/taxcomponentallocation.py | 166 +- .../models/shared/taxcomponentref.py | 108 +- .../codat_lending/models/shared/taxrateref.py | 150 +- .../codat_lending/models/shared/tracking.py | 149 +- .../models/shared/trackingcategoryref.py | 152 +- .../models/shared/trackingrecordref.py | 58 +- .../models/shared/transactioncategory.py | 142 +- .../models/shared/transactioncategoryref.py | 142 +- .../shared/transactioncategorystatus.py | 37 +- .../models/shared/transactioncode.py | 62 +- .../models/shared/transactionsourceref.py | 106 +- .../models/shared/transactionsourcetype.py | 41 +- .../models/shared/transactiontype.py | 54 +- .../models/shared/transferaccount.py | 148 +- .../codat_lending/models/shared/validation.py | 154 +- .../models/shared/validationitem.py | 170 +- .../codat_lending/models/shared/weblink.py | 132 +- .../src/codat_lending/models/shared/zero.py | 69 +- lending/src/codat_lending/models/source.py | 8 + .../models/source_account_status.py | 12 + .../codat_lending/models/source_account_v2.py | 181 + .../models/source_account_v2_status.py | 12 + .../models/source_account_v2_type.py | 20 + .../src/codat_lending/models/source_type.py | 14 + .../start_upload_session_request_data_type.py | 9 + .../models/tax_rate_reference.py | 107 + .../models/tracking_record_ref.py | 114 + lending/src/codat_lending/models/type.py | 20 + .../codat_lending/models/update_connection.py | 114 + .../upload_bank_statement_data_request.py | 164 + .../models/valid_data_type_links.py | 107 + .../src/codat_lending/models/web_link_type.py | 10 + .../codat_lending/models/webhooks/__init__.py | 35 +- ...orizedbankstatement_generate_successful.py | 33 + ...izedbankstatement_generate_unsuccessful.py | 33 + ...reports_creditmodel_generate_successful.py | 105 +- ...ports_creditmodel_generate_unsuccessful.py | 33 + .../codat_lending/models/withholding_tax.py | 105 + lending/src/codat_lending/orders.py | 428 +-- lending/src/codat_lending/payment_methods.py | 436 +-- lending/src/codat_lending/payments.py | 428 +-- .../src/codat_lending/product_categories.py | 436 +-- lending/src/codat_lending/products.py | 428 +-- lending/src/codat_lending/profit_and_loss.py | 420 +- lending/src/codat_lending/pull_operations.py | 404 +- lending/src/codat_lending/py.typed | 1 - lending/src/codat_lending/refresh.py | 416 +- lending/src/codat_lending/reports.py | 816 +--- lending/src/codat_lending/rest.py | 258 ++ lending/src/codat_lending/sales.py | 63 +- lending/src/codat_lending/sdk.py | 431 +-- lending/src/codat_lending/sdkconfiguration.py | 49 - lending/src/codat_lending/source_accounts.py | 716 +--- lending/src/codat_lending/suppliers.py | 1067 +----- .../codat_lending/transaction_categories.py | 440 +-- lending/src/codat_lending/transactions.py | 41 +- lending/src/codat_lending/transfers.py | 450 +-- lending/src/codat_lending/types/__init__.py | 73 +- lending/src/codat_lending/types/basemodel.py | 77 - lending/src/codat_lending/utils/__init__.py | 176 +- .../src/codat_lending/utils/annotations.py | 79 - lending/src/codat_lending/utils/datetimes.py | 23 - .../codat_lending/utils/dynamic_imports.py | 54 - lending/src/codat_lending/utils/enums.py | 134 - .../src/codat_lending/utils/eventstreaming.py | 309 -- lending/src/codat_lending/utils/forms.py | 234 -- lending/src/codat_lending/utils/headers.py | 136 - lending/src/codat_lending/utils/logger.py | 22 - lending/src/codat_lending/utils/metadata.py | 119 - .../src/codat_lending/utils/queryparams.py | 217 -- .../src/codat_lending/utils/requestbodies.py | 66 - lending/src/codat_lending/utils/retries.py | 343 +- lending/src/codat_lending/utils/security.py | 198 - .../src/codat_lending/utils/serializers.py | 205 +- .../utils/unmarshal_json_response.py | 38 - lending/src/codat_lending/utils/url.py | 155 - lending/src/codat_lending/utils/values.py | 137 - 1348 files changed, 92368 insertions(+), 112392 deletions(-) create mode 100644 lending/docs/models/operations/bankingaccount.md create mode 100644 lending/docs/models/operations/bankingtransactions.md create mode 100644 lending/docs/models/operations/createcompanyrequest.md create mode 100644 lending/docs/models/operations/downloadcategorizedbankstatementexcelrequest.md create mode 100644 lending/docs/models/operations/downloadcreditmodelexcelrequest.md create mode 100644 lending/docs/models/operations/getcategorizedbankstatementtransactionsrequest.md create mode 100644 lending/docs/models/operations/getfinancialsummaryrequest.md create mode 100644 lending/docs/models/operations/getreportstatusrequest.md create mode 100644 lending/docs/models/operations/listcategorizedbankstatementaccountsrequest.md create mode 100644 lending/docs/models/operations/sourceaccount.md rename lending/docs/models/{shared/accountingcreatebankaccountresponseaccountingbankaccount.md => operations/sourceaccountprototype.md} (74%) create mode 100644 lending/docs/models/operations/sourceaccountv2.md create mode 100644 lending/docs/models/operations/sourceaccountv2prototype.md rename lending/docs/models/shared/{accountingcreatesupplierresponseaccountingsupplier.md => account.md} (62%) create mode 100644 lending/docs/models/shared/accountingaccounttransactiondatatype.md delete mode 100644 lending/docs/models/shared/accountingaccountvaliddatatypelinks.md create mode 100644 lending/docs/models/shared/accountingcreateaccountresponseallofdata.md delete mode 100644 lending/docs/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md rename lending/docs/models/shared/{accountingcreatetransferresponseaccountingtransfer.md => accountingcreatebankaccountresponseallofdata.md} (85%) rename lending/docs/models/shared/{accountingcreatedirectcostresponseaccountingdirectcost.md => accountingcreatedirectcostresponseallofdata.md} (75%) rename lending/docs/models/shared/{accountingcreatepaymentresponseaccountingpayment.md => accountingcreatepaymentresponseallofdata.md} (68%) create mode 100644 lending/docs/models/shared/accountingcreatesupplierresponseallofdata.md create mode 100644 lending/docs/models/shared/accountingcreatetransferresponseallofdata.md create mode 100644 lending/docs/models/shared/accountingjournalentrydatatype.md rename lending/docs/models/shared/{allocation.md => accountingpaymentallocationallocation.md} (99%) create mode 100644 lending/docs/models/shared/accountingpaymentmethod.md create mode 100644 lending/docs/models/shared/accountingtrackingcategory.md create mode 100644 lending/docs/models/shared/bankaccountprototype.md create mode 100644 lending/docs/models/shared/billlineitempurchaseorderlinerefdatatype.md create mode 100644 lending/docs/models/shared/categorizedbankstatementaccounts.md create mode 100644 lending/docs/models/shared/categorizedbankstatementtransactions.md create mode 100644 lending/docs/models/shared/commercetaxcomponent.md create mode 100644 lending/docs/models/shared/companydetails.md create mode 100644 lending/docs/models/shared/createconnectionrequest.md create mode 100644 lending/docs/models/shared/createddate.md create mode 100644 lending/docs/models/shared/createsourceaccount200response.md create mode 100644 lending/docs/models/shared/createsourceaccountrequest.md create mode 100644 lending/docs/models/shared/currentstatus.md create mode 100644 lending/docs/models/shared/dataintegritytype.md create mode 100644 lending/docs/models/shared/datastatuses.md create mode 100644 lending/docs/models/shared/errormessage.md create mode 100644 lending/docs/models/shared/financialsummary.md create mode 100644 lending/docs/models/shared/financialsummaryaccountingscore.md create mode 100644 lending/docs/models/shared/financialsummarybookscloseddate.md create mode 100644 lending/docs/models/shared/journallinetrackingdatatype.md rename lending/docs/models/shared/{accountingcreateaccountresponseaccountingaccount.md => journalprototype.md} (61%) create mode 100644 lending/docs/models/shared/model0.md create mode 100644 lending/docs/models/shared/model3.md create mode 100644 lending/docs/models/shared/paginginfo.md create mode 100644 lending/docs/models/shared/paymentmethodtype.md delete mode 100644 lending/docs/models/shared/propertieitemref.md create mode 100644 lending/docs/models/shared/recordlinereferencedatatype.md create mode 100644 lending/docs/models/shared/sourceaccountv2type.md create mode 100644 lending/docs/models/shared/updateconnection.md create mode 100644 lending/docs/models/shared/uploadbankstatementdatarequest.md delete mode 100644 lending/docs/models/shared/zero.md delete mode 100644 lending/docs/sdks/accountbalances/README.md rename lending/docs/sdks/{codatlendingaccountingbankdata => accountingbankdata}/README.md (97%) delete mode 100644 lending/docs/sdks/accounts/README.md create mode 100644 lending/docs/sdks/accountspayable/README.md create mode 100644 lending/docs/sdks/accountsreceivable/README.md delete mode 100644 lending/docs/sdks/accounttransactions/README.md delete mode 100644 lending/docs/sdks/balancesheet/README.md delete mode 100644 lending/docs/sdks/bankaccounts/README.md create mode 100644 lending/docs/sdks/banking/README.md delete mode 100644 lending/docs/sdks/banktransactions/README.md delete mode 100644 lending/docs/sdks/billcreditnotes/README.md delete mode 100644 lending/docs/sdks/billpayments/README.md delete mode 100644 lending/docs/sdks/bills/README.md delete mode 100644 lending/docs/sdks/cashflow/README.md delete mode 100644 lending/docs/sdks/categorizedstatement/README.md delete mode 100644 lending/docs/sdks/codatlendingaccounts/README.md delete mode 100644 lending/docs/sdks/codatlendingbankingtransactions/README.md delete mode 100644 lending/docs/sdks/codatlendingcustomers/README.md delete mode 100644 lending/docs/sdks/codatlendingdirectcosts/README.md delete mode 100644 lending/docs/sdks/codatlendingfinancialstatementsaccounts/README.md delete mode 100644 lending/docs/sdks/codatlendingloanwritebackaccounts/README.md delete mode 100644 lending/docs/sdks/codatlendingpayments/README.md delete mode 100644 lending/docs/sdks/codatlendingreports/README.md delete mode 100644 lending/docs/sdks/codatlendingsalespayments/README.md delete mode 100644 lending/docs/sdks/codatlendingsuppliers/README.md delete mode 100644 lending/docs/sdks/codatlendingtransactions/README.md delete mode 100644 lending/docs/sdks/codatlendingtransfers/README.md delete mode 100644 lending/docs/sdks/createoperations/README.md delete mode 100644 lending/docs/sdks/creditnotes/README.md delete mode 100644 lending/docs/sdks/customers/README.md delete mode 100644 lending/docs/sdks/directcosts/README.md delete mode 100644 lending/docs/sdks/directincomes/README.md delete mode 100644 lending/docs/sdks/disputes/README.md create mode 100644 lending/docs/sdks/financialstatements/README.md create mode 100644 lending/docs/sdks/financialsummary/README.md delete mode 100644 lending/docs/sdks/invoices/README.md delete mode 100644 lending/docs/sdks/journalentries/README.md delete mode 100644 lending/docs/sdks/journals/README.md create mode 100644 lending/docs/sdks/loanwriteback/README.md delete mode 100644 lending/docs/sdks/locations/README.md delete mode 100644 lending/docs/sdks/metrics/README.md delete mode 100644 lending/docs/sdks/orders/README.md delete mode 100644 lending/docs/sdks/paymentmethods/README.md delete mode 100644 lending/docs/sdks/payments/README.md delete mode 100644 lending/docs/sdks/productcategories/README.md delete mode 100644 lending/docs/sdks/products/README.md delete mode 100644 lending/docs/sdks/profitandloss/README.md delete mode 100644 lending/docs/sdks/pulloperations/README.md delete mode 100644 lending/docs/sdks/refresh/README.md delete mode 100644 lending/docs/sdks/reports/README.md create mode 100644 lending/docs/sdks/sales/README.md delete mode 100644 lending/docs/sdks/sourceaccounts/README.md delete mode 100644 lending/docs/sdks/suppliers/README.md delete mode 100644 lending/docs/sdks/transactioncategories/README.md create mode 100644 lending/docs/sdks/transactions/README.md delete mode 100644 lending/docs/sdks/transfers/README.md create mode 100644 lending/src/codat_lending/_httpx_transport.py create mode 100644 lending/src/codat_lending/api/__init__.py create mode 100644 lending/src/codat_lending/api/account_balances.py create mode 100644 lending/src/codat_lending/api/account_transactions.py create mode 100644 lending/src/codat_lending/api/accounting_bank_data.py create mode 100644 lending/src/codat_lending/api/accounts.py create mode 100644 lending/src/codat_lending/api/accounts_payable.py create mode 100644 lending/src/codat_lending/api/accounts_receivable.py create mode 100644 lending/src/codat_lending/api/balance_sheet.py create mode 100644 lending/src/codat_lending/api/bank_accounts.py create mode 100644 lending/src/codat_lending/api/bank_statements.py create mode 100644 lending/src/codat_lending/api/bank_transactions.py create mode 100644 lending/src/codat_lending/api/banking.py create mode 100644 lending/src/codat_lending/api/banking_accounts.py create mode 100644 lending/src/codat_lending/api/bill_credit_notes.py create mode 100644 lending/src/codat_lending/api/bill_payments.py create mode 100644 lending/src/codat_lending/api/bills.py create mode 100644 lending/src/codat_lending/api/cash_flow.py create mode 100644 lending/src/codat_lending/api/categorized_statement.py create mode 100644 lending/src/codat_lending/api/companies.py create mode 100644 lending/src/codat_lending/api/company_info.py create mode 100644 lending/src/codat_lending/api/connections.py create mode 100644 lending/src/codat_lending/api/create_operations.py create mode 100644 lending/src/codat_lending/api/credit_notes.py create mode 100644 lending/src/codat_lending/api/customers.py create mode 100644 lending/src/codat_lending/api/data_integrity.py create mode 100644 lending/src/codat_lending/api/direct_costs.py create mode 100644 lending/src/codat_lending/api/direct_incomes.py create mode 100644 lending/src/codat_lending/api/disputes.py create mode 100644 lending/src/codat_lending/api/excel_reports.py create mode 100644 lending/src/codat_lending/api/file_upload.py create mode 100644 lending/src/codat_lending/api/financial_statements.py create mode 100644 lending/src/codat_lending/api/financial_statements_accounts.py create mode 100644 lending/src/codat_lending/api/financial_summary.py create mode 100644 lending/src/codat_lending/api/invoices.py create mode 100644 lending/src/codat_lending/api/journal_entries.py create mode 100644 lending/src/codat_lending/api/journals.py create mode 100644 lending/src/codat_lending/api/liabilities.py create mode 100644 lending/src/codat_lending/api/loan_writeback.py create mode 100644 lending/src/codat_lending/api/loan_writeback_accounts.py create mode 100644 lending/src/codat_lending/api/loan_writeback_payments.py create mode 100644 lending/src/codat_lending/api/loan_writeback_suppliers.py create mode 100644 lending/src/codat_lending/api/locations.py create mode 100644 lending/src/codat_lending/api/manage_data.py create mode 100644 lending/src/codat_lending/api/manage_reports.py create mode 100644 lending/src/codat_lending/api/metrics.py create mode 100644 lending/src/codat_lending/api/orders.py create mode 100644 lending/src/codat_lending/api/payment_methods.py create mode 100644 lending/src/codat_lending/api/payments.py create mode 100644 lending/src/codat_lending/api/product_categories.py create mode 100644 lending/src/codat_lending/api/products.py create mode 100644 lending/src/codat_lending/api/profit_and_loss.py create mode 100644 lending/src/codat_lending/api/pull_operations.py create mode 100644 lending/src/codat_lending/api/refresh.py create mode 100644 lending/src/codat_lending/api/reports.py create mode 100644 lending/src/codat_lending/api/sales.py create mode 100644 lending/src/codat_lending/api/sales_customers.py create mode 100644 lending/src/codat_lending/api/sales_payments.py create mode 100644 lending/src/codat_lending/api/sales_reports.py create mode 100644 lending/src/codat_lending/api/sales_transactions.py create mode 100644 lending/src/codat_lending/api/source_accounts.py create mode 100644 lending/src/codat_lending/api/suppliers.py create mode 100644 lending/src/codat_lending/api/transaction_categories.py create mode 100644 lending/src/codat_lending/api/transactions.py create mode 100644 lending/src/codat_lending/api/transactions_direct_costs.py create mode 100644 lending/src/codat_lending/api/transactions_group.py create mode 100644 lending/src/codat_lending/api/transactions_transfers.py create mode 100644 lending/src/codat_lending/api/transfers.py create mode 100644 lending/src/codat_lending/api_client.py create mode 100644 lending/src/codat_lending/api_response.py delete mode 100644 lending/src/codat_lending/basesdk.py create mode 100644 lending/src/codat_lending/configuration.py create mode 100644 lending/src/codat_lending/exceptions.py create mode 100644 lending/src/codat_lending/models/_compat/__init__.py create mode 100644 lending/src/codat_lending/models/_compat/accounttransactionlinerecordref.py create mode 100644 lending/src/codat_lending/models/_compat/billlineitem.py create mode 100644 lending/src/codat_lending/models/_compat/contactref.py create mode 100644 lending/src/codat_lending/models/_compat/journalline.py create mode 100644 lending/src/codat_lending/models/_compat/phonenumber.py create mode 100644 lending/src/codat_lending/models/_compat/propertie_accounttype.py create mode 100644 lending/src/codat_lending/models/_compat/schema_datatype.py create mode 100644 lending/src/codat_lending/models/_compat/sourceaccountv2.py create mode 100644 lending/src/codat_lending/models/_compat/trackingrecordref.py create mode 100644 lending/src/codat_lending/models/account.py create mode 100644 lending/src/codat_lending/models/account_transaction_line_record_ref.py create mode 100644 lending/src/codat_lending/models/accounting_account_transaction_data_type.py create mode 100644 lending/src/codat_lending/models/accounting_account_transaction_status.py create mode 100644 lending/src/codat_lending/models/accounting_bill_payment_all_of_payment_method_ref.py create mode 100644 lending/src/codat_lending/models/accounting_bill_payment_all_of_supplier_ref.py create mode 100644 lending/src/codat_lending/models/accounting_create_account_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_bank_account_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_bank_transactions_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_direct_cost_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_payment_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_supplier_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_create_transfer_response.py create mode 100644 lending/src/codat_lending/models/accounting_create_transfer_response_all_of_data.py create mode 100644 lending/src/codat_lending/models/accounting_invoice_data_type.py create mode 100644 lending/src/codat_lending/models/accounting_journal_entry_data_type.py create mode 100644 lending/src/codat_lending/models/accounting_payment_allocation_allocation.py create mode 100644 lending/src/codat_lending/models/accounting_payment_method.py create mode 100644 lending/src/codat_lending/models/accounting_tracking_category.py create mode 100644 lending/src/codat_lending/models/accounting_transfer_status.py create mode 100644 lending/src/codat_lending/models/accountingcreatebankaccounttransactions.py create mode 100644 lending/src/codat_lending/models/bank_account_prototype.py create mode 100644 lending/src/codat_lending/models/bill_line_item.py create mode 100644 lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref.py create mode 100644 lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref_data_type.py create mode 100644 lending/src/codat_lending/models/cash_flow_transaction.py create mode 100644 lending/src/codat_lending/models/categorized_bank_statement_accounts.py create mode 100644 lending/src/codat_lending/models/categorized_bank_statement_transactions.py create mode 100644 lending/src/codat_lending/models/commerce_payment_method_status.py create mode 100644 lending/src/codat_lending/models/commerce_report_dimension_items.py create mode 100644 lending/src/codat_lending/models/commerce_tax_component.py create mode 100644 lending/src/codat_lending/models/company_details.py create mode 100644 lending/src/codat_lending/models/company_reference_links.py create mode 100644 lending/src/codat_lending/models/contact_ref.py create mode 100644 lending/src/codat_lending/models/contact_reference.py create mode 100644 lending/src/codat_lending/models/create_connection_request.py create mode 100644 lending/src/codat_lending/models/create_source_account200_response.py create mode 100644 lending/src/codat_lending/models/create_source_account_request.py create mode 100644 lending/src/codat_lending/models/created_date.py create mode 100644 lending/src/codat_lending/models/current_status.py create mode 100644 lending/src/codat_lending/models/data_integrity_type.py create mode 100644 lending/src/codat_lending/models/data_statuses.py create mode 100644 lending/src/codat_lending/models/data_types.py create mode 100644 lending/src/codat_lending/models/dataset_status.py create mode 100644 lending/src/codat_lending/models/end_upload_session_request_status.py create mode 100644 lending/src/codat_lending/models/error_message.py create mode 100644 lending/src/codat_lending/models/error_status.py create mode 100644 lending/src/codat_lending/models/financial_summary.py create mode 100644 lending/src/codat_lending/models/financial_summary_accounting_score.py create mode 100644 lending/src/codat_lending/models/financial_summary_books_closed_date.py create mode 100644 lending/src/codat_lending/models/get_report_status_report_id_parameter.py create mode 100644 lending/src/codat_lending/models/item_reference.py create mode 100644 lending/src/codat_lending/models/journal_entry_record_ref_data_type.py create mode 100644 lending/src/codat_lending/models/journal_line.py create mode 100644 lending/src/codat_lending/models/journal_line_tracking.py create mode 100644 lending/src/codat_lending/models/journal_line_tracking_data_type.py create mode 100644 lending/src/codat_lending/models/journal_prototype.py create mode 100644 lending/src/codat_lending/models/loan_transaction_type.py create mode 100644 lending/src/codat_lending/models/model0.py create mode 100644 lending/src/codat_lending/models/model3.py create mode 100644 lending/src/codat_lending/models/operations/create_source_account_request_body.py create mode 100644 lending/src/codat_lending/models/operations/create_source_account_request_body_typed_dict.py create mode 100644 lending/src/codat_lending/models/operations/create_source_account_response_body.py create mode 100644 lending/src/codat_lending/models/operations/create_source_account_response_body_typed_dict.py create mode 100644 lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body.py create mode 100644 lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body_typed_dict.py create mode 100644 lending/src/codat_lending/models/paging_info.py create mode 100644 lending/src/codat_lending/models/payment_method_type.py create mode 100644 lending/src/codat_lending/models/phone_number.py create mode 100644 lending/src/codat_lending/models/purchase_order_reference.py create mode 100644 lending/src/codat_lending/models/record_line_reference.py create mode 100644 lending/src/codat_lending/models/record_line_reference_data_type.py create mode 100644 lending/src/codat_lending/models/report_item.py create mode 100644 lending/src/codat_lending/models/report_operation_status.py create mode 100644 lending/src/codat_lending/models/report_operation_type.py create mode 100644 lending/src/codat_lending/models/report_source_reference.py create mode 100644 lending/src/codat_lending/models/sales_order_reference.py delete mode 100644 lending/src/codat_lending/models/shared/propertie_itemref.py create mode 100644 lending/src/codat_lending/models/source.py create mode 100644 lending/src/codat_lending/models/source_account_status.py create mode 100644 lending/src/codat_lending/models/source_account_v2.py create mode 100644 lending/src/codat_lending/models/source_account_v2_status.py create mode 100644 lending/src/codat_lending/models/source_account_v2_type.py create mode 100644 lending/src/codat_lending/models/source_type.py create mode 100644 lending/src/codat_lending/models/start_upload_session_request_data_type.py create mode 100644 lending/src/codat_lending/models/tax_rate_reference.py create mode 100644 lending/src/codat_lending/models/tracking_record_ref.py create mode 100644 lending/src/codat_lending/models/type.py create mode 100644 lending/src/codat_lending/models/update_connection.py create mode 100644 lending/src/codat_lending/models/upload_bank_statement_data_request.py create mode 100644 lending/src/codat_lending/models/valid_data_type_links.py create mode 100644 lending/src/codat_lending/models/web_link_type.py create mode 100644 lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_successful.py create mode 100644 lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_unsuccessful.py create mode 100644 lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_unsuccessful.py create mode 100644 lending/src/codat_lending/models/withholding_tax.py create mode 100644 lending/src/codat_lending/rest.py delete mode 100644 lending/src/codat_lending/sdkconfiguration.py delete mode 100644 lending/src/codat_lending/types/basemodel.py delete mode 100644 lending/src/codat_lending/utils/annotations.py delete mode 100644 lending/src/codat_lending/utils/datetimes.py delete mode 100644 lending/src/codat_lending/utils/dynamic_imports.py delete mode 100644 lending/src/codat_lending/utils/enums.py delete mode 100644 lending/src/codat_lending/utils/eventstreaming.py delete mode 100644 lending/src/codat_lending/utils/forms.py delete mode 100644 lending/src/codat_lending/utils/headers.py delete mode 100644 lending/src/codat_lending/utils/logger.py delete mode 100644 lending/src/codat_lending/utils/metadata.py delete mode 100644 lending/src/codat_lending/utils/queryparams.py delete mode 100644 lending/src/codat_lending/utils/requestbodies.py delete mode 100644 lending/src/codat_lending/utils/security.py delete mode 100644 lending/src/codat_lending/utils/unmarshal_json_response.py delete mode 100644 lending/src/codat_lending/utils/url.py delete mode 100644 lending/src/codat_lending/utils/values.py diff --git a/lending/RELEASES.md b/lending/RELEASES.md index e736719cb..2ca62be7c 100644 --- a/lending/RELEASES.md +++ b/lending/RELEASES.md @@ -208,4 +208,14 @@ Based on: ### Generated - [python v11.0.1] lending ### Releases -- [PyPI v11.0.1] https://pypi.org/project/codat-lending/11.0.1 - lending \ No newline at end of file +- [PyPI v11.0.1] https://pypi.org/project/codat-lending/11.0.1 - lending + +## 2026-08-07 11:56:14 +### Changes +Based on: +- OpenAPI Doc 3.0.0 https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Lending.yaml +- codat sdk-codegen b5f25135143b1ccfb99c941df11a7a1596dbe31e https://github.com/codat-spikes/sdk-codegen +### Generated +- [python v11.0.2] lending +### Releases +- [PyPI v11.0.2] https://pypi.org/project/codat-lending/11.0.2 - lending diff --git a/lending/USAGE.md b/lending/USAGE.md index 599a6341c..f3e40f820 100644 --- a/lending/USAGE.md +++ b/lending/USAGE.md @@ -1,49 +1,57 @@ - -```python -# Synchronous Example -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - -async def main(): - - async with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), - ) as cl_client: - - res = await cl_client.companies.create_async(request={ - "name": "Technicalium", - }) - - # Handle response - print(res) - -asyncio.run(main()) -``` + +```python +# Synchronous Example +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", + }) + + # 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_lending import CodatLending +from codat_lending.models import shared + +async def main(): + + async with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), + ) as cl_client: + + res = await cl_client.accounting_bank_data.list_transactions_async(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + "order_by": "-modifiedDate", + }) + + # Handle response + print(res) + +asyncio.run(main()) +``` \ No newline at end of file diff --git a/lending/docs/models/errors/errormessage.md b/lending/docs/models/errors/errormessage.md index c24cd9acc..425e22bbf 100644 --- a/lending/docs/models/errors/errormessage.md +++ b/lending/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/lending/docs/models/operations/bankingaccount.md b/lending/docs/models/operations/bankingaccount.md new file mode 100644 index 000000000..935baa826 --- /dev/null +++ b/lending/docs/models/operations/bankingaccount.md @@ -0,0 +1,18 @@ +# BankingAccount + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `balance` | [shared.AccountBalanceAmounts](../../models/shared/accountbalanceamounts.md) | :heavy_check_mark: | An object containing bank balance data. | +| `currency` | *str* | :heavy_check_mark: | The currency code for the account. | +| `holder` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the person or company who holds the account. | +| `id` | *str* | :heavy_check_mark: | The ID of the account from the provider. | +| `identifiers` | [shared.AccountIdentifiers](../../models/shared/accountidentifiers.md) | :heavy_check_mark: | N/A | +| `informal_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available. | +| `institution` | [shared.AccountInstitution](../../models/shared/accountinstitution.md) | :heavy_check_mark: | 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. | +| `name` | *str* | :heavy_check_mark: | The name of the account according to the provider. | +| `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. | +| `type` | [shared.AccountingBankAccountType](../../models/shared/accountingbankaccounttype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/operations/bankingtransactions.md b/lending/docs/models/operations/bankingtransactions.md new file mode 100644 index 000000000..a8338f5ee --- /dev/null +++ b/lending/docs/models/operations/bankingtransactions.md @@ -0,0 +1,12 @@ +# BankingTransactions + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | +| `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.BankingTransaction]](../../models/shared/bankingtransaction.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/lending/docs/models/operations/createaccountrequest.md b/lending/docs/models/operations/createaccountrequest.md index f8733acf4..f7d51cf1e 100644 --- a/lending/docs/models/operations/createaccountrequest.md +++ b/lending/docs/models/operations/createaccountrequest.md @@ -1,12 +1,12 @@ -# CreateAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `account_prototype` | [Optional[shared.AccountPrototype]](../../models/shared/accountprototype.md) | :heavy_minus_sign: | N/A | | -| `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 | +# CreateAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `account_prototype` | [Optional[shared.AccountPrototype]](../../models/shared/accountprototype.md) | :heavy_minus_sign: | N/A | | +| `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 | | `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/lending/docs/models/operations/createbankaccountmappingrequest.md b/lending/docs/models/operations/createbankaccountmappingrequest.md index b024eacff..b6d7fa0e4 100644 --- a/lending/docs/models/operations/createbankaccountmappingrequest.md +++ b/lending/docs/models/operations/createbankaccountmappingrequest.md @@ -1,10 +1,10 @@ -# CreateBankAccountMappingRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `bank_feed_bank_account_mapping` | [Optional[shared.BankFeedBankAccountMapping]](../../models/shared/bankfeedbankaccountmapping.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_bank_account_mapping` | [Optional[shared.BankFeedBankAccountMapping]](../../models/shared/bankfeedbankaccountmapping.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/lending/docs/models/operations/createbankaccountrequest.md b/lending/docs/models/operations/createbankaccountrequest.md index f0518ea38..1e0aaccee 100644 --- a/lending/docs/models/operations/createbankaccountrequest.md +++ b/lending/docs/models/operations/createbankaccountrequest.md @@ -1,12 +1,12 @@ -# CreateBankAccountRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `accounting_bank_account` | [OptionalNullable[shared.AccountingBankAccount]](../../models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `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 +# CreateBankAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `accounting_bank_account` | [Optional[shared.AccountingBankAccount]](../../models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `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/lending/docs/models/operations/createbanktransactionsrequest.md b/lending/docs/models/operations/createbanktransactionsrequest.md index e1356a6f9..12808b32e 100644 --- a/lending/docs/models/operations/createbanktransactionsrequest.md +++ b/lending/docs/models/operations/createbanktransactionsrequest.md @@ -1,13 +1,13 @@ -# CreateBankTransactionsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accounting_create_bank_transactions` | [Optional[shared.AccountingCreateBankTransactions]](../../models/shared/accountingcreatebanktransactions.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 | +| `accounting_create_bank_transactions` | [Optional[shared.AccountingCreateBankTransactions]](../../models/shared/accountingcreatebanktransactions.md) | :heavy_minus_sign: | N/A | | +| `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 | | `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/lending/docs/models/operations/createcompanyrequest.md b/lending/docs/models/operations/createcompanyrequest.md new file mode 100644 index 000000000..ebd7ca0a0 --- /dev/null +++ b/lending/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/lending/docs/models/operations/createconnectionrequest.md b/lending/docs/models/operations/createconnectionrequest.md index 0998495bf..32316fd7b 100644 --- a/lending/docs/models/operations/createconnectionrequest.md +++ b/lending/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/lending/docs/models/operations/createconnectionrequestbody.md b/lending/docs/models/operations/createconnectionrequestbody.md index 891314d08..5a6200d18 100644 --- a/lending/docs/models/operations/createconnectionrequestbody.md +++ b/lending/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/lending/docs/models/operations/createdirectcostrequest.md b/lending/docs/models/operations/createdirectcostrequest.md index 9593136bf..79d3e4afd 100644 --- a/lending/docs/models/operations/createdirectcostrequest.md +++ b/lending/docs/models/operations/createdirectcostrequest.md @@ -1,12 +1,12 @@ -# CreateDirectCostRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `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 | -| `direct_cost_prototype` | [Optional[shared.DirectCostPrototype]](../../models/shared/directcostprototype.md) | :heavy_minus_sign: | N/A | | +# CreateDirectCostRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `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 | +| `direct_cost_prototype` | [Optional[shared.DirectCostPrototype]](../../models/shared/directcostprototype.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/lending/docs/models/operations/createpaymentrequest.md b/lending/docs/models/operations/createpaymentrequest.md index a0aeae045..5f06d2fdc 100644 --- a/lending/docs/models/operations/createpaymentrequest.md +++ b/lending/docs/models/operations/createpaymentrequest.md @@ -1,12 +1,12 @@ -# CreatePaymentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `accounting_payment` | [OptionalNullable[shared.AccountingPayment]](../../models/shared/accountingpayment.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `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 +# CreatePaymentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `accounting_payment` | [Optional[shared.AccountingPayment]](../../models/shared/accountingpayment.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `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/lending/docs/models/operations/createsourceaccountrequest.md b/lending/docs/models/operations/createsourceaccountrequest.md index dfc128841..7a6459cd5 100644 --- a/lending/docs/models/operations/createsourceaccountrequest.md +++ b/lending/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/lending/docs/models/operations/createsourceaccountrequestbody.md b/lending/docs/models/operations/createsourceaccountrequestbody.md index 12a62d529..8cd37465b 100644 --- a/lending/docs/models/operations/createsourceaccountrequestbody.md +++ b/lending/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/lending/docs/models/operations/createsourceaccountresponsebody.md b/lending/docs/models/operations/createsourceaccountresponsebody.md index 28e4dd0dd..90aa56db4 100644 --- a/lending/docs/models/operations/createsourceaccountresponsebody.md +++ b/lending/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/lending/docs/models/operations/createsupplierrequest.md b/lending/docs/models/operations/createsupplierrequest.md index 69354e1af..72cef567d 100644 --- a/lending/docs/models/operations/createsupplierrequest.md +++ b/lending/docs/models/operations/createsupplierrequest.md @@ -1,12 +1,12 @@ -# CreateSupplierRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `accounting_supplier` | [OptionalNullable[shared.AccountingSupplier]](../../models/shared/accountingsupplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} | -| `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 | -| `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 +# CreateSupplierRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `accounting_supplier` | [Optional[shared.AccountingSupplier]](../../models/shared/accountingsupplier.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `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/lending/docs/models/operations/createtransferrequest.md b/lending/docs/models/operations/createtransferrequest.md index 7e39d07eb..a87906290 100644 --- a/lending/docs/models/operations/createtransferrequest.md +++ b/lending/docs/models/operations/createtransferrequest.md @@ -1,12 +1,12 @@ -# CreateTransferRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `accounting_transfer` | [OptionalNullable[shared.AccountingTransfer]](../../models/shared/accountingtransfer.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `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 +# CreateTransferRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `accounting_transfer` | [Optional[shared.AccountingTransfer]](../../models/shared/accountingtransfer.md) | :heavy_minus_sign: | N/A | | +| `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 | +| `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/lending/docs/models/operations/deletecompanyrequest.md b/lending/docs/models/operations/deletecompanyrequest.md index 338ee40e5..6f16204ca 100644 --- a/lending/docs/models/operations/deletecompanyrequest.md +++ b/lending/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/lending/docs/models/operations/deleteconnectionrequest.md b/lending/docs/models/operations/deleteconnectionrequest.md index 9650dc387..f4b0d4cb4 100644 --- a/lending/docs/models/operations/deleteconnectionrequest.md +++ b/lending/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/lending/docs/models/operations/downloadaccountingbillattachmentrequest.md b/lending/docs/models/operations/downloadaccountingbillattachmentrequest.md index 48ba139b6..701648180 100644 --- a/lending/docs/models/operations/downloadaccountingbillattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountingbillattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingBillAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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 | +# DownloadAccountingBillAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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/lending/docs/models/operations/downloadaccountingcustomerattachmentrequest.md b/lending/docs/models/operations/downloadaccountingcustomerattachmentrequest.md index 9090dce5b..6e9074070 100644 --- a/lending/docs/models/operations/downloadaccountingcustomerattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountingcustomerattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingCustomerAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# DownloadAccountingCustomerAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `customer_id` | *str* | :heavy_check_mark: | Unique identifier for a customer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadaccountingdirectcostattachmentrequest.md b/lending/docs/models/operations/downloadaccountingdirectcostattachmentrequest.md index bd0a6ab6c..271c4b7db 100644 --- a/lending/docs/models/operations/downloadaccountingdirectcostattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountingdirectcostattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingDirectCostAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# DownloadAccountingDirectCostAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `direct_cost_id` | *str* | :heavy_check_mark: | Unique identifier for a direct cost. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadaccountingdirectincomeattachmentrequest.md b/lending/docs/models/operations/downloadaccountingdirectincomeattachmentrequest.md index f8e6a0daa..37b614769 100644 --- a/lending/docs/models/operations/downloadaccountingdirectincomeattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountingdirectincomeattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingDirectIncomeAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# DownloadAccountingDirectIncomeAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `direct_income_id` | *str* | :heavy_check_mark: | Unique identifier for a direct income. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadaccountinginvoiceattachmentrequest.md b/lending/docs/models/operations/downloadaccountinginvoiceattachmentrequest.md index 179b54566..b52eb632b 100644 --- a/lending/docs/models/operations/downloadaccountinginvoiceattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountinginvoiceattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingInvoiceAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# DownloadAccountingInvoiceAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `invoice_id` | *str* | :heavy_check_mark: | Unique identifier for an invoice. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadaccountinginvoicepdfrequest.md b/lending/docs/models/operations/downloadaccountinginvoicepdfrequest.md index 4b5fbbf08..4ec1b02f2 100644 --- a/lending/docs/models/operations/downloadaccountinginvoicepdfrequest.md +++ b/lending/docs/models/operations/downloadaccountinginvoicepdfrequest.md @@ -1,9 +1,9 @@ -# DownloadAccountingInvoicePdfRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# DownloadAccountingInvoicePdfRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `invoice_id` | *str* | :heavy_check_mark: | Unique identifier for an invoice. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadaccountingsupplierattachmentrequest.md b/lending/docs/models/operations/downloadaccountingsupplierattachmentrequest.md index 0d032eed3..4341a0aa2 100644 --- a/lending/docs/models/operations/downloadaccountingsupplierattachmentrequest.md +++ b/lending/docs/models/operations/downloadaccountingsupplierattachmentrequest.md @@ -1,11 +1,11 @@ -# DownloadAccountingSupplierAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# DownloadAccountingSupplierAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadcategorizedbankstatementexcelrequest.md b/lending/docs/models/operations/downloadcategorizedbankstatementexcelrequest.md new file mode 100644 index 000000000..8f6286b07 --- /dev/null +++ b/lending/docs/models/operations/downloadcategorizedbankstatementexcelrequest.md @@ -0,0 +1,10 @@ +# DownloadCategorizedBankStatementExcelRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `max_age` | *Optional[str]* | :heavy_minus_sign: | The maximum age of report to fetch. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadcreditmodelexcelrequest.md b/lending/docs/models/operations/downloadcreditmodelexcelrequest.md new file mode 100644 index 000000000..24c4c6cc9 --- /dev/null +++ b/lending/docs/models/operations/downloadcreditmodelexcelrequest.md @@ -0,0 +1,10 @@ +# DownloadCreditModelExcelRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `max_age` | *Optional[str]* | :heavy_minus_sign: | The maximum age of report to fetch. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadexcelreportrequest.md b/lending/docs/models/operations/downloadexcelreportrequest.md index d7d7a831b..1bd136002 100644 --- a/lending/docs/models/operations/downloadexcelreportrequest.md +++ b/lending/docs/models/operations/downloadexcelreportrequest.md @@ -1,9 +1,9 @@ -# DownloadExcelReportRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# DownloadExcelReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `report_type` | [shared.ExcelReportTypes](../../models/shared/excelreporttypes.md) | :heavy_check_mark: | The type of report you want to generate and download. | | \ No newline at end of file diff --git a/lending/docs/models/operations/downloadfilesrequest.md b/lending/docs/models/operations/downloadfilesrequest.md index eca1e652e..b92649f1e 100644 --- a/lending/docs/models/operations/downloadfilesrequest.md +++ b/lending/docs/models/operations/downloadfilesrequest.md @@ -1,9 +1,9 @@ -# DownloadFilesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# DownloadFilesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `date_` | *Optional[str]* | :heavy_minus_sign: | Only download files uploaded on this date. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/operations/endbankstatementuploadsessionrequest.md b/lending/docs/models/operations/endbankstatementuploadsessionrequest.md index 9978dc2de..122f26500 100644 --- a/lending/docs/models/operations/endbankstatementuploadsessionrequest.md +++ b/lending/docs/models/operations/endbankstatementuploadsessionrequest.md @@ -1,11 +1,11 @@ -# EndBankStatementUploadSessionRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `end_upload_session_request` | [Optional[shared.EndUploadSessionRequest]](../../models/shared/enduploadsessionrequest.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 | -| `dataset_id` | *str* | :heavy_check_mark: | Unique identifier for the dataset that completed its sync. | | \ No newline at end of file +# EndBankStatementUploadSessionRequest + + +## 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 | +| `dataset_id` | *str* | :heavy_check_mark: | Unique identifier for the dataset that completed its sync. | | +| `end_upload_session_request` | [Optional[shared.EndUploadSessionRequest]](../../models/shared/enduploadsessionrequest.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/operations/generateexcelreportrequest.md b/lending/docs/models/operations/generateexcelreportrequest.md index ed38dba33..3f207e92a 100644 --- a/lending/docs/models/operations/generateexcelreportrequest.md +++ b/lending/docs/models/operations/generateexcelreportrequest.md @@ -1,9 +1,9 @@ -# GenerateExcelReportRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GenerateExcelReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `report_type` | [shared.ExcelReportTypes](../../models/shared/excelreporttypes.md) | :heavy_check_mark: | The type of report you want to generate and download. | | \ No newline at end of file diff --git a/lending/docs/models/operations/generateloansummaryrequest.md b/lending/docs/models/operations/generateloansummaryrequest.md index ba321529b..722b02e68 100644 --- a/lending/docs/models/operations/generateloansummaryrequest.md +++ b/lending/docs/models/operations/generateloansummaryrequest.md @@ -1,9 +1,9 @@ -# GenerateLoanSummaryRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `source_type` | [operations.SourceType](../../models/operations/sourcetype.md) | :heavy_check_mark: | Data source type. | | \ No newline at end of file +# GenerateLoanSummaryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `source_type` | *str* | :heavy_check_mark: | Data source type. | | \ No newline at end of file diff --git a/lending/docs/models/operations/generateloantransactionsrequest.md b/lending/docs/models/operations/generateloantransactionsrequest.md index c8c763ce3..70d2bfc04 100644 --- a/lending/docs/models/operations/generateloantransactionsrequest.md +++ b/lending/docs/models/operations/generateloantransactionsrequest.md @@ -1,9 +1,9 @@ -# GenerateLoanTransactionsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `source_type` | [operations.QueryParamSourceType](../../models/operations/queryparamsourcetype.md) | :heavy_check_mark: | Data source type. | | \ No newline at end of file +# GenerateLoanTransactionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `source_type` | *str* | :heavy_check_mark: | Data source type. | | \ No newline at end of file diff --git a/lending/docs/models/operations/generatereportrequest.md b/lending/docs/models/operations/generatereportrequest.md index 86fd314d6..773d1b65d 100644 --- a/lending/docs/models/operations/generatereportrequest.md +++ b/lending/docs/models/operations/generatereportrequest.md @@ -1,9 +1,9 @@ -# GenerateReportRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `report_type` | [shared.ReportType](../../models/shared/reporttype.md) | :heavy_check_mark: | The type of the report | | \ No newline at end of file +# GenerateReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `report_type` | *str* | :heavy_check_mark: | The type of the report | | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingaccountrequest.md b/lending/docs/models/operations/getaccountingaccountrequest.md index 809c5af8b..5a9b898d3 100644 --- a/lending/docs/models/operations/getaccountingaccountrequest.md +++ b/lending/docs/models/operations/getaccountingaccountrequest.md @@ -1,9 +1,9 @@ -# GetAccountingAccountRequest - - -## 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 | +# GetAccountingAccountRequest + + +## 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 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingaccounttransactionrequest.md b/lending/docs/models/operations/getaccountingaccounttransactionrequest.md index a6482cbc9..c26bb2d0e 100644 --- a/lending/docs/models/operations/getaccountingaccounttransactionrequest.md +++ b/lending/docs/models/operations/getaccountingaccounttransactionrequest.md @@ -1,10 +1,10 @@ -# GetAccountingAccountTransactionRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| `account_transaction_id` | *str* | :heavy_check_mark: | Unique identifier for an account transaction. | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingAccountTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `account_transaction_id` | *str* | :heavy_check_mark: | Unique identifier for an account transaction. | | +| `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/lending/docs/models/operations/getaccountingagedcreditorsreportrequest.md b/lending/docs/models/operations/getaccountingagedcreditorsreportrequest.md index dc89e57e0..c75b50771 100644 --- a/lending/docs/models/operations/getaccountingagedcreditorsreportrequest.md +++ b/lending/docs/models/operations/getaccountingagedcreditorsreportrequest.md @@ -1,11 +1,11 @@ -# GetAccountingAgedCreditorsReportRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | Number of periods to include in the report. | 12 | -| `period_length_days` | *Optional[int]* | :heavy_minus_sign: | The length of period in days. | 30 | -| `report_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_minus_sign: | Date the report is generated up to. | 2022-12-31 | \ No newline at end of file +# GetAccountingAgedCreditorsReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | Number of periods to include in the report. | 12 | +| `period_length_days` | *Optional[int]* | :heavy_minus_sign: | The length of period in days. | 30 | +| `report_date` | *Optional[date]* | :heavy_minus_sign: | Date the report is generated up to. | 2022-12-31 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingageddebtorsreportrequest.md b/lending/docs/models/operations/getaccountingageddebtorsreportrequest.md index 5170c763b..db1b4372e 100644 --- a/lending/docs/models/operations/getaccountingageddebtorsreportrequest.md +++ b/lending/docs/models/operations/getaccountingageddebtorsreportrequest.md @@ -1,11 +1,11 @@ -# GetAccountingAgedDebtorsReportRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | Number of periods to include in the report. | 12 | -| `period_length_days` | *Optional[int]* | :heavy_minus_sign: | The length of period in days. | 30 | -| `report_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_minus_sign: | Date the report is generated up to. | 2022-12-31 | \ No newline at end of file +# GetAccountingAgedDebtorsReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | Number of periods to include in the report. | 12 | +| `period_length_days` | *Optional[int]* | :heavy_minus_sign: | The length of period in days. | 30 | +| `report_date` | *Optional[date]* | :heavy_minus_sign: | Date the report is generated up to. | 2022-12-31 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingbalancesheetrequest.md b/lending/docs/models/operations/getaccountingbalancesheetrequest.md index 15d8aab80..6a0293615 100644 --- a/lending/docs/models/operations/getaccountingbalancesheetrequest.md +++ b/lending/docs/models/operations/getaccountingbalancesheetrequest.md @@ -1,11 +1,11 @@ -# GetAccountingBalanceSheetRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | -| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | +# GetAccountingBalanceSheetRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | +| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | | `start_month` | *Optional[str]* | :heavy_minus_sign: | The month the report starts from. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingbankaccountrequest.md b/lending/docs/models/operations/getaccountingbankaccountrequest.md index 5fff67ae9..82e525854 100644 --- a/lending/docs/models/operations/getaccountingbankaccountrequest.md +++ b/lending/docs/models/operations/getaccountingbankaccountrequest.md @@ -1,10 +1,10 @@ -# GetAccountingBankAccountRequest - - -## 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 | +# GetAccountingBankAccountRequest + + +## 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/lending/docs/models/operations/getaccountingbillattachmentrequest.md b/lending/docs/models/operations/getaccountingbillattachmentrequest.md index 39f335325..eb17412a5 100644 --- a/lending/docs/models/operations/getaccountingbillattachmentrequest.md +++ b/lending/docs/models/operations/getaccountingbillattachmentrequest.md @@ -1,11 +1,11 @@ -# GetAccountingBillAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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 | +# GetAccountingBillAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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/lending/docs/models/operations/getaccountingbillcreditnoterequest.md b/lending/docs/models/operations/getaccountingbillcreditnoterequest.md index 1c87eef81..82924e1bf 100644 --- a/lending/docs/models/operations/getaccountingbillcreditnoterequest.md +++ b/lending/docs/models/operations/getaccountingbillcreditnoterequest.md @@ -1,9 +1,9 @@ -# GetAccountingBillCreditNoteRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bill_credit_note_id` | *str* | :heavy_check_mark: | Unique identifier for a bill credit note. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +# GetAccountingBillCreditNoteRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bill_credit_note_id` | *str* | :heavy_check_mark: | Unique identifier for a bill credit note. | **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 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingbillpaymentrequest.md b/lending/docs/models/operations/getaccountingbillpaymentrequest.md index 236faa474..d624f3c0f 100644 --- a/lending/docs/models/operations/getaccountingbillpaymentrequest.md +++ b/lending/docs/models/operations/getaccountingbillpaymentrequest.md @@ -1,9 +1,9 @@ -# GetAccountingBillPaymentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bill_payment_id` | *str* | :heavy_check_mark: | Unique identifier for a bill payment. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +# GetAccountingBillPaymentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bill_payment_id` | *str* | :heavy_check_mark: | Unique identifier for a bill payment. | **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 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingbillrequest.md b/lending/docs/models/operations/getaccountingbillrequest.md index 66282364f..23fca341b 100644 --- a/lending/docs/models/operations/getaccountingbillrequest.md +++ b/lending/docs/models/operations/getaccountingbillrequest.md @@ -1,9 +1,9 @@ -# GetAccountingBillRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +# GetAccountingBillRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingcashflowstatementrequest.md b/lending/docs/models/operations/getaccountingcashflowstatementrequest.md index 66db61dfc..7b19bdd56 100644 --- a/lending/docs/models/operations/getaccountingcashflowstatementrequest.md +++ b/lending/docs/models/operations/getaccountingcashflowstatementrequest.md @@ -1,11 +1,11 @@ -# GetAccountingCashFlowStatementRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | -| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | +# GetAccountingCashFlowStatementRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | +| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | | `start_month` | *Optional[str]* | :heavy_minus_sign: | The month the report starts from. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingcreditnoterequest.md b/lending/docs/models/operations/getaccountingcreditnoterequest.md index ff927e6f1..6cd6c4343 100644 --- a/lending/docs/models/operations/getaccountingcreditnoterequest.md +++ b/lending/docs/models/operations/getaccountingcreditnoterequest.md @@ -1,9 +1,9 @@ -# GetAccountingCreditNoteRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingCreditNoteRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `credit_note_id` | *str* | :heavy_check_mark: | Unique identifier for a credit note. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingcustomerattachmentrequest.md b/lending/docs/models/operations/getaccountingcustomerattachmentrequest.md index 46ebff18b..64b7a63b1 100644 --- a/lending/docs/models/operations/getaccountingcustomerattachmentrequest.md +++ b/lending/docs/models/operations/getaccountingcustomerattachmentrequest.md @@ -1,11 +1,11 @@ -# GetAccountingCustomerAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# GetAccountingCustomerAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `customer_id` | *str* | :heavy_check_mark: | Unique identifier for a customer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingcustomerrequest.md b/lending/docs/models/operations/getaccountingcustomerrequest.md index e49768cb6..895551ed1 100644 --- a/lending/docs/models/operations/getaccountingcustomerrequest.md +++ b/lending/docs/models/operations/getaccountingcustomerrequest.md @@ -1,9 +1,9 @@ -# GetAccountingCustomerRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingCustomerRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `customer_id` | *str* | :heavy_check_mark: | Unique identifier for a customer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingdirectcostattachmentrequest.md b/lending/docs/models/operations/getaccountingdirectcostattachmentrequest.md index de539044c..d8bead50d 100644 --- a/lending/docs/models/operations/getaccountingdirectcostattachmentrequest.md +++ b/lending/docs/models/operations/getaccountingdirectcostattachmentrequest.md @@ -1,11 +1,11 @@ -# GetAccountingDirectCostAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# GetAccountingDirectCostAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `direct_cost_id` | *str* | :heavy_check_mark: | Unique identifier for a direct cost. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingdirectcostrequest.md b/lending/docs/models/operations/getaccountingdirectcostrequest.md index 9fcb40b06..c7111a5aa 100644 --- a/lending/docs/models/operations/getaccountingdirectcostrequest.md +++ b/lending/docs/models/operations/getaccountingdirectcostrequest.md @@ -1,10 +1,10 @@ -# GetAccountingDirectCostRequest - - -## 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 | +# GetAccountingDirectCostRequest + + +## 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 | | `direct_cost_id` | *str* | :heavy_check_mark: | Unique identifier for a direct cost. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingdirectincomeattachmentrequest.md b/lending/docs/models/operations/getaccountingdirectincomeattachmentrequest.md index f4fa7a3dc..3a2be9e5d 100644 --- a/lending/docs/models/operations/getaccountingdirectincomeattachmentrequest.md +++ b/lending/docs/models/operations/getaccountingdirectincomeattachmentrequest.md @@ -1,12 +1,12 @@ -# GetAccountingDirectIncomeAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | -| `direct_income_id` | *str* | :heavy_check_mark: | Unique identifier for a direct income. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +# GetAccountingDirectIncomeAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | +| `direct_income_id` | *str* | :heavy_check_mark: | Unique identifier for a direct income. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | | `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/lending/docs/models/operations/getaccountingdirectincomerequest.md b/lending/docs/models/operations/getaccountingdirectincomerequest.md index 4d53893db..bebf40049 100644 --- a/lending/docs/models/operations/getaccountingdirectincomerequest.md +++ b/lending/docs/models/operations/getaccountingdirectincomerequest.md @@ -1,10 +1,10 @@ -# GetAccountingDirectIncomeRequest - - -## 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 | +# GetAccountingDirectIncomeRequest + + +## 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 | | `direct_income_id` | *str* | :heavy_check_mark: | Unique identifier for a direct income. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountinginvoiceattachmentrequest.md b/lending/docs/models/operations/getaccountinginvoiceattachmentrequest.md index 4f78ccbab..6e4d1db7b 100644 --- a/lending/docs/models/operations/getaccountinginvoiceattachmentrequest.md +++ b/lending/docs/models/operations/getaccountinginvoiceattachmentrequest.md @@ -1,11 +1,11 @@ -# GetAccountingInvoiceAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# GetAccountingInvoiceAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `invoice_id` | *str* | :heavy_check_mark: | Unique identifier for an invoice. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountinginvoicerequest.md b/lending/docs/models/operations/getaccountinginvoicerequest.md index 22f985e97..b36b4d267 100644 --- a/lending/docs/models/operations/getaccountinginvoicerequest.md +++ b/lending/docs/models/operations/getaccountinginvoicerequest.md @@ -1,9 +1,9 @@ -# GetAccountingInvoiceRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingInvoiceRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `invoice_id` | *str* | :heavy_check_mark: | Unique identifier for an invoice. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingjournalentryrequest.md b/lending/docs/models/operations/getaccountingjournalentryrequest.md index 2428267ab..2fc2cfda7 100644 --- a/lending/docs/models/operations/getaccountingjournalentryrequest.md +++ b/lending/docs/models/operations/getaccountingjournalentryrequest.md @@ -1,9 +1,9 @@ -# GetAccountingJournalEntryRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingJournalEntryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `journal_entry_id` | *str* | :heavy_check_mark: | Unique identifier for a journal entry. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingjournalrequest.md b/lending/docs/models/operations/getaccountingjournalrequest.md index 1561926a1..40be23473 100644 --- a/lending/docs/models/operations/getaccountingjournalrequest.md +++ b/lending/docs/models/operations/getaccountingjournalrequest.md @@ -1,9 +1,9 @@ -# GetAccountingJournalRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingJournalRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `journal_id` | *str* | :heavy_check_mark: | Unique identifier for a journal. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingpaymentrequest.md b/lending/docs/models/operations/getaccountingpaymentrequest.md index e28f10f93..82c5bb545 100644 --- a/lending/docs/models/operations/getaccountingpaymentrequest.md +++ b/lending/docs/models/operations/getaccountingpaymentrequest.md @@ -1,9 +1,9 @@ -# GetAccountingPaymentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingPaymentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `payment_id` | *str* | :heavy_check_mark: | Unique identifier for a payment. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingprofilerequest.md b/lending/docs/models/operations/getaccountingprofilerequest.md index 00f7adceb..8c1c8e5d4 100644 --- a/lending/docs/models/operations/getaccountingprofilerequest.md +++ b/lending/docs/models/operations/getaccountingprofilerequest.md @@ -1,8 +1,8 @@ -# GetAccountingProfileRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# GetAccountingProfileRequest + + +## 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/lending/docs/models/operations/getaccountingprofitandlossrequest.md b/lending/docs/models/operations/getaccountingprofitandlossrequest.md index c3435f36c..c85781ab9 100644 --- a/lending/docs/models/operations/getaccountingprofitandlossrequest.md +++ b/lending/docs/models/operations/getaccountingprofitandlossrequest.md @@ -1,11 +1,11 @@ -# GetAccountingProfitAndLossRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | -| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | +# GetAccountingProfitAndLossRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `period_length` | *int* | :heavy_check_mark: | Number of months defining the period of interest. | 4 | +| `periods_to_compare` | *int* | :heavy_check_mark: | Number of periods with `periodLength` to compare. | 20 | | `start_month` | *Optional[str]* | :heavy_minus_sign: | The month the report starts from. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingsupplierattachmentrequest.md b/lending/docs/models/operations/getaccountingsupplierattachmentrequest.md index af146279f..9a0658747 100644 --- a/lending/docs/models/operations/getaccountingsupplierattachmentrequest.md +++ b/lending/docs/models/operations/getaccountingsupplierattachmentrequest.md @@ -1,11 +1,11 @@ -# GetAccountingSupplierAttachmentRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `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 | +# GetAccountingSupplierAttachmentRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `attachment_id` | *str* | :heavy_check_mark: | Unique identifier for an attachment. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `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 | | `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingsupplierrequest.md b/lending/docs/models/operations/getaccountingsupplierrequest.md index 4e678c9eb..0b9e21abf 100644 --- a/lending/docs/models/operations/getaccountingsupplierrequest.md +++ b/lending/docs/models/operations/getaccountingsupplierrequest.md @@ -1,9 +1,9 @@ -# GetAccountingSupplierRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetAccountingSupplierRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getaccountingtransferrequest.md b/lending/docs/models/operations/getaccountingtransferrequest.md index 968cd9eeb..87ba11054 100644 --- a/lending/docs/models/operations/getaccountingtransferrequest.md +++ b/lending/docs/models/operations/getaccountingtransferrequest.md @@ -1,10 +1,10 @@ -# GetAccountingTransferRequest - - -## 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 | +# GetAccountingTransferRequest + + +## 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 | | `transfer_id` | *str* | :heavy_check_mark: | Unique identifier for a transfer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getbankaccountmappingrequest.md b/lending/docs/models/operations/getbankaccountmappingrequest.md index 236504a59..929c4fca4 100644 --- a/lending/docs/models/operations/getbankaccountmappingrequest.md +++ b/lending/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/lending/docs/models/operations/getbankingaccountrequest.md b/lending/docs/models/operations/getbankingaccountrequest.md index a23402218..ed2d8adb9 100644 --- a/lending/docs/models/operations/getbankingaccountrequest.md +++ b/lending/docs/models/operations/getbankingaccountrequest.md @@ -1,10 +1,10 @@ -# GetBankingAccountRequest - - -## 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 | +# GetBankingAccountRequest + + +## 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/lending/docs/models/operations/getbankingtransactioncategoryrequest.md b/lending/docs/models/operations/getbankingtransactioncategoryrequest.md index 80b2b1207..d4adc1153 100644 --- a/lending/docs/models/operations/getbankingtransactioncategoryrequest.md +++ b/lending/docs/models/operations/getbankingtransactioncategoryrequest.md @@ -1,10 +1,10 @@ -# GetBankingTransactionCategoryRequest - - -## 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 | +# GetBankingTransactionCategoryRequest + + +## 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 | | `transaction_category_id` | *str* | :heavy_check_mark: | The unique identifier for a banking transaction category | | \ No newline at end of file diff --git a/lending/docs/models/operations/getbankingtransactionrequest.md b/lending/docs/models/operations/getbankingtransactionrequest.md index 76bdedc4c..aa3d945b4 100644 --- a/lending/docs/models/operations/getbankingtransactionrequest.md +++ b/lending/docs/models/operations/getbankingtransactionrequest.md @@ -1,10 +1,10 @@ -# GetBankingTransactionRequest - - -## 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 | +# GetBankingTransactionRequest + + +## 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 | | `transaction_id` | *str* | :heavy_check_mark: | The unique identifier for a transaction | | \ No newline at end of file diff --git a/lending/docs/models/operations/getbankstatementuploadconfigurationrequest.md b/lending/docs/models/operations/getbankstatementuploadconfigurationrequest.md index 9dd2c276b..955c5b995 100644 --- a/lending/docs/models/operations/getbankstatementuploadconfigurationrequest.md +++ b/lending/docs/models/operations/getbankstatementuploadconfigurationrequest.md @@ -1,9 +1,9 @@ -# GetBankStatementUploadConfigurationRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetBankStatementUploadConfigurationRequest + + +## 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/lending/docs/models/operations/getcategorizedbalancesheetstatementrequest.md b/lending/docs/models/operations/getcategorizedbalancesheetstatementrequest.md index a655adbb1..3315f8619 100644 --- a/lending/docs/models/operations/getcategorizedbalancesheetstatementrequest.md +++ b/lending/docs/models/operations/getcategorizedbalancesheetstatementrequest.md @@ -1,10 +1,10 @@ -# GetCategorizedBalanceSheetStatementRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | The number of periods to return. If not provided, 12 periods will be used as the default value. | | +# GetCategorizedBalanceSheetStatementRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | The number of periods to return. If not provided, 12 periods will be used as the default value. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcategorizedbankstatementrequest.md b/lending/docs/models/operations/getcategorizedbankstatementrequest.md index 242dc1c0f..1a35f315f 100644 --- a/lending/docs/models/operations/getcategorizedbankstatementrequest.md +++ b/lending/docs/models/operations/getcategorizedbankstatementrequest.md @@ -1,11 +1,11 @@ -# GetCategorizedBankStatementRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | -| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | +# GetCategorizedBankStatementRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | | `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/lending/docs/models/operations/getcategorizedbankstatementtransactionsrequest.md b/lending/docs/models/operations/getcategorizedbankstatementtransactionsrequest.md new file mode 100644 index 000000000..fb1d1351b --- /dev/null +++ b/lending/docs/models/operations/getcategorizedbankstatementtransactionsrequest.md @@ -0,0 +1,14 @@ +# GetCategorizedBankStatementTransactionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `max_age` | *Optional[str]* | :heavy_minus_sign: | The maximum age of report to fetch. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getcategorizedprofitandlossstatementrequest.md b/lending/docs/models/operations/getcategorizedprofitandlossstatementrequest.md index af6bb51be..51075b2f1 100644 --- a/lending/docs/models/operations/getcategorizedprofitandlossstatementrequest.md +++ b/lending/docs/models/operations/getcategorizedprofitandlossstatementrequest.md @@ -1,10 +1,10 @@ -# GetCategorizedProfitAndLossStatementRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | The number of periods to return. If not provided, 12 periods will be used as the default value. | | +# GetCategorizedProfitAndLossStatementRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `number_of_periods` | *Optional[int]* | :heavy_minus_sign: | The number of periods to return. If not provided, 12 periods will be used as the default value. | | | `report_date` | *Optional[str]* | :heavy_minus_sign: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercecustomerrequest.md b/lending/docs/models/operations/getcommercecustomerrequest.md index 7b277287b..8ac975ae8 100644 --- a/lending/docs/models/operations/getcommercecustomerrequest.md +++ b/lending/docs/models/operations/getcommercecustomerrequest.md @@ -1,10 +1,10 @@ -# GetCommerceCustomerRequest - - -## 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 | +# GetCommerceCustomerRequest + + +## 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 | | `customer_id` | *str* | :heavy_check_mark: | Unique identifier for a customer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercecustomerretentionmetricsrequest.md b/lending/docs/models/operations/getcommercecustomerretentionmetricsrequest.md index af30fa0c5..1aa042c35 100644 --- a/lending/docs/models/operations/getcommercecustomerretentionmetricsrequest.md +++ b/lending/docs/models/operations/getcommercecustomerretentionmetricsrequest.md @@ -1,14 +1,14 @@ -# GetCommerceCustomerRetentionMetricsRequest - - -## 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 | -| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | -| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | -| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | -| `period_unit` | [shared.PeriodUnit](../../models/shared/periodunit.md) | :heavy_check_mark: | The period unit of time returned. | | +# GetCommerceCustomerRetentionMetricsRequest + + +## 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 | +| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | +| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | +| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | +| `period_unit` | *str* | :heavy_check_mark: | The period unit of time returned. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercedisputerequest.md b/lending/docs/models/operations/getcommercedisputerequest.md index 100547da2..c22722399 100644 --- a/lending/docs/models/operations/getcommercedisputerequest.md +++ b/lending/docs/models/operations/getcommercedisputerequest.md @@ -1,10 +1,10 @@ -# GetCommerceDisputeRequest - - -## 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 | +# GetCommerceDisputeRequest + + +## 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 | | `dispute_id` | *str* | :heavy_check_mark: | Unique identifier for a dispute. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercelifetimevaluemetricsrequest.md b/lending/docs/models/operations/getcommercelifetimevaluemetricsrequest.md index 0872d8bc9..251514bdf 100644 --- a/lending/docs/models/operations/getcommercelifetimevaluemetricsrequest.md +++ b/lending/docs/models/operations/getcommercelifetimevaluemetricsrequest.md @@ -1,14 +1,14 @@ -# GetCommerceLifetimeValueMetricsRequest - - -## 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 | -| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | -| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | -| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | -| `period_unit` | [shared.PeriodUnit](../../models/shared/periodunit.md) | :heavy_check_mark: | The period unit of time returned. | | +# GetCommerceLifetimeValueMetricsRequest + + +## 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 | +| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | +| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | +| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | +| `period_unit` | *str* | :heavy_check_mark: | The period unit of time returned. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercelocationrequest.md b/lending/docs/models/operations/getcommercelocationrequest.md index fcb74989a..9bba3626b 100644 --- a/lending/docs/models/operations/getcommercelocationrequest.md +++ b/lending/docs/models/operations/getcommercelocationrequest.md @@ -1,10 +1,10 @@ -# GetCommerceLocationRequest - - -## 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 | +# GetCommerceLocationRequest + + +## 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 | | `location_id` | *str* | :heavy_check_mark: | Unique identifier for a location. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommerceorderrequest.md b/lending/docs/models/operations/getcommerceorderrequest.md index 119d774bf..3e740467d 100644 --- a/lending/docs/models/operations/getcommerceorderrequest.md +++ b/lending/docs/models/operations/getcommerceorderrequest.md @@ -1,10 +1,10 @@ -# GetCommerceOrderRequest - - -## 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 | +# GetCommerceOrderRequest + + +## 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_id` | *str* | :heavy_check_mark: | Unique identifier for an order. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommerceordersreportrequest.md b/lending/docs/models/operations/getcommerceordersreportrequest.md index 4ddaae582..8fb1cb258 100644 --- a/lending/docs/models/operations/getcommerceordersreportrequest.md +++ b/lending/docs/models/operations/getcommerceordersreportrequest.md @@ -1,14 +1,14 @@ -# GetCommerceOrdersReportRequest - - -## 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 | -| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | -| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | -| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | -| `period_unit` | [shared.PeriodUnit](../../models/shared/periodunit.md) | :heavy_check_mark: | The period unit of time returned. | | +# GetCommerceOrdersReportRequest + + +## 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 | +| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | +| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | +| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | +| `period_unit` | *str* | :heavy_check_mark: | The period unit of time returned. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercepaymentmethodrequest.md b/lending/docs/models/operations/getcommercepaymentmethodrequest.md index 40a7450c6..9bb12f26b 100644 --- a/lending/docs/models/operations/getcommercepaymentmethodrequest.md +++ b/lending/docs/models/operations/getcommercepaymentmethodrequest.md @@ -1,10 +1,10 @@ -# GetCommercePaymentMethodRequest - - -## 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 | +# GetCommercePaymentMethodRequest + + +## 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 | | `payment_method_id` | *str* | :heavy_check_mark: | Unique identifier for a payment method. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercepaymentrequest.md b/lending/docs/models/operations/getcommercepaymentrequest.md index 55a155292..0b50b5ff9 100644 --- a/lending/docs/models/operations/getcommercepaymentrequest.md +++ b/lending/docs/models/operations/getcommercepaymentrequest.md @@ -1,10 +1,10 @@ -# GetCommercePaymentRequest - - -## 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 | +# GetCommercePaymentRequest + + +## 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 | | `payment_id` | *str* | :heavy_check_mark: | Unique identifier for a payment. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommerceproductcategoryrequest.md b/lending/docs/models/operations/getcommerceproductcategoryrequest.md index 713bfbbdc..dc7b3182b 100644 --- a/lending/docs/models/operations/getcommerceproductcategoryrequest.md +++ b/lending/docs/models/operations/getcommerceproductcategoryrequest.md @@ -1,10 +1,10 @@ -# GetCommerceProductCategoryRequest - - -## 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 | +# GetCommerceProductCategoryRequest + + +## 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 | | `product_id` | *str* | :heavy_check_mark: | Unique identifier for a product. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommerceproductrequest.md b/lending/docs/models/operations/getcommerceproductrequest.md index ad7fdfc78..c119ec8f2 100644 --- a/lending/docs/models/operations/getcommerceproductrequest.md +++ b/lending/docs/models/operations/getcommerceproductrequest.md @@ -1,10 +1,10 @@ -# GetCommerceProductRequest - - -## 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 | +# GetCommerceProductRequest + + +## 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 | | `product_id` | *str* | :heavy_check_mark: | Unique identifier for a product. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommerceprofilerequest.md b/lending/docs/models/operations/getcommerceprofilerequest.md index a37ccd8c8..9d9fc46c0 100644 --- a/lending/docs/models/operations/getcommerceprofilerequest.md +++ b/lending/docs/models/operations/getcommerceprofilerequest.md @@ -1,9 +1,9 @@ -# GetCommerceProfileRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCommerceProfileRequest + + +## 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/lending/docs/models/operations/getcommercerefundsreportrequest.md b/lending/docs/models/operations/getcommercerefundsreportrequest.md index f98116a0f..986a5918f 100644 --- a/lending/docs/models/operations/getcommercerefundsreportrequest.md +++ b/lending/docs/models/operations/getcommercerefundsreportrequest.md @@ -1,14 +1,14 @@ -# GetCommerceRefundsReportRequest - - -## 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 | -| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | -| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | -| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | -| `period_unit` | [shared.PeriodUnit](../../models/shared/periodunit.md) | :heavy_check_mark: | The period unit of time returned. | | +# GetCommerceRefundsReportRequest + + +## 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 | +| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | +| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | +| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | +| `period_unit` | *str* | :heavy_check_mark: | The period unit of time returned. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercerevenuemetricsrequest.md b/lending/docs/models/operations/getcommercerevenuemetricsrequest.md index 44c5f5d67..261aa7bb0 100644 --- a/lending/docs/models/operations/getcommercerevenuemetricsrequest.md +++ b/lending/docs/models/operations/getcommercerevenuemetricsrequest.md @@ -1,14 +1,14 @@ -# GetCommerceRevenueMetricsRequest - - -## 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 | -| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | -| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | -| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | -| `period_unit` | [shared.PeriodUnit](../../models/shared/periodunit.md) | :heavy_check_mark: | The period unit of time returned. | | +# GetCommerceRevenueMetricsRequest + + +## 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 | +| `include_display_names` | *Optional[bool]* | :heavy_minus_sign: | Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable. | | +| `number_of_periods` | *int* | :heavy_check_mark: | The number of periods to return. There will be no pagination as a query parameter. | | +| `period_length` | *int* | :heavy_check_mark: | The number of months per period. E.g. 2 = 2 months per period. | | +| `period_unit` | *str* | :heavy_check_mark: | The period unit of time returned. | | | `report_date` | *str* | :heavy_check_mark: | The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month. | 29-09-2020 | \ No newline at end of file diff --git a/lending/docs/models/operations/getcommercetransactionrequest.md b/lending/docs/models/operations/getcommercetransactionrequest.md index ee709ebac..5557c21d8 100644 --- a/lending/docs/models/operations/getcommercetransactionrequest.md +++ b/lending/docs/models/operations/getcommercetransactionrequest.md @@ -1,10 +1,10 @@ -# GetCommerceTransactionRequest - - -## 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 | +# GetCommerceTransactionRequest + + +## 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 | | `transaction_id` | *str* | :heavy_check_mark: | Unique identifier for a transaction. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/getcompanyrequest.md b/lending/docs/models/operations/getcompanyrequest.md index 240b811b6..295378c0b 100644 --- a/lending/docs/models/operations/getcompanyrequest.md +++ b/lending/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/lending/docs/models/operations/getconnectionrequest.md b/lending/docs/models/operations/getconnectionrequest.md index 6e9f3d18b..61c906783 100644 --- a/lending/docs/models/operations/getconnectionrequest.md +++ b/lending/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/lending/docs/models/operations/getcreatebanktransactionsmodelrequest.md b/lending/docs/models/operations/getcreatebanktransactionsmodelrequest.md index d6c379573..5e482bcd8 100644 --- a/lending/docs/models/operations/getcreatebanktransactionsmodelrequest.md +++ b/lending/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/lending/docs/models/operations/getcreatechartofaccountsmodelrequest.md b/lending/docs/models/operations/getcreatechartofaccountsmodelrequest.md index 11af40316..132aa3d9f 100644 --- a/lending/docs/models/operations/getcreatechartofaccountsmodelrequest.md +++ b/lending/docs/models/operations/getcreatechartofaccountsmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateChartOfAccountsModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateChartOfAccountsModelRequest + + +## 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/lending/docs/models/operations/getcreatedirectcostsmodelrequest.md b/lending/docs/models/operations/getcreatedirectcostsmodelrequest.md index 3815b4c7d..063cc6797 100644 --- a/lending/docs/models/operations/getcreatedirectcostsmodelrequest.md +++ b/lending/docs/models/operations/getcreatedirectcostsmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateDirectCostsModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateDirectCostsModelRequest + + +## 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/lending/docs/models/operations/getcreateoperationrequest.md b/lending/docs/models/operations/getcreateoperationrequest.md index a59c377d8..dd9ec6383 100644 --- a/lending/docs/models/operations/getcreateoperationrequest.md +++ b/lending/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: | Unique identifier for the push operation. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getcreatepaymentmodelrequest.md b/lending/docs/models/operations/getcreatepaymentmodelrequest.md index 9ac7fb857..5b993382f 100644 --- a/lending/docs/models/operations/getcreatepaymentmodelrequest.md +++ b/lending/docs/models/operations/getcreatepaymentmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreatePaymentModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreatePaymentModelRequest + + +## 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/lending/docs/models/operations/getcreatetransfersmodelrequest.md b/lending/docs/models/operations/getcreatetransfersmodelrequest.md index 4a3d73915..53c9d42d5 100644 --- a/lending/docs/models/operations/getcreatetransfersmodelrequest.md +++ b/lending/docs/models/operations/getcreatetransfersmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateTransfersModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateTransfersModelRequest + + +## 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/lending/docs/models/operations/getcreateupdatebankaccountsmodelrequest.md b/lending/docs/models/operations/getcreateupdatebankaccountsmodelrequest.md index 0e8ab966f..800115e1b 100644 --- a/lending/docs/models/operations/getcreateupdatebankaccountsmodelrequest.md +++ b/lending/docs/models/operations/getcreateupdatebankaccountsmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateUpdateBankAccountsModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateUpdateBankAccountsModelRequest + + +## 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/lending/docs/models/operations/getcreateupdatesuppliersmodelrequest.md b/lending/docs/models/operations/getcreateupdatesuppliersmodelrequest.md index 85ca250bd..556af072a 100644 --- a/lending/docs/models/operations/getcreateupdatesuppliersmodelrequest.md +++ b/lending/docs/models/operations/getcreateupdatesuppliersmodelrequest.md @@ -1,9 +1,9 @@ -# GetCreateUpdateSuppliersModelRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetCreateUpdateSuppliersModelRequest + + +## 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/lending/docs/models/operations/getdataintegritystatusrequest.md b/lending/docs/models/operations/getdataintegritystatusrequest.md index 5946caef7..ecaae1970 100644 --- a/lending/docs/models/operations/getdataintegritystatusrequest.md +++ b/lending/docs/models/operations/getdataintegritystatusrequest.md @@ -1,9 +1,9 @@ -# GetDataIntegrityStatusRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `data_type` | [shared.DataIntegrityDataType](../../models/shared/dataintegritydatatype.md) | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | \ No newline at end of file +# GetDataIntegrityStatusRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `data_type` | *str* | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | \ No newline at end of file diff --git a/lending/docs/models/operations/getdataintegritysummariesrequest.md b/lending/docs/models/operations/getdataintegritysummariesrequest.md index 7735c68b7..21b744a46 100644 --- a/lending/docs/models/operations/getdataintegritysummariesrequest.md +++ b/lending/docs/models/operations/getdataintegritysummariesrequest.md @@ -1,10 +1,10 @@ -# GetDataIntegritySummariesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `data_type` | [shared.DataIntegrityDataType](../../models/shared/dataintegritydatatype.md) | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | +# GetDataIntegritySummariesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `data_type` | *str* | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | | `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/lending/docs/models/operations/getdatastatusdatastatuses.md b/lending/docs/models/operations/getdatastatusdatastatuses.md index f3e954e3c..7e93388de 100644 --- a/lending/docs/models/operations/getdatastatusdatastatuses.md +++ b/lending/docs/models/operations/getdatastatusdatastatuses.md @@ -1,52 +1,7 @@ -# GetDataStatusDataStatuses - -OK - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `balance_sheet` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `bank_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `bank_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `banking_account_balances` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `banking_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `banking_transaction_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `banking_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `bill_credit_notes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `bill_payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `bills` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `cash_flow_statement` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `chart_of_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_company_info` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_customers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_disputes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_locations` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_payment_methods` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_product_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_products` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_tax_components` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `commerce_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `company` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `credit_notes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `customers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `direct_costs` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `direct_incomes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `invoices` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `item_receipts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `items` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `journal_entries` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `journals` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `payment_methods` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `profit_and_loss` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `purchase_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `sales_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `suppliers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `tax_rates` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `tracking_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | -| `transfers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | \ No newline at end of file +# GetDataStatusDataStatuses + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/lending/docs/models/operations/getdatastatusrequest.md b/lending/docs/models/operations/getdatastatusrequest.md index 12c2e50b6..1dac483db 100644 --- a/lending/docs/models/operations/getdatastatusrequest.md +++ b/lending/docs/models/operations/getdatastatusrequest.md @@ -1,8 +1,8 @@ -# GetDataStatusRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# GetDataStatusRequest + + +## 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/lending/docs/models/operations/getexcelreportgenerationstatusrequest.md b/lending/docs/models/operations/getexcelreportgenerationstatusrequest.md index 42752ea85..47b548a1d 100644 --- a/lending/docs/models/operations/getexcelreportgenerationstatusrequest.md +++ b/lending/docs/models/operations/getexcelreportgenerationstatusrequest.md @@ -1,9 +1,9 @@ -# GetExcelReportGenerationStatusRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetExcelReportGenerationStatusRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `report_type` | [shared.ExcelReportTypes](../../models/shared/excelreporttypes.md) | :heavy_check_mark: | The type of report you want to generate and download. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getfinancialsummaryrequest.md b/lending/docs/models/operations/getfinancialsummaryrequest.md new file mode 100644 index 000000000..b4f0f1906 --- /dev/null +++ b/lending/docs/models/operations/getfinancialsummaryrequest.md @@ -0,0 +1,9 @@ +# GetFinancialSummaryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getloansummaryqueryparamsourcetype.md b/lending/docs/models/operations/getloansummaryqueryparamsourcetype.md index 1a96dccd7..f19534f8d 100644 --- a/lending/docs/models/operations/getloansummaryqueryparamsourcetype.md +++ b/lending/docs/models/operations/getloansummaryqueryparamsourcetype.md @@ -1,20 +1,18 @@ -# GetLoanSummaryQueryParamSourceType - -Data source type. - -## Example Usage - -```python -from codat_lending.models.operations import GetLoanSummaryQueryParamSourceType - -value = GetLoanSummaryQueryParamSourceType.BANKING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `BANKING` | banking | -| `COMMERCE` | commerce | +# GetLoanSummaryQueryParamSourceType + +## Example Usage + +```python +from codat_lending.models.operations import GetLoanSummaryQueryParamSourceType + +value = GetLoanSummaryQueryParamSourceType.BANKING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `BANKING` | banking | +| `COMMERCE` | commerce | | `ACCOUNTING` | accounting | \ No newline at end of file diff --git a/lending/docs/models/operations/getloansummaryrequest.md b/lending/docs/models/operations/getloansummaryrequest.md index b2624e65c..c8f071cca 100644 --- a/lending/docs/models/operations/getloansummaryrequest.md +++ b/lending/docs/models/operations/getloansummaryrequest.md @@ -1,9 +1,9 @@ -# GetLoanSummaryRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `source_type` | [operations.GetLoanSummaryQueryParamSourceType](../../models/operations/getloansummaryqueryparamsourcetype.md) | :heavy_check_mark: | Data source type. | | \ No newline at end of file +# GetLoanSummaryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `source_type` | *str* | :heavy_check_mark: | Data source type. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getpulloperationrequest.md b/lending/docs/models/operations/getpulloperationrequest.md index d2382bd6c..5bd36aa3e 100644 --- a/lending/docs/models/operations/getpulloperationrequest.md +++ b/lending/docs/models/operations/getpulloperationrequest.md @@ -1,9 +1,9 @@ -# GetPullOperationRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# GetPullOperationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `dataset_id` | *str* | :heavy_check_mark: | Unique identifier for the dataset that completed its sync. | | \ No newline at end of file diff --git a/lending/docs/models/operations/getreportstatusrequest.md b/lending/docs/models/operations/getreportstatusrequest.md new file mode 100644 index 000000000..d7b8d57ec --- /dev/null +++ b/lending/docs/models/operations/getreportstatusrequest.md @@ -0,0 +1,11 @@ +# GetReportStatusRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `max_age` | *Optional[str]* | :heavy_minus_sign: | The maximum age of report to fetch. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | +| `report_type` | *str* | :heavy_check_mark: | The type of the report | | \ No newline at end of file diff --git a/lending/docs/models/operations/isagedcreditorsreportavailablerequest.md b/lending/docs/models/operations/isagedcreditorsreportavailablerequest.md index b91effb0f..6247a8bfa 100644 --- a/lending/docs/models/operations/isagedcreditorsreportavailablerequest.md +++ b/lending/docs/models/operations/isagedcreditorsreportavailablerequest.md @@ -1,8 +1,8 @@ -# IsAgedCreditorsReportAvailableRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# IsAgedCreditorsReportAvailableRequest + + +## 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/lending/docs/models/operations/isageddebtorsreportavailablerequest.md b/lending/docs/models/operations/isageddebtorsreportavailablerequest.md index 6113466ca..19dd34d9d 100644 --- a/lending/docs/models/operations/isageddebtorsreportavailablerequest.md +++ b/lending/docs/models/operations/isageddebtorsreportavailablerequest.md @@ -1,8 +1,8 @@ -# IsAgedDebtorsReportAvailableRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# IsAgedDebtorsReportAvailableRequest + + +## 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/lending/docs/models/operations/listaccountingaccountsrequest.md b/lending/docs/models/operations/listaccountingaccountsrequest.md index 1e1c7a334..fbf1646a1 100644 --- a/lending/docs/models/operations/listaccountingaccountsrequest.md +++ b/lending/docs/models/operations/listaccountingaccountsrequest.md @@ -1,12 +1,12 @@ -# ListAccountingAccountsRequest - - -## 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 | +# ListAccountingAccountsRequest + + +## 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/lending/docs/models/operations/listaccountingaccounttransactionsrequest.md b/lending/docs/models/operations/listaccountingaccounttransactionsrequest.md index 8fdb443cf..3516a31ec 100644 --- a/lending/docs/models/operations/listaccountingaccounttransactionsrequest.md +++ b/lending/docs/models/operations/listaccountingaccounttransactionsrequest.md @@ -1,13 +1,13 @@ -# ListAccountingAccountTransactionsRequest - - -## 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 | +# ListAccountingAccountTransactionsRequest + + +## 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/lending/docs/models/operations/listaccountingbankaccountsrequest.md b/lending/docs/models/operations/listaccountingbankaccountsrequest.md index 2a7bbc080..fad99ca78 100644 --- a/lending/docs/models/operations/listaccountingbankaccountsrequest.md +++ b/lending/docs/models/operations/listaccountingbankaccountsrequest.md @@ -1,13 +1,13 @@ -# ListAccountingBankAccountsRequest - - -## 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 | +# ListAccountingBankAccountsRequest + + +## 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/lending/docs/models/operations/listaccountingbankaccounttransactionsrequest.md b/lending/docs/models/operations/listaccountingbankaccounttransactionsrequest.md index 2840eb6ea..92c609c36 100644 --- a/lending/docs/models/operations/listaccountingbankaccounttransactionsrequest.md +++ b/lending/docs/models/operations/listaccountingbankaccounttransactionsrequest.md @@ -1,14 +1,14 @@ -# ListAccountingBankAccountTransactionsRequest - - -## 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 | -| `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 | +# ListAccountingBankAccountTransactionsRequest + + +## 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 | +| `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/lending/docs/models/operations/listaccountingbillattachmentsrequest.md b/lending/docs/models/operations/listaccountingbillattachmentsrequest.md index 24066b7f8..a6e518ea0 100644 --- a/lending/docs/models/operations/listaccountingbillattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountingbillattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingBillAttachmentsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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 | +# ListAccountingBillAttachmentsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bill_id` | *str* | :heavy_check_mark: | Unique identifier for a bill. | **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/lending/docs/models/operations/listaccountingbillcreditnotesrequest.md b/lending/docs/models/operations/listaccountingbillcreditnotesrequest.md index cb0437d8f..877182d10 100644 --- a/lending/docs/models/operations/listaccountingbillcreditnotesrequest.md +++ b/lending/docs/models/operations/listaccountingbillcreditnotesrequest.md @@ -1,12 +1,12 @@ -# ListAccountingBillCreditNotesRequest - - -## 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 | +# ListAccountingBillCreditNotesRequest + + +## 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/lending/docs/models/operations/listaccountingbillpaymentsrequest.md b/lending/docs/models/operations/listaccountingbillpaymentsrequest.md index b704f947e..28e6283d6 100644 --- a/lending/docs/models/operations/listaccountingbillpaymentsrequest.md +++ b/lending/docs/models/operations/listaccountingbillpaymentsrequest.md @@ -1,12 +1,12 @@ -# ListAccountingBillPaymentsRequest - - -## 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 | +# ListAccountingBillPaymentsRequest + + +## 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/lending/docs/models/operations/listaccountingbillsrequest.md b/lending/docs/models/operations/listaccountingbillsrequest.md index 44645b866..a2fa28483 100644 --- a/lending/docs/models/operations/listaccountingbillsrequest.md +++ b/lending/docs/models/operations/listaccountingbillsrequest.md @@ -1,12 +1,12 @@ -# ListAccountingBillsRequest - - -## 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 | +# ListAccountingBillsRequest + + +## 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/lending/docs/models/operations/listaccountingcreditnotesrequest.md b/lending/docs/models/operations/listaccountingcreditnotesrequest.md index 7bd0a513a..89863aef0 100644 --- a/lending/docs/models/operations/listaccountingcreditnotesrequest.md +++ b/lending/docs/models/operations/listaccountingcreditnotesrequest.md @@ -1,12 +1,12 @@ -# ListAccountingCreditNotesRequest - - -## 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 | +# ListAccountingCreditNotesRequest + + +## 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/lending/docs/models/operations/listaccountingcustomerattachmentsrequest.md b/lending/docs/models/operations/listaccountingcustomerattachmentsrequest.md index ab9c23e9e..b21f48b11 100644 --- a/lending/docs/models/operations/listaccountingcustomerattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountingcustomerattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingCustomerAttachmentsRequest - - -## 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 | +# ListAccountingCustomerAttachmentsRequest + + +## 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 | | `customer_id` | *str* | :heavy_check_mark: | Unique identifier for a customer. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/listaccountingcustomersrequest.md b/lending/docs/models/operations/listaccountingcustomersrequest.md index 814c942b9..d730c8450 100644 --- a/lending/docs/models/operations/listaccountingcustomersrequest.md +++ b/lending/docs/models/operations/listaccountingcustomersrequest.md @@ -1,12 +1,12 @@ -# ListAccountingCustomersRequest - - -## 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 | +# ListAccountingCustomersRequest + + +## 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/lending/docs/models/operations/listaccountingdirectcostattachmentsrequest.md b/lending/docs/models/operations/listaccountingdirectcostattachmentsrequest.md index 37bdae56b..e50a9ea5c 100644 --- a/lending/docs/models/operations/listaccountingdirectcostattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountingdirectcostattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingDirectCostAttachmentsRequest - - -## 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 | +# ListAccountingDirectCostAttachmentsRequest + + +## 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 | | `direct_cost_id` | *str* | :heavy_check_mark: | Unique identifier for a direct cost. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/listaccountingdirectcostsrequest.md b/lending/docs/models/operations/listaccountingdirectcostsrequest.md index 6ca344797..f795230d2 100644 --- a/lending/docs/models/operations/listaccountingdirectcostsrequest.md +++ b/lending/docs/models/operations/listaccountingdirectcostsrequest.md @@ -1,13 +1,13 @@ -# ListAccountingDirectCostsRequest - - -## 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 | +# ListAccountingDirectCostsRequest + + +## 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/lending/docs/models/operations/listaccountingdirectincomeattachmentsrequest.md b/lending/docs/models/operations/listaccountingdirectincomeattachmentsrequest.md index 2ae431405..c69a00e8c 100644 --- a/lending/docs/models/operations/listaccountingdirectincomeattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountingdirectincomeattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingDirectIncomeAttachmentsRequest - - -## 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 | +# ListAccountingDirectIncomeAttachmentsRequest + + +## 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 | | `direct_income_id` | *str* | :heavy_check_mark: | Unique identifier for a direct income. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/listaccountingdirectincomesrequest.md b/lending/docs/models/operations/listaccountingdirectincomesrequest.md index 9bfad1d3d..d057c95af 100644 --- a/lending/docs/models/operations/listaccountingdirectincomesrequest.md +++ b/lending/docs/models/operations/listaccountingdirectincomesrequest.md @@ -1,13 +1,13 @@ -# ListAccountingDirectIncomesRequest - - -## 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 | +# ListAccountingDirectIncomesRequest + + +## 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/lending/docs/models/operations/listaccountinginvoiceattachmentsrequest.md b/lending/docs/models/operations/listaccountinginvoiceattachmentsrequest.md index 3966f19ad..e6a0a5e86 100644 --- a/lending/docs/models/operations/listaccountinginvoiceattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountinginvoiceattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingInvoiceAttachmentsRequest - - -## 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 | +# ListAccountingInvoiceAttachmentsRequest + + +## 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 | | `invoice_id` | *str* | :heavy_check_mark: | Unique identifier for an invoice. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/listaccountinginvoicesrequest.md b/lending/docs/models/operations/listaccountinginvoicesrequest.md index 037f3e6d2..d5002db53 100644 --- a/lending/docs/models/operations/listaccountinginvoicesrequest.md +++ b/lending/docs/models/operations/listaccountinginvoicesrequest.md @@ -1,12 +1,12 @@ -# ListAccountingInvoicesRequest - - -## 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 | +# ListAccountingInvoicesRequest + + +## 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/lending/docs/models/operations/listaccountingjournalentriesrequest.md b/lending/docs/models/operations/listaccountingjournalentriesrequest.md index 3e9dfdba4..15524a68c 100644 --- a/lending/docs/models/operations/listaccountingjournalentriesrequest.md +++ b/lending/docs/models/operations/listaccountingjournalentriesrequest.md @@ -1,12 +1,12 @@ -# ListAccountingJournalEntriesRequest - - -## 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 | +# ListAccountingJournalEntriesRequest + + +## 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/lending/docs/models/operations/listaccountingjournalsrequest.md b/lending/docs/models/operations/listaccountingjournalsrequest.md index 3f1001a00..849e53234 100644 --- a/lending/docs/models/operations/listaccountingjournalsrequest.md +++ b/lending/docs/models/operations/listaccountingjournalsrequest.md @@ -1,12 +1,12 @@ -# ListAccountingJournalsRequest - - -## 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 | +# ListAccountingJournalsRequest + + +## 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/lending/docs/models/operations/listaccountingpaymentsrequest.md b/lending/docs/models/operations/listaccountingpaymentsrequest.md index de7b80101..804b7a0ab 100644 --- a/lending/docs/models/operations/listaccountingpaymentsrequest.md +++ b/lending/docs/models/operations/listaccountingpaymentsrequest.md @@ -1,12 +1,12 @@ -# ListAccountingPaymentsRequest - - -## 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 | +# ListAccountingPaymentsRequest + + +## 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/lending/docs/models/operations/listaccountingsupplierattachmentsrequest.md b/lending/docs/models/operations/listaccountingsupplierattachmentsrequest.md index d84806376..b7ca4b3c6 100644 --- a/lending/docs/models/operations/listaccountingsupplierattachmentsrequest.md +++ b/lending/docs/models/operations/listaccountingsupplierattachmentsrequest.md @@ -1,10 +1,10 @@ -# ListAccountingSupplierAttachmentsRequest - - -## 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 | +# ListAccountingSupplierAttachmentsRequest + + +## 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 | | `supplier_id` | *str* | :heavy_check_mark: | Unique identifier for a supplier. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | \ No newline at end of file diff --git a/lending/docs/models/operations/listaccountingsuppliersrequest.md b/lending/docs/models/operations/listaccountingsuppliersrequest.md index 8b1a14151..30060b1d0 100644 --- a/lending/docs/models/operations/listaccountingsuppliersrequest.md +++ b/lending/docs/models/operations/listaccountingsuppliersrequest.md @@ -1,12 +1,12 @@ -# ListAccountingSuppliersRequest - - -## 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 | +# ListAccountingSuppliersRequest + + +## 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/lending/docs/models/operations/listaccountingtransfersrequest.md b/lending/docs/models/operations/listaccountingtransfersrequest.md index cbdde8af6..6cb1867da 100644 --- a/lending/docs/models/operations/listaccountingtransfersrequest.md +++ b/lending/docs/models/operations/listaccountingtransfersrequest.md @@ -1,13 +1,13 @@ -# ListAccountingTransfersRequest - - -## 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 | +# ListAccountingTransfersRequest + + +## 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/lending/docs/models/operations/listbankingaccountbalancesrequest.md b/lending/docs/models/operations/listbankingaccountbalancesrequest.md index c5d21b253..6838951a5 100644 --- a/lending/docs/models/operations/listbankingaccountbalancesrequest.md +++ b/lending/docs/models/operations/listbankingaccountbalancesrequest.md @@ -1,13 +1,13 @@ -# ListBankingAccountBalancesRequest - - -## 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 | +# ListBankingAccountBalancesRequest + + +## 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/lending/docs/models/operations/listbankingaccountsrequest.md b/lending/docs/models/operations/listbankingaccountsrequest.md index 22a74928a..ad93d1a14 100644 --- a/lending/docs/models/operations/listbankingaccountsrequest.md +++ b/lending/docs/models/operations/listbankingaccountsrequest.md @@ -1,13 +1,13 @@ -# ListBankingAccountsRequest - - -## 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 | +# ListBankingAccountsRequest + + +## 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/lending/docs/models/operations/listbankingtransactioncategoriesrequest.md b/lending/docs/models/operations/listbankingtransactioncategoriesrequest.md index e8956d1b1..3810915bb 100644 --- a/lending/docs/models/operations/listbankingtransactioncategoriesrequest.md +++ b/lending/docs/models/operations/listbankingtransactioncategoriesrequest.md @@ -1,13 +1,13 @@ -# ListBankingTransactionCategoriesRequest - - -## 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 | +# ListBankingTransactionCategoriesRequest + + +## 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/lending/docs/models/operations/listbankingtransactionsrequest.md b/lending/docs/models/operations/listbankingtransactionsrequest.md index 497beaf0d..bcd657300 100644 --- a/lending/docs/models/operations/listbankingtransactionsrequest.md +++ b/lending/docs/models/operations/listbankingtransactionsrequest.md @@ -1,13 +1,13 @@ -# ListBankingTransactionsRequest - - -## 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 | +# ListBankingTransactionsRequest + + +## 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/lending/docs/models/operations/listcategorizedbankstatementaccountsrequest.md b/lending/docs/models/operations/listcategorizedbankstatementaccountsrequest.md new file mode 100644 index 000000000..70bf57237 --- /dev/null +++ b/lending/docs/models/operations/listcategorizedbankstatementaccountsrequest.md @@ -0,0 +1,14 @@ +# ListCategorizedBankStatementAccountsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `max_age` | *Optional[str]* | :heavy_minus_sign: | The maximum age of report to fetch. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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 | +| `report_id` | *Any* | :heavy_check_mark: | Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report. | | \ No newline at end of file diff --git a/lending/docs/models/operations/listcommercecustomersrequest.md b/lending/docs/models/operations/listcommercecustomersrequest.md index f8118de68..1c1ca8821 100644 --- a/lending/docs/models/operations/listcommercecustomersrequest.md +++ b/lending/docs/models/operations/listcommercecustomersrequest.md @@ -1,13 +1,13 @@ -# ListCommerceCustomersRequest - - -## 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 | +# ListCommerceCustomersRequest + + +## 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/lending/docs/models/operations/listcommercedisputesrequest.md b/lending/docs/models/operations/listcommercedisputesrequest.md index e4038d733..76446817e 100644 --- a/lending/docs/models/operations/listcommercedisputesrequest.md +++ b/lending/docs/models/operations/listcommercedisputesrequest.md @@ -1,13 +1,13 @@ -# ListCommerceDisputesRequest - - -## 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 | +# ListCommerceDisputesRequest + + +## 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/lending/docs/models/operations/listcommercelocationsrequest.md b/lending/docs/models/operations/listcommercelocationsrequest.md index 8f84b7fe8..048278af0 100644 --- a/lending/docs/models/operations/listcommercelocationsrequest.md +++ b/lending/docs/models/operations/listcommercelocationsrequest.md @@ -1,9 +1,9 @@ -# ListCommerceLocationsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# ListCommerceLocationsRequest + + +## 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/lending/docs/models/operations/listcommerceordersrequest.md b/lending/docs/models/operations/listcommerceordersrequest.md index 235990f74..ca8b01166 100644 --- a/lending/docs/models/operations/listcommerceordersrequest.md +++ b/lending/docs/models/operations/listcommerceordersrequest.md @@ -1,13 +1,13 @@ -# ListCommerceOrdersRequest - - -## 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 | +# ListCommerceOrdersRequest + + +## 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/lending/docs/models/operations/listcommercepaymentmethodsrequest.md b/lending/docs/models/operations/listcommercepaymentmethodsrequest.md index 2728f80f5..76fe608a1 100644 --- a/lending/docs/models/operations/listcommercepaymentmethodsrequest.md +++ b/lending/docs/models/operations/listcommercepaymentmethodsrequest.md @@ -1,13 +1,13 @@ -# ListCommercePaymentMethodsRequest - - -## 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 | +# ListCommercePaymentMethodsRequest + + +## 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/lending/docs/models/operations/listcommercepaymentsrequest.md b/lending/docs/models/operations/listcommercepaymentsrequest.md index 8f777d61c..2b30eb2d6 100644 --- a/lending/docs/models/operations/listcommercepaymentsrequest.md +++ b/lending/docs/models/operations/listcommercepaymentsrequest.md @@ -1,13 +1,13 @@ -# ListCommercePaymentsRequest - - -## 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 | +# ListCommercePaymentsRequest + + +## 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/lending/docs/models/operations/listcommerceproductcategoriesrequest.md b/lending/docs/models/operations/listcommerceproductcategoriesrequest.md index 83850ba42..5e77e9f59 100644 --- a/lending/docs/models/operations/listcommerceproductcategoriesrequest.md +++ b/lending/docs/models/operations/listcommerceproductcategoriesrequest.md @@ -1,13 +1,13 @@ -# ListCommerceProductCategoriesRequest - - -## 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 | +# ListCommerceProductCategoriesRequest + + +## 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/lending/docs/models/operations/listcommerceproductsrequest.md b/lending/docs/models/operations/listcommerceproductsrequest.md index 076417856..acf0a4ee8 100644 --- a/lending/docs/models/operations/listcommerceproductsrequest.md +++ b/lending/docs/models/operations/listcommerceproductsrequest.md @@ -1,13 +1,13 @@ -# ListCommerceProductsRequest - - -## 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 | +# ListCommerceProductsRequest + + +## 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/lending/docs/models/operations/listcommercetransactionsrequest.md b/lending/docs/models/operations/listcommercetransactionsrequest.md index 2c11c4c23..ca7f50055 100644 --- a/lending/docs/models/operations/listcommercetransactionsrequest.md +++ b/lending/docs/models/operations/listcommercetransactionsrequest.md @@ -1,13 +1,13 @@ -# ListCommerceTransactionsRequest - - -## 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 | +# ListCommerceTransactionsRequest + + +## 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/lending/docs/models/operations/listcompaniesrequest.md b/lending/docs/models/operations/listcompaniesrequest.md index 25cc480a0..e43853f9f 100644 --- a/lending/docs/models/operations/listcompaniesrequest.md +++ b/lending/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/lending/docs/models/operations/listconnectionsrequest.md b/lending/docs/models/operations/listconnectionsrequest.md index 949d3e3b6..0a3173fc6 100644 --- a/lending/docs/models/operations/listconnectionsrequest.md +++ b/lending/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/lending/docs/models/operations/listcreateoperationsrequest.md b/lending/docs/models/operations/listcreateoperationsrequest.md index e92d7ed96..26382171e 100644 --- a/lending/docs/models/operations/listcreateoperationsrequest.md +++ b/lending/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/lending/docs/models/operations/listdataintegritydetailsrequest.md b/lending/docs/models/operations/listdataintegritydetailsrequest.md index 30686f352..69b8c6791 100644 --- a/lending/docs/models/operations/listdataintegritydetailsrequest.md +++ b/lending/docs/models/operations/listdataintegritydetailsrequest.md @@ -1,13 +1,13 @@ -# ListDataIntegrityDetailsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `data_type` | [shared.DataIntegrityDataType](../../models/shared/dataintegritydatatype.md) | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | -| `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 | +# ListDataIntegrityDetailsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `data_type` | *str* | :heavy_check_mark: | A key for a Codat data type. | banking-accounts | +| `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/lending/docs/models/operations/listfilesrequest.md b/lending/docs/models/operations/listfilesrequest.md index 23e4a10f6..c00176249 100644 --- a/lending/docs/models/operations/listfilesrequest.md +++ b/lending/docs/models/operations/listfilesrequest.md @@ -1,8 +1,8 @@ -# ListFilesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# ListFilesRequest + + +## 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/lending/docs/models/operations/listloantransactionsqueryparamsourcetype.md b/lending/docs/models/operations/listloantransactionsqueryparamsourcetype.md index 620190e61..3bdac2f9c 100644 --- a/lending/docs/models/operations/listloantransactionsqueryparamsourcetype.md +++ b/lending/docs/models/operations/listloantransactionsqueryparamsourcetype.md @@ -1,20 +1,18 @@ -# ListLoanTransactionsQueryParamSourceType - -Data source type. - -## Example Usage - -```python -from codat_lending.models.operations import ListLoanTransactionsQueryParamSourceType - -value = ListLoanTransactionsQueryParamSourceType.BANKING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `BANKING` | banking | -| `COMMERCE` | commerce | +# ListLoanTransactionsQueryParamSourceType + +## Example Usage + +```python +from codat_lending.models.operations import ListLoanTransactionsQueryParamSourceType + +value = ListLoanTransactionsQueryParamSourceType.BANKING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `BANKING` | banking | +| `COMMERCE` | commerce | | `ACCOUNTING` | accounting | \ No newline at end of file diff --git a/lending/docs/models/operations/listloantransactionsrequest.md b/lending/docs/models/operations/listloantransactionsrequest.md index 971531a9a..363488d1f 100644 --- a/lending/docs/models/operations/listloantransactionsrequest.md +++ b/lending/docs/models/operations/listloantransactionsrequest.md @@ -1,9 +1,9 @@ -# ListLoanTransactionsRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `source_type` | [operations.ListLoanTransactionsQueryParamSourceType](../../models/operations/listloantransactionsqueryparamsourcetype.md) | :heavy_check_mark: | Data source type. | | \ No newline at end of file +# ListLoanTransactionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `source_type` | *str* | :heavy_check_mark: | Data source type. | | \ No newline at end of file diff --git a/lending/docs/models/operations/listpulloperationsrequest.md b/lending/docs/models/operations/listpulloperationsrequest.md index 90a05e642..af69d3d64 100644 --- a/lending/docs/models/operations/listpulloperationsrequest.md +++ b/lending/docs/models/operations/listpulloperationsrequest.md @@ -1,12 +1,12 @@ -# ListPullOperationsRequest - - -## 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 | +# ListPullOperationsRequest + + +## 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/lending/docs/models/operations/listreconciledinvoicesrequest.md b/lending/docs/models/operations/listreconciledinvoicesrequest.md index d79a015f1..13f931c72 100644 --- a/lending/docs/models/operations/listreconciledinvoicesrequest.md +++ b/lending/docs/models/operations/listreconciledinvoicesrequest.md @@ -1,11 +1,11 @@ -# ListReconciledInvoicesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | -| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | +# ListReconciledInvoicesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `page` | *Optional[int]* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | | `query` | *Optional[str]* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/lending/docs/models/operations/listreportsrequest.md b/lending/docs/models/operations/listreportsrequest.md index a8438b271..003356378 100644 --- a/lending/docs/models/operations/listreportsrequest.md +++ b/lending/docs/models/operations/listreportsrequest.md @@ -1,12 +1,12 @@ -# ListReportsRequest - - -## 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 | +# ListReportsRequest + + +## 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/lending/docs/models/operations/queryparamsourcetype.md b/lending/docs/models/operations/queryparamsourcetype.md index 9349f832d..6b5ee641a 100644 --- a/lending/docs/models/operations/queryparamsourcetype.md +++ b/lending/docs/models/operations/queryparamsourcetype.md @@ -1,20 +1,18 @@ -# QueryParamSourceType - -Data source type. - -## Example Usage - -```python -from codat_lending.models.operations import QueryParamSourceType - -value = QueryParamSourceType.BANKING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `BANKING` | banking | -| `COMMERCE` | commerce | +# QueryParamSourceType + +## Example Usage + +```python +from codat_lending.models.operations import QueryParamSourceType + +value = QueryParamSourceType.BANKING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `BANKING` | banking | +| `COMMERCE` | commerce | | `ACCOUNTING` | accounting | \ No newline at end of file diff --git a/lending/docs/models/operations/refreshalldatatypesrequest.md b/lending/docs/models/operations/refreshalldatatypesrequest.md index ea381e387..18991b870 100644 --- a/lending/docs/models/operations/refreshalldatatypesrequest.md +++ b/lending/docs/models/operations/refreshalldatatypesrequest.md @@ -1,8 +1,8 @@ -# RefreshAllDataTypesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +# RefreshAllDataTypesRequest + + +## 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/lending/docs/models/operations/refreshdatatyperequest.md b/lending/docs/models/operations/refreshdatatyperequest.md index 131e92e85..93894e187 100644 --- a/lending/docs/models/operations/refreshdatatyperequest.md +++ b/lending/docs/models/operations/refreshdatatyperequest.md @@ -1,10 +1,10 @@ -# RefreshDataTypeRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `connection_id` | *Optional[str]* | :heavy_minus_sign: | Optionally, provide a data connection id to only queue pull operations on that connection. | | +# RefreshDataTypeRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `connection_id` | *Optional[str]* | :heavy_minus_sign: | Optionally, provide a data connection id to only queue pull operations on that connection. | | | `data_type` | [shared.SchemaDataType](../../models/shared/schemadatatype.md) | :heavy_check_mark: | A key for a Codat data type. | invoices | \ No newline at end of file diff --git a/lending/docs/models/operations/replacecompanyrequest.md b/lending/docs/models/operations/replacecompanyrequest.md index cde3d20e3..2b90faf30 100644 --- a/lending/docs/models/operations/replacecompanyrequest.md +++ b/lending/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/lending/docs/models/operations/setbankstatementuploadconfigurationrequest.md b/lending/docs/models/operations/setbankstatementuploadconfigurationrequest.md index 0c4b5fea4..5cd8cc112 100644 --- a/lending/docs/models/operations/setbankstatementuploadconfigurationrequest.md +++ b/lending/docs/models/operations/setbankstatementuploadconfigurationrequest.md @@ -1,10 +1,10 @@ -# SetBankStatementUploadConfigurationRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `bank_statement_upload_configuration` | [Optional[shared.BankStatementUploadConfiguration]](../../models/shared/bankstatementuploadconfiguration.md) | :heavy_minus_sign: | N/A | | -| `company_id` | *str* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +# SetBankStatementUploadConfigurationRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `bank_statement_upload_configuration` | [Optional[shared.BankStatementUploadConfiguration]](../../models/shared/bankstatementuploadconfiguration.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/lending/docs/models/operations/sourceaccount.md b/lending/docs/models/operations/sourceaccount.md new file mode 100644 index 000000000..01965a1ab --- /dev/null +++ b/lending/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.SourceAccountStatus]](../../models/shared/sourceaccountstatus.md) | :heavy_minus_sign: | Status of the source account. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatebankaccountresponseaccountingbankaccount.md b/lending/docs/models/operations/sourceaccountprototype.md similarity index 74% rename from lending/docs/models/shared/accountingcreatebankaccountresponseaccountingbankaccount.md rename to lending/docs/models/operations/sourceaccountprototype.md index 486f7fdbc..e4552c370 100644 --- a/lending/docs/models/shared/accountingcreatebankaccountresponseaccountingbankaccount.md +++ b/lending/docs/models/operations/sourceaccountprototype.md @@ -1,41 +1,15 @@ -# ~~AccountingCreateBankAccountResponseAccountingBankAccount~~ - -> **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/lending-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.AccountingBankAccountType]](../../models/shared/accountingbankaccounttype.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 +# 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/lending/docs/models/operations/sourceaccountv2.md b/lending/docs/models/operations/sourceaccountv2.md new file mode 100644 index 000000000..760791283 --- /dev/null +++ b/lending/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/lending/docs/models/operations/sourceaccountv2prototype.md b/lending/docs/models/operations/sourceaccountv2prototype.md new file mode 100644 index 000000000..fb0127dd3 --- /dev/null +++ b/lending/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.PropertieAccountType](../../models/shared/propertieaccounttype.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/lending/docs/models/operations/sourcetype.md b/lending/docs/models/operations/sourcetype.md index d9885d646..370bbc722 100644 --- a/lending/docs/models/operations/sourcetype.md +++ b/lending/docs/models/operations/sourcetype.md @@ -1,20 +1,18 @@ -# SourceType - -Data source type. - -## Example Usage - -```python -from codat_lending.models.operations import SourceType - -value = SourceType.BANKING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `BANKING` | banking | -| `COMMERCE` | commerce | +# SourceType + +## Example Usage + +```python +from codat_lending.models.operations import SourceType + +value = SourceType.BANKING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `BANKING` | banking | +| `COMMERCE` | commerce | | `ACCOUNTING` | accounting | \ No newline at end of file diff --git a/lending/docs/models/operations/startbankstatementuploadsessionrequest.md b/lending/docs/models/operations/startbankstatementuploadsessionrequest.md index aab494747..bd0350b4a 100644 --- a/lending/docs/models/operations/startbankstatementuploadsessionrequest.md +++ b/lending/docs/models/operations/startbankstatementuploadsessionrequest.md @@ -1,10 +1,10 @@ -# StartBankStatementUploadSessionRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `start_upload_session_request` | [Optional[shared.StartUploadSessionRequest]](../../models/shared/startuploadsessionrequest.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 +# StartBankStatementUploadSessionRequest + + +## 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 | +| `start_upload_session_request` | [Optional[shared.StartUploadSessionRequest]](../../models/shared/startuploadsessionrequest.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/operations/unlinkconnectionrequest.md b/lending/docs/models/operations/unlinkconnectionrequest.md index 37c72c7bc..66136f30f 100644 --- a/lending/docs/models/operations/unlinkconnectionrequest.md +++ b/lending/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/lending/docs/models/operations/unlinkconnectionupdateconnection.md b/lending/docs/models/operations/unlinkconnectionupdateconnection.md index 5a5f2911b..476521561 100644 --- a/lending/docs/models/operations/unlinkconnectionupdateconnection.md +++ b/lending/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/lending/docs/models/operations/updatecompanyrequest.md b/lending/docs/models/operations/updatecompanyrequest.md index 47802c383..9718e2ff6 100644 --- a/lending/docs/models/operations/updatecompanyrequest.md +++ b/lending/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/lending/docs/models/operations/uploadbankstatementdatarequest.md b/lending/docs/models/operations/uploadbankstatementdatarequest.md index e487a36e6..0a1f7fa3e 100644 --- a/lending/docs/models/operations/uploadbankstatementdatarequest.md +++ b/lending/docs/models/operations/uploadbankstatementdatarequest.md @@ -1,12 +1,12 @@ -# UploadBankStatementDataRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -| `request_body` | [operations.UploadBankStatementDataRequestBody](../../models/operations/uploadbankstatementdatarequestbody.md) | :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 | -| `dataset_id` | *str* | :heavy_check_mark: | Unique identifier for the dataset that completed its sync. | | -| `path` | [Optional[shared.Path]](../../models/shared/path.md) | :heavy_minus_sign: | The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`. | | \ No newline at end of file +# UploadBankStatementDataRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| `request_body` | *Union[UploadBankStatementDataRequestBody, Any]* | :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 | +| `dataset_id` | *str* | :heavy_check_mark: | Unique identifier for the dataset that completed its sync. | | +| `path` | *Optional[str]* | :heavy_minus_sign: | The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`. | | \ No newline at end of file diff --git a/lending/docs/models/operations/uploadbankstatementdatarequestbody.md b/lending/docs/models/operations/uploadbankstatementdatarequestbody.md index 950cb6a1d..62251702c 100644 --- a/lending/docs/models/operations/uploadbankstatementdatarequestbody.md +++ b/lending/docs/models/operations/uploadbankstatementdatarequestbody.md @@ -1,23 +1,23 @@ -# UploadBankStatementDataRequestBody - - -## Supported Types - -### `shared.BankingAccount` - -```python -value: shared.BankingAccount = /* values here */ -``` - -### `shared.BankingTransactions` - -```python -value: shared.BankingTransactions = /* values here */ -``` - -### `Any` - -```python -value: Any = /* values here */ -``` - +# UploadBankStatementDataRequestBody + + +## Supported Types + +### `shared.BankingAccount` + +```python +value: shared.BankingAccount = /* values here */ +``` + +### `shared.BankingTransactions` + +```python +value: shared.BankingTransactions = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/lending/docs/models/operations/uploadfilesrequest.md b/lending/docs/models/operations/uploadfilesrequest.md index 25d9d2834..c9271b7d1 100644 --- a/lending/docs/models/operations/uploadfilesrequest.md +++ b/lending/docs/models/operations/uploadfilesrequest.md @@ -1,10 +1,10 @@ -# UploadFilesRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `file_upload` | [Optional[shared.FileUpload]](../../models/shared/fileupload.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 +# UploadFilesRequest + + +## 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 | +| `file_upload` | *Optional[FileUploadModel]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatesupplierresponseaccountingsupplier.md b/lending/docs/models/shared/account.md similarity index 62% rename from lending/docs/models/shared/accountingcreatesupplierresponseaccountingsupplier.md rename to lending/docs/models/shared/account.md index cf4394f1a..fc6f5a840 100644 --- a/lending/docs/models/shared/accountingcreatesupplierresponseaccountingsupplier.md +++ b/lending/docs/models/shared/account.md @@ -1,27 +1,16 @@ -# ~~AccountingCreateSupplierResponseAccountingSupplier~~ - -## Overview - -From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). - -> :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 | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | -| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | | -| `default_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | -| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | -| `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 | -| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | -| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.SupplierStatus](../../models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | -| `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. | | -| `supplier_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | -| `tax_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Supplier's company tax number. | | \ No newline at end of file +# Account + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *Optional[str]* | :heavy_minus_sign: | The name of the account according to the provider. | | +| `account_provider` | *Optional[str]* | :heavy_minus_sign: | The bank or other financial institution providing the account. | | +| `account_type` | *Optional[str]* | :heavy_minus_sign: | The type of banking account, e.g. credit or debit. | | +| `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 | +| `current_balance` | *Optional[Decimal]* | :heavy_minus_sign: | The balance of the bank account. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | The ID of the account from the provider. | | +| `identifiers` | [Optional[shared.AccountIdentifiers]](../../models/shared/accountidentifiers.md) | :heavy_minus_sign: | An object containing bank account identification information. | | +| `platform_name` | *Optional[str]* | :heavy_minus_sign: | Name of the banking data source, e.g. "Plaid". | | +| `source_ref` | [Optional[shared.SourceRef]](../../models/shared/sourceref.md) | :heavy_minus_sign: | A source reference containing the `sourceType` object "Banking". | {
"Example": {
"value": {
"sourceRef": {
"sourceType": "Banking"
}
}
}
} | \ No newline at end of file diff --git a/lending/docs/models/shared/accountbalance.md b/lending/docs/models/shared/accountbalance.md index 1af454901..02ad39e01 100644 --- a/lending/docs/models/shared/accountbalance.md +++ b/lending/docs/models/shared/accountbalance.md @@ -1,11 +1,11 @@ -# AccountBalance - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `available` | *Optional[Decimal]* | :heavy_minus_sign: | The account's current balance | | -| `currency` | *Optional[str]* | :heavy_minus_sign: | The currency of the account | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `pending` | *Optional[Decimal]* | :heavy_minus_sign: | Funds that are not yet available in the balance | | +# AccountBalance + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `available` | *Optional[Decimal]* | :heavy_minus_sign: | The account's current balance | | +| `currency` | *Optional[str]* | :heavy_minus_sign: | The currency of the account | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `pending` | *Optional[Decimal]* | :heavy_minus_sign: | Funds that are not yet available in the balance | | | `reserved` | *Optional[Any]* | :heavy_minus_sign: | Funds reserved as holdings | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountbalanceamounts.md b/lending/docs/models/shared/accountbalanceamounts.md index 3d02772ed..6abbedb9c 100644 --- a/lending/docs/models/shared/accountbalanceamounts.md +++ b/lending/docs/models/shared/accountbalanceamounts.md @@ -1,12 +1,13 @@ -# AccountBalanceAmounts - -Depending on the data provided by the underlying bank, not all balances are always available. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `available` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The balance available in the account, including any pending transactions. This doesn't include additional funds available from any overdrafts. | -| `current` | *Optional[Decimal]* | :heavy_minus_sign: | The balance of the account only including cleared transactions. | +# AccountBalanceAmounts + +Depending on the data provided by the underlying bank, not all balances are always available. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `available` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The balance available in the account, including any pending transactions. This doesn't include additional funds available from any overdrafts. | +| `current` | *Optional[Decimal]* | :heavy_minus_sign: | The balance of the account only including cleared transactions. | | `limit` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The minimum allowed balance for the account. For example, a $100.00 overdraft would show as a limit of `-100.00`. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountcategoriesupdatedwebhook.md b/lending/docs/models/shared/accountcategoriesupdatedwebhook.md index be416f841..9568f587f 100644 --- a/lending/docs/models/shared/accountcategoriesupdatedwebhook.md +++ b/lending/docs/models/shared/accountcategoriesupdatedwebhook.md @@ -1,18 +1,18 @@ -# AccountCategoriesUpdatedWebhook - -Webhook request body for the "Account categories updated" event. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | | -| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | | -| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | | -| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `data` | [Optional[shared.AccountCategoriesUpdatedWebhookData]](../../models/shared/accountcategoriesupdatedwebhookdata.md) | :heavy_minus_sign: | N/A | | -| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | | -| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | | +# AccountCategoriesUpdatedWebhook + +Webhook request body for the "Account categories updated" event. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `alert_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the webhook event. | | +| `client_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your client in Codat. | | +| `client_name` | *Optional[str]* | :heavy_minus_sign: | Name of your client in Codat. | | +| `company_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `data` | [Optional[shared.AccountCategoriesUpdatedWebhookData]](../../models/shared/accountcategoriesupdatedwebhookdata.md) | :heavy_minus_sign: | N/A | | +| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `message` | *Optional[str]* | :heavy_minus_sign: | A human-readable message about the webhook. | | +| ~~`rule_id`~~ | *Optional[str]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | | | `rule_type` | *Optional[str]* | :heavy_minus_sign: | The type of rule. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountcategoriesupdatedwebhookdata.md b/lending/docs/models/shared/accountcategoriesupdatedwebhookdata.md index 5e741d615..5cad166a7 100644 --- a/lending/docs/models/shared/accountcategoriesupdatedwebhookdata.md +++ b/lending/docs/models/shared/accountcategoriesupdatedwebhookdata.md @@ -1,8 +1,8 @@ -# AccountCategoriesUpdatedWebhookData - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +# AccountCategoriesUpdatedWebhookData + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `modified_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountcategorylevel.md b/lending/docs/models/shared/accountcategorylevel.md index 54b00ef77..f7696e9b4 100644 --- a/lending/docs/models/shared/accountcategorylevel.md +++ b/lending/docs/models/shared/accountcategorylevel.md @@ -1,11 +1,11 @@ -# AccountCategoryLevel - -An object containing an ordered list of account category levels. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `confidence` | *Optional[Decimal]* | :heavy_minus_sign: | Confidence level of the category. This will only be populated where `status` is `Suggested`. | +# AccountCategoryLevel + +An object containing an ordered list of account category levels. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `confidence` | *Optional[Decimal]* | :heavy_minus_sign: | Confidence level of the category. This will only be populated where `status` is `Suggested`. | | `level_name` | *Optional[str]* | :heavy_minus_sign: | Account category name. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountidentifiers.md b/lending/docs/models/shared/accountidentifiers.md index f5610401d..28305776b 100644 --- a/lending/docs/models/shared/accountidentifiers.md +++ b/lending/docs/models/shared/accountidentifiers.md @@ -1,16 +1,17 @@ -# AccountIdentifiers - -An object containing bank account identification information. - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bank_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The local (usually national) routing number for the account.

This is known by different names in different countries:
* BSB code (Australia)
* routing number (Canada, USA)
* sort code (UK) | -| `bic` | *OptionalNullable[str]* | :heavy_minus_sign: | The ISO 9362 code (commonly called SWIFT code, SWIFT-BIC or BIC) for the account. | -| `iban` | *OptionalNullable[str]* | :heavy_minus_sign: | The international bank account number (IBAN) for the account, if known. | -| `masked_account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | A portion of the actual account `number` to help account identification where number is tokenised (Plaid only) | -| `number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number for the account. When combined with the`bankCode`, this is usually enough to uniquely identify an account within a jurisdiction. | -| `subtype` | *OptionalNullable[str]* | :heavy_minus_sign: | Detailed account category | +# AccountIdentifiers + +An object containing bank account identification information. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `bank_code` | *OptionalNullable[str]* | :heavy_minus_sign: | The local (usually national) routing number for the account.

This is known by different names in different countries:
* BSB code (Australia)
* routing number (Canada, USA)
* sort code (UK) | +| `bic` | *OptionalNullable[str]* | :heavy_minus_sign: | The ISO 9362 code (commonly called SWIFT code, SWIFT-BIC or BIC) for the account. | +| `iban` | *OptionalNullable[str]* | :heavy_minus_sign: | The international bank account number (IBAN) for the account, if known. | +| `masked_account_number` | *OptionalNullable[str]* | :heavy_minus_sign: | A portion of the actual account `number` to help account identification where number is tokenised (Plaid only) | +| `number` | *OptionalNullable[str]* | :heavy_minus_sign: | The account number for the account. When combined with the`bankCode`, this is usually enough to uniquely identify an account within a jurisdiction. | +| `subtype` | *OptionalNullable[str]* | :heavy_minus_sign: | Detailed account category | | `type` | [shared.AccountIdentifierType](../../models/shared/accountidentifiertype.md) | :heavy_check_mark: | Type of account | \ No newline at end of file diff --git a/lending/docs/models/shared/accountidentifiertype.md b/lending/docs/models/shared/accountidentifiertype.md index d882b62ab..576c3e7aa 100644 --- a/lending/docs/models/shared/accountidentifiertype.md +++ b/lending/docs/models/shared/accountidentifiertype.md @@ -1,24 +1,22 @@ -# AccountIdentifierType - -Type of account - -## Example Usage - -```python -from codat_lending.models.shared import AccountIdentifierType - -value = AccountIdentifierType.ACCOUNT -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `ACCOUNT` | Account | -| `CARD` | Card | -| `CREDIT` | Credit | -| `DEPOSITORY` | Depository | -| `INVESTMENT` | Investment | -| `LOAN` | Loan | +# AccountIdentifierType + +## Example Usage + +```python +from codat_lending.models.shared import AccountIdentifierType + +value = AccountIdentifierType.ACCOUNT +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ACCOUNT` | Account | +| `CARD` | Card | +| `CREDIT` | Credit | +| `DEPOSITORY` | Depository | +| `INVESTMENT` | Investment | +| `LOAN` | Loan | | `OTHER` | Other | \ No newline at end of file diff --git a/lending/docs/models/shared/accountinfo.md b/lending/docs/models/shared/accountinfo.md index 9883d2487..c58ab5b5d 100644 --- a/lending/docs/models/shared/accountinfo.md +++ b/lending/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/lending/docs/models/shared/accountingaccount.md b/lending/docs/models/shared/accountingaccount.md index 72679ed9f..f8d6bec69 100644 --- a/lending/docs/models/shared/accountingaccount.md +++ b/lending/docs/models/shared/accountingaccount.md @@ -1,50 +1,50 @@ -# AccountingAccount - -> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - -## Overview - -Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - -The categories for an account include: -* Asset -* Expense -* Income -* Liability -* Equity. - -The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - -At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - -To determine the list of allowed categories for a specific integration, you can: -- Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). -- Refer to the integration's own documentation. - -> **Accounts with no category** -> -> If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. -> -> This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `current_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Current balance in the account. | 0 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | -| `fully_qualified_category` | *OptionalNullable[str]* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | -| `fully_qualified_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | **Example 1:** Cash On Hand
**Example 2:** Fixed Asset | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company. | 1b6266d1-1e44-46c5-8eb5-a8f98e03124e | -| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | -| `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 | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | -| `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.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the 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. | | -| `type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | -| `valid_datatype_links` | List[[shared.AccountingAccountValidDataTypeLinks](../../models/shared/accountingaccountvaliddatatypelinks.md)] | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file +# AccountingAccount + +> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. + +## Overview + +Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. + +The categories for an account include: +* Asset +* Expense +* Income +* Liability +* Equity. + +The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. + +At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. + +To determine the list of allowed categories for a specific integration, you can: +- Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). +- Refer to the integration's own documentation. + +> **Accounts with no category** +> +> If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. +> +> This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | +| `current_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Current balance in the account. | 0 | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | +| `fully_qualified_category` | *OptionalNullable[str]* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | +| `fully_qualified_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | **Example 1:** Cash On Hand
**Example 2:** Fixed Asset | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company. | 1b6266d1-1e44-46c5-8eb5-a8f98e03124e | +| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | +| `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 | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | +| `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.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the 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. | | +| `type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | +| `valid_datatype_links` | List[[shared.ValidDataTypeLinks](../../models/shared/validdatatypelinks.md)] | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaccounts.md b/lending/docs/models/shared/accountingaccounts.md index 41a5c3328..367655b66 100644 --- a/lending/docs/models/shared/accountingaccounts.md +++ b/lending/docs/models/shared/accountingaccounts.md @@ -1,12 +1,12 @@ -# AccountingAccounts - - -## 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.AccountingAccount]](../../models/shared/accountingaccount.md)] | :heavy_minus_sign: | N/A | | +# AccountingAccounts + + +## 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.AccountingAccount]](../../models/shared/accountingaccount.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/lending/docs/models/shared/accountingaccounttransaction.md b/lending/docs/models/shared/accountingaccounttransaction.md index 378b10ec0..680ffd959 100644 --- a/lending/docs/models/shared/accountingaccounttransaction.md +++ b/lending/docs/models/shared/accountingaccounttransaction.md @@ -1,36 +1,36 @@ -# AccountingAccountTransaction - -> **Language tip:** In Codat, account transactions represent all transactions posted to a bank account within an accounting software. For bank transactions posted within a banking platform, refer to [Banking transactions](https://docs.codat.io/lending-api#/operations/list-all-banking-transactions). - -## Overview - -In Codat’s data model, account transactions represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - -Account transactions are created as a result of different business activities, for example: - -* Payments: for example, receiving money for payment against an invoice. -* Bill payments: for example, spending money for a payment against a bill. -* Direct costs: for example, withdrawing money from a bank account, either for cash purposes or to make a payment. -* Direct incomes: for example, selling an item directly to a contact and receiving payment at point of sale. -* Transfers: for example, transferring money between two bank accounts. - -Account transactions is the parent data type of [payments](https://docs.codat.io/lending-api#/schemas/Payment), [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment), [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost), [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome), and [transfers](https://docs.codat.io/lending-api#/schemas/Transfer). - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `bank_account_ref` | [Optional[shared.BankAccountRef]](../../models/shared/bankaccountref.md) | :heavy_minus_sign: | Links to the Account transactions data type. | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `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: | Identifier of the direct cost (unique to the company). | | -| `lines` | List[[shared.AccountTransactionLine](../../models/shared/accounttransactionline.md)] | :heavy_minus_sign: | Array of account transaction lines. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information about the account transaction, if available. | | -| `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.AccountingAccountTransactionStatus]](../../models/shared/accountingaccounttransactionstatus.md) | :heavy_minus_sign: | The status of the account transaction. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the account transactions, inclusive of tax. | | +# AccountingAccountTransaction + +> **Language tip:** In Codat, account transactions represent all transactions posted to a bank account within an accounting software. For bank transactions posted within a banking platform, refer to [Banking transactions](https://docs.codat.io/lending-api#/operations/list-all-banking-transactions). + +## Overview + +In Codat’s data model, account transactions represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. + +Account transactions are created as a result of different business activities, for example: + +* Payments: for example, receiving money for payment against an invoice. +* Bill payments: for example, spending money for a payment against a bill. +* Direct costs: for example, withdrawing money from a bank account, either for cash purposes or to make a payment. +* Direct incomes: for example, selling an item directly to a contact and receiving payment at point of sale. +* Transfers: for example, transferring money between two bank accounts. + +Account transactions is the parent data type of [payments](https://docs.codat.io/lending-api#/schemas/Payment), [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment), [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost), [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome), and [transfers](https://docs.codat.io/lending-api#/schemas/Transfer). + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bank_account_ref` | [Optional[shared.BankAccountRef]](../../models/shared/bankaccountref.md) | :heavy_minus_sign: | Links to the Account transactions data type. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `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: | Identifier of the direct cost (unique to the company). | | +| `lines` | List[[shared.AccountTransactionLine](../../models/shared/accounttransactionline.md)] | :heavy_minus_sign: | Array of account transaction lines. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information about the account transaction, if available. | | +| `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.AccountingAccountTransactionStatus]](../../models/shared/accountingaccounttransactionstatus.md) | :heavy_minus_sign: | The status of the account transaction. | | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the account transactions, inclusive of tax. | | | `transaction_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Identifier of the transaction (unique to the company). | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaccounttransactiondatatype.md b/lending/docs/models/shared/accountingaccounttransactiondatatype.md new file mode 100644 index 000000000..5a9d07b01 --- /dev/null +++ b/lending/docs/models/shared/accountingaccounttransactiondatatype.md @@ -0,0 +1,26 @@ +# AccountingAccountTransactionDataType + +## Example Usage + +```python +from codat_lending.models.shared import AccountingAccountTransactionDataType + +value = AccountingAccountTransactionDataType.BANK_TRANSACTIONS +``` + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `BANK_TRANSACTIONS` | bankTransactions | +| `BILL_CREDIT_NOTES` | billCreditNotes | +| `BILL_PAYMENTS` | billPayments | +| `BILLS` | bills | +| `CREDIT_NOTES` | creditNotes | +| `DIRECT_COSTS` | directCosts | +| `DIRECT_INCOMES` | directIncomes | +| `INVOICES` | invoices | +| `JOURNAL_ENTRIES` | journalEntries | +| `PAYMENTS` | payments | +| `TRANSFERS` | transfers | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaccounttransactions.md b/lending/docs/models/shared/accountingaccounttransactions.md index 35c841c68..26f9d2b0a 100644 --- a/lending/docs/models/shared/accountingaccounttransactions.md +++ b/lending/docs/models/shared/accountingaccounttransactions.md @@ -1,12 +1,12 @@ -# AccountingAccountTransactions - - -## 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.AccountingAccountTransaction]](../../models/shared/accountingaccounttransaction.md)] | :heavy_minus_sign: | N/A | | +# AccountingAccountTransactions + + +## 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.AccountingAccountTransaction]](../../models/shared/accountingaccounttransaction.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/lending/docs/models/shared/accountingaccounttransactionstatus.md b/lending/docs/models/shared/accountingaccounttransactionstatus.md index 9af6bc2d0..e39a5ef3c 100644 --- a/lending/docs/models/shared/accountingaccounttransactionstatus.md +++ b/lending/docs/models/shared/accountingaccounttransactionstatus.md @@ -1,21 +1,19 @@ -# AccountingAccountTransactionStatus - -The status of the account transaction. - -## Example Usage - -```python -from codat_lending.models.shared import AccountingAccountTransactionStatus - -value = AccountingAccountTransactionStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `UNKNOWN` | Unknown | -| `UNRECONCILED` | Unreconciled | -| `RECONCILED` | Reconciled | +# AccountingAccountTransactionStatus + +## Example Usage + +```python +from codat_lending.models.shared import AccountingAccountTransactionStatus + +value = AccountingAccountTransactionStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `UNKNOWN` | Unknown | +| `UNRECONCILED` | Unreconciled | +| `RECONCILED` | Reconciled | | `VOID` | Void | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaccountvaliddatatypelinks.md b/lending/docs/models/shared/accountingaccountvaliddatatypelinks.md deleted file mode 100644 index b7173f7e2..000000000 --- a/lending/docs/models/shared/accountingaccountvaliddatatypelinks.md +++ /dev/null @@ -1,50 +0,0 @@ -# AccountingAccountValidDataTypeLinks - -When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - -For example, `validDatatypeLinks` might indicate the following references: - -- Which tax rates are valid to use on the line item of a bill. -- Which items can be used when creating an invoice. - -You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - -## `validDatatypeLinks` example - -The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - -```json validDatatypeLinks for an account -{ - "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", - "nominalCode": "090", - "name": "Business Bank Account", - #... - "validDatatypeLinks": [ - { - "property": "Id", - "links": [ - "Payment.AccountRef.Id", - "BillPayment.AccountRef.Id", - "DirectIncome.LineItems.AccountRef.Id", - "DirectCost.LineItems.AccountRef.Id" - ] - } - ] - } -``` - - - -## Support for `validDatatypeLinks` - -Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - -If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `links` | List[*str*] | :heavy_minus_sign: | Supported `dataTypes` that the record can be linked to. | -| `property` | *OptionalNullable[str]* | :heavy_minus_sign: | The property from the account that can be linked. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaddress.md b/lending/docs/models/shared/accountingaddress.md index 25c7e6e6c..b5ad61e67 100644 --- a/lending/docs/models/shared/accountingaddress.md +++ b/lending/docs/models/shared/accountingaddress.md @@ -1,14 +1,14 @@ -# AccountingAddress - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `city` | *OptionalNullable[str]* | :heavy_minus_sign: | City of the customer address. | -| `country` | *OptionalNullable[str]* | :heavy_minus_sign: | Country of the customer address. | -| `line1` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 1 of the customer address. | -| `line2` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 2 of the customer address. | -| `postal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Postal code or zip code. | -| `region` | *OptionalNullable[str]* | :heavy_minus_sign: | Region of the customer address. | +# AccountingAddress + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `city` | *OptionalNullable[str]* | :heavy_minus_sign: | City of the customer address. | +| `country` | *OptionalNullable[str]* | :heavy_minus_sign: | Country of the customer address. | +| `line1` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 1 of the customer address. | +| `line2` | *OptionalNullable[str]* | :heavy_minus_sign: | Line 2 of the customer address. | +| `postal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Postal code or zip code. | +| `region` | *OptionalNullable[str]* | :heavy_minus_sign: | Region of the customer address. | | `type` | [shared.AccountingAddressType](../../models/shared/accountingaddresstype.md) | :heavy_check_mark: | The type of the address | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingaddresstype.md b/lending/docs/models/shared/accountingaddresstype.md index 48c7eba8c..349e847ad 100644 --- a/lending/docs/models/shared/accountingaddresstype.md +++ b/lending/docs/models/shared/accountingaddresstype.md @@ -1,20 +1,18 @@ -# AccountingAddressType - -The type of the address - -## Example Usage - -```python -from codat_lending.models.shared import AccountingAddressType - -value = AccountingAddressType.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `BILLING` | Billing | +# AccountingAddressType + +## Example Usage + +```python +from codat_lending.models.shared import AccountingAddressType + +value = AccountingAddressType.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `BILLING` | Billing | | `DELIVERY` | Delivery | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingagedcreditorreport.md b/lending/docs/models/shared/accountingagedcreditorreport.md index 6986fa022..3e8a66831 100644 --- a/lending/docs/models/shared/accountingagedcreditorreport.md +++ b/lending/docs/models/shared/accountingagedcreditorreport.md @@ -1,43 +1,43 @@ -# AccountingAgedCreditorReport - -The Aged Creditors report shows the total balance owed by a business to its suppliers over time. - -You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - -Total assets or liabilities are grouped into 30-day periods for each supplier, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - -> It is not guaranteed that write-offs are included in the Aged Creditors report. - -## Underlying data - -The Aged Creditors report is generated from a set of required data types: [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier), [Bills](https://docs.codat.io/lending-api#/schemas/Bill), [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote), and [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). - -To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - -> The Aged Creditor report runs based on the **issue dates** of the underlying data types rather than the due date. - -## Accessing the Aged Creditors report in Portal - -Apart from returning the report via the API as JSON and query, you can also return the Aged Creditors report in the Codat portal. - -1. In the navigation bar, click **Companies**. -2. Click the name of the company you want to generate the report for. The company's data page is displayed. -3. Click the **Accounting** tab then click **Reports**. -4. Select **Aged Creditors**. -5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). -6. To run the report, click **Load aged creditors**. -7. The report is generated and displayed at the bottom of the page. - -The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding bills or bill credit notes. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | List[[shared.AgedCreditor](../../models/shared/agedcreditor.md)] | :heavy_minus_sign: | Array of aged creditor. | | -| `generated` | *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 | +# AccountingAgedCreditorReport + +The Aged Creditors report shows the total balance owed by a business to its suppliers over time. + +You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. + +Total assets or liabilities are grouped into 30-day periods for each supplier, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. + +> It is not guaranteed that write-offs are included in the Aged Creditors report. + +## Underlying data + +The Aged Creditors report is generated from a set of required data types: [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier), [Bills](https://docs.codat.io/lending-api#/schemas/Bill), [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote), and [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). + +To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. + +> The Aged Creditor report runs based on the **issue dates** of the underlying data types rather than the due date. + +## Accessing the Aged Creditors report in Portal + +Apart from returning the report via the API as JSON and query, you can also return the Aged Creditors report in the Codat portal. + +1. In the navigation bar, click **Companies**. +2. Click the name of the company you want to generate the report for. The company's data page is displayed. +3. Click the **Accounting** tab then click **Reports**. +4. Select **Aged Creditors**. +5. _(Optional)_ Edit the default reporting parameters. + a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. + b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). + b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). +6. To run the report, click **Load aged creditors**. +7. The report is generated and displayed at the bottom of the page. + +The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding bills or bill credit notes. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | List[[shared.AgedCreditor](../../models/shared/agedcreditor.md)] | :heavy_minus_sign: | Array of aged creditor. | | +| `generated` | *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 | | `report_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingageddebtorreport.md b/lending/docs/models/shared/accountingageddebtorreport.md index 6a3a67339..693f10729 100644 --- a/lending/docs/models/shared/accountingageddebtorreport.md +++ b/lending/docs/models/shared/accountingageddebtorreport.md @@ -1,43 +1,43 @@ -# AccountingAgedDebtorReport - -The Aged Debtors report shows the total outstanding balance due from customers to the business over time. - -You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - -Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - -> It is not guaranteed that write-offs are included in the Aged Debtors report. - -## Underlying data - -The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). - -To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - -> The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. - -## Accessing the Aged Debtors report in Portal - -Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. - -1. In the navigation bar, click **Companies**. -2. Click the name of the company you want to generate the report for. The company's data page is displayed. -3. Click the **Accounting** tab then click **Reports**. -4. Select **Aged Debtors**. -5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). -6. To run the report, click **Load aged debtors**. -7. The report is generated and displayed at the bottom of the page. - -The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data` | List[[shared.AgedDebtor](../../models/shared/ageddebtor.md)] | :heavy_minus_sign: | Array of aged debtors. | | -| `generated` | *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 | +# AccountingAgedDebtorReport + +The Aged Debtors report shows the total outstanding balance due from customers to the business over time. + +You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. + +Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. + +> It is not guaranteed that write-offs are included in the Aged Debtors report. + +## Underlying data + +The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). + +To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. + +> The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. + +## Accessing the Aged Debtors report in Portal + +Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. + +1. In the navigation bar, click **Companies**. +2. Click the name of the company you want to generate the report for. The company's data page is displayed. +3. Click the **Accounting** tab then click **Reports**. +4. Select **Aged Debtors**. +5. _(Optional)_ Edit the default reporting parameters. + a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. + b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). + b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). +6. To run the report, click **Load aged debtors**. +7. The report is generated and displayed at the bottom of the page. + +The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | List[[shared.AgedDebtor](../../models/shared/ageddebtor.md)] | :heavy_minus_sign: | Array of aged debtors. | | +| `generated` | *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 | | `report_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingattachment.md b/lending/docs/models/shared/accountingattachment.md index 13355934f..452feb567 100644 --- a/lending/docs/models/shared/accountingattachment.md +++ b/lending/docs/models/shared/accountingattachment.md @@ -1,33 +1,33 @@ -# AccountingAttachment - -The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. - -> **Retrieving attachments** -> -> If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. - -Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. - -Note that different integrations have different requirements to file size and extension of attachments. - -| Integration | File size | File extension | -|-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | -| QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | -| NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | -| Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | - - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `content_type` | *OptionalNullable[str]* | :heavy_minus_sign: | File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**.

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

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `file_size` | *OptionalNullable[int]* | :heavy_minus_sign: | File size in bytes. For example, if this reads **46153**, then the file size is 46kb. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the attachment, unique for the company in the accounting software. | | -| `include_when_sent` | *Optional[bool]* | :heavy_minus_sign: | If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the attachment file. | | +# AccountingAttachment + +The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. + +> **Retrieving attachments** +> +> If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. + +Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. + +Note that different integrations have different requirements to file size and extension of attachments. + +| Integration | File size | File extension | +|-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | +| QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | +| NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | +| Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | + + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `content_type` | *OptionalNullable[str]* | :heavy_minus_sign: | File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**.

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

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `file_size` | *OptionalNullable[int]* | :heavy_minus_sign: | File size in bytes. For example, if this reads **46153**, then the file size is 46kb. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the attachment, unique for the company in the accounting software. | | +| `include_when_sent` | *Optional[bool]* | :heavy_minus_sign: | If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the attachment file. | | | `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbalancesheet.md b/lending/docs/models/shared/accountingbalancesheet.md index be5738f95..b8ef41e22 100644 --- a/lending/docs/models/shared/accountingbalancesheet.md +++ b/lending/docs/models/shared/accountingbalancesheet.md @@ -1,28 +1,29 @@ -# AccountingBalanceSheet - -## Overview - -The balance sheet is a snapshot of a company's accounts at a single point in time that provides a statement of the assets, liabilities and equity of an organization. It gives interested parties an idea of the company's financial position, in addition to displaying what the company owns and owes. - -> **Balance sheet or profit and loss report?** -> -> A profit and loss report summarises the total revenue, expenses, and profit or loss during a specified time period. A balance sheet report shows the financial position of a company at a specific moment in time. - -**Structure of this report** -This report will reflect the structure and line descriptions that the business has set in their own accounting software. - -**History** -By default, Codat pulls (up to) 24 months of balance sheets for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `balanceSheet` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/update-sync-settings). - -**Want to pull this in a standardised structure?** -Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `earliest_available_month` | *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 | -| `most_recent_available_month` | *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 | +# AccountingBalanceSheet + +## Overview + +The balance sheet is a snapshot of a company's accounts at a single point in time that provides a statement of the assets, liabilities and equity of an organization. It gives interested parties an idea of the company's financial position, in addition to displaying what the company owns and owes. + +> **Balance sheet or profit and loss report?** +> +> A profit and loss report summarises the total revenue, expenses, and profit or loss during a specified time period. A balance sheet report shows the financial position of a company at a specific moment in time. + +**Structure of this report** +This report will reflect the structure and line descriptions that the business has set in their own accounting software. + +**History** +By default, Codat pulls (up to) 24 months of balance sheets for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `balanceSheet` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/update-sync-settings). + +**Want to pull this in a standardised structure?** +Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `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 | +| `earliest_available_month` | *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 | +| `most_recent_available_month` | *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 | | `reports` | List[[shared.BalanceSheet](../../models/shared/balancesheet.md)] | :heavy_check_mark: | An array of balance sheet reports. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbankaccount.md b/lending/docs/models/shared/accountingbankaccount.md index cf77d2cb1..59a68a7fe 100644 --- a/lending/docs/models/shared/accountingbankaccount.md +++ b/lending/docs/models/shared/accountingbankaccount.md @@ -1,39 +1,39 @@ -# 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/lending-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.AccountingBankAccountType]](../../models/shared/accountingbankaccounttype.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 | +# 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/lending-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.AccountingBankAccountType]](../../models/shared/accountingbankaccounttype.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 diff --git a/lending/docs/models/shared/accountingbankaccounts.md b/lending/docs/models/shared/accountingbankaccounts.md index 0adf8f119..905c3aa38 100644 --- a/lending/docs/models/shared/accountingbankaccounts.md +++ b/lending/docs/models/shared/accountingbankaccounts.md @@ -1,12 +1,12 @@ -# AccountingBankAccounts - - -## 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 | | +# AccountingBankAccounts + + +## 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/lending/docs/models/shared/accountingbankaccounttype.md b/lending/docs/models/shared/accountingbankaccounttype.md index 9b96fbfd9..d0175c298 100644 --- a/lending/docs/models/shared/accountingbankaccounttype.md +++ b/lending/docs/models/shared/accountingbankaccounttype.md @@ -1,22 +1,22 @@ -# AccountingBankAccountType - -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_lending.models.shared import AccountingBankAccountType - -value = AccountingBankAccountType.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `UNKNOWN` | Unknown | -| `CREDIT` | Credit | +# AccountingBankAccountType + +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_lending.models.shared import AccountingBankAccountType + +value = AccountingBankAccountType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `CREDIT` | Credit | | `DEBIT` | Debit | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbanktransaction.md b/lending/docs/models/shared/accountingbanktransaction.md index 384abc434..0ac8477f4 100644 --- a/lending/docs/models/shared/accountingbanktransaction.md +++ b/lending/docs/models/shared/accountingbanktransaction.md @@ -1,32 +1,32 @@ -# AccountingBankTransaction - -> **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: Transaction](https://docs.codat.io/lending-api#/operations/list-transactions) data type. - -## Overview - -Transactional banking data for a specific company and account. - -Bank transactions include the: -* Amount of the transaction. -* Current account balance. -* Transaction type, for example, credit, debit, or transfer. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier to the `accountId` the bank transactions originates from. | | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | | -| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. | | -| `cleared_on_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 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the bank transaction. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank transaction, unique to the company in the accounting software. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# AccountingBankTransaction + +> **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: Transaction](https://docs.codat.io/lending-api#/operations/list-transactions) data type. + +## Overview + +Transactional banking data for a specific company and account. + +Bank transactions include the: +* Amount of the transaction. +* Current account balance. +* Transaction type, for example, credit, debit, or transfer. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier to the `accountId` the bank transactions originates from. | | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. | | +| `cleared_on_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 | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the bank transaction. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank transaction, unique to the company in the accounting software. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `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/lending/docs/models/shared/accountingbanktransactions.md b/lending/docs/models/shared/accountingbanktransactions.md index 858c4832a..8a831bb47 100644 --- a/lending/docs/models/shared/accountingbanktransactions.md +++ b/lending/docs/models/shared/accountingbanktransactions.md @@ -1,12 +1,12 @@ -# AccountingBankTransactions - - -## 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.AccountingBankTransaction]](../../models/shared/accountingbanktransaction.md)] | :heavy_minus_sign: | N/A | | +# AccountingBankTransactions + + +## 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.AccountingBankTransaction]](../../models/shared/accountingbanktransaction.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/lending/docs/models/shared/accountingbill.md b/lending/docs/models/shared/accountingbill.md index c4c43639c..5377225cf 100644 --- a/lending/docs/models/shared/accountingbill.md +++ b/lending/docs/models/shared/accountingbill.md @@ -1,46 +1,46 @@ -# AccountingBill - -> **Invoices or bills?** -> -> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. -> -> See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. - -## Overview - -In Codat, a bill contains details of: -* When the bill was recorded in the accounting system. -* How much the bill is for and the currency of the amount. -* Who the bill was received from — the *supplier*. -* What the bill is for — the *line items*. - -Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. - -You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount_due` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount outstanding on the bill. | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `due_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill, unique for the company in the accounting software. | | -| `issue_date` | *str* | :heavy_check_mark: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `line_items` | List[[shared.BillLineItem](../../models/shared/billlineitem.md)] | :heavy_minus_sign: | Array of Bill line items. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any private, company notes about the bill, such as payment information. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | -| `purchase_order_refs` | List[[shared.PurchaseOrderReference](../../models/shared/purchaseorderreference.md)] | :heavy_minus_sign: | N/A | | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the bill. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.BillStatus](../../models/shared/billstatus.md) | :heavy_check_mark: | Current state of the bill. | | -| `sub_total` | *Decimal* | :heavy_check_mark: | Total amount of the bill, excluding any taxes. | | -| `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. | | -| `supplier_ref` | [Optional[shared.SupplierRef]](../../models/shared/supplierref.md) | :heavy_minus_sign: | Reference to the supplier the record relates to. | | -| `tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax on the bill. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | Amount of the bill, including tax. | | +# AccountingBill + +> **Invoices or bills?** +> +> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. +> +> See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. + +## Overview + +In Codat, a bill contains details of: +* When the bill was recorded in the accounting system. +* How much the bill is for and the currency of the amount. +* Who the bill was received from — the *supplier*. +* What the bill is for — the *line items*. + +Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. + +You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount_due` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount outstanding on the bill. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `due_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill, unique for the company in the accounting software. | | +| `issue_date` | *str* | :heavy_check_mark: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `line_items` | List[[shared.BillLineItem](../../models/shared/billlineitem.md)] | :heavy_minus_sign: | Array of Bill line items. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any private, company notes about the bill, such as payment information. | | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | +| `purchase_order_refs` | List[[shared.PurchaseOrderReference](../../models/shared/purchaseorderreference.md)] | :heavy_minus_sign: | N/A | | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the bill. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.BillStatus](../../models/shared/billstatus.md) | :heavy_check_mark: | Current state of the bill. | | +| `sub_total` | *Decimal* | :heavy_check_mark: | Total amount of the bill, excluding any taxes. | | +| `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. | | +| `supplier_ref` | [Optional[shared.SupplierRef]](../../models/shared/supplierref.md) | :heavy_minus_sign: | Reference to the supplier the record relates to. | | +| `tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax on the bill. | | +| `total_amount` | *Decimal* | :heavy_check_mark: | Amount of the bill, including tax. | | | `withholding_tax` | List[[shared.WithholdingTax](../../models/shared/withholdingtax.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbillcreditnote.md b/lending/docs/models/shared/accountingbillcreditnote.md index a53b23839..4901a708e 100644 --- a/lending/docs/models/shared/accountingbillcreditnote.md +++ b/lending/docs/models/shared/accountingbillcreditnote.md @@ -1,45 +1,45 @@ -# AccountingBillCreditNote - -> **Bill credit notes or credit notes?** -> -> In Codat, bill credit notes represent accounts payable only. For accounts receivable, see [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - -## Overview - -A bill credit note is issued by a supplier for the purpose of recording credit. For example, if a supplier was unable to fulfil an order that was placed by a business, or delivered damaged goods, they would issue a bill credit note. A bill credit note reduces the amount a business owes to the supplier. It can be refunded to the business or used to pay off future bills. - -In the Codat API, a bill credit note is an accounts payable record issued by a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier). - -A bill credit note includes details of: -* The original and remaining credit. -* Any allocations of the credit against other records, such as [bills](https://docs.codat.io/lending-api#/schemas/Bill). -* The supplier that issued the bill credit note. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allocated_on_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 | -| `bill_credit_note_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the bill credit note. | 91fe2a83-e161-4c21-929d-c5c10c4b07e5 | -| `created_from_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | An array of records the credit note was created from. | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `discount_percentage` | *Decimal* | :heavy_check_mark: | Percentage rate of any discount applied to the bill credit note. | 0 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill credit note that is unique to a company in the accounting software. | 1509398f-98e2-436d-8a5d-c042e0c74ffc | -| `issue_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 | -| `line_items` | List[[shared.BillCreditNoteLineItem](../../models/shared/billcreditnotelineitem.md)] | :heavy_minus_sign: | An array of line | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the bill credit note. | Bill Credit Note with 1 line items, totaling 805.78 | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | -| `remaining_credit` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the bill credit note that is still outstanding. | 0 | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.BillCreditNoteStatus](../../models/shared/billcreditnotestatus.md) | :heavy_check_mark: | Current state of the bill credit note | Paid | -| `sub_total` | *Decimal* | :heavy_check_mark: | Total amount of the bill credit note, including discounts but excluding tax. | 805.78 | -| `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. | | -| `supplier_ref` | [Optional[shared.SupplierRef]](../../models/shared/supplierref.md) | :heavy_minus_sign: | Reference to the supplier the record relates to. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | Total amount of credit that has been applied to the business' account with the supplier, including discounts and tax. | 805.78 | -| `total_discount` | *Decimal* | :heavy_check_mark: | Total value of any discounts applied. | 0 | -| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax included in the bill credit note. | 0 | +# AccountingBillCreditNote + +> **Bill credit notes or credit notes?** +> +> In Codat, bill credit notes represent accounts payable only. For accounts receivable, see [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). + +## Overview + +A bill credit note is issued by a supplier for the purpose of recording credit. For example, if a supplier was unable to fulfil an order that was placed by a business, or delivered damaged goods, they would issue a bill credit note. A bill credit note reduces the amount a business owes to the supplier. It can be refunded to the business or used to pay off future bills. + +In the Codat API, a bill credit note is an accounts payable record issued by a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier). + +A bill credit note includes details of: +* The original and remaining credit. +* Any allocations of the credit against other records, such as [bills](https://docs.codat.io/lending-api#/schemas/Bill). +* The supplier that issued the bill credit note. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allocated_on_date` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-09-15T16:35:00 | +| `bill_credit_note_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the bill credit note. | 91fe2a83-e161-4c21-929d-c5c10c4b07e5 | +| `created_from_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | An array of records the credit note was created from. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `discount_percentage` | *Decimal* | :heavy_check_mark: | Percentage rate of any discount applied to the bill credit note. | 0 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill credit note that is unique to a company in the accounting software. | 1509398f-98e2-436d-8a5d-c042e0c74ffc | +| `issue_date` | *Optional[str]* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-03-15T00:00:00 | +| `line_items` | List[[shared.BillCreditNoteLineItem](../../models/shared/billcreditnotelineitem.md)] | :heavy_minus_sign: | An array of line | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the bill credit note. | Bill Credit Note with 1 line items, totaling 805.78 | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | +| `remaining_credit` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the bill credit note that is still outstanding. | 0 | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.BillCreditNoteStatus](../../models/shared/billcreditnotestatus.md) | :heavy_check_mark: | Current state of the bill credit note | Paid | +| `sub_total` | *Decimal* | :heavy_check_mark: | Total amount of the bill credit note, including discounts but excluding tax. | 805.78 | +| `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. | | +| `supplier_ref` | [Optional[shared.SupplierRef]](../../models/shared/supplierref.md) | :heavy_minus_sign: | Reference to the supplier the record relates to. | | +| `total_amount` | *Decimal* | :heavy_check_mark: | Total amount of credit that has been applied to the business' account with the supplier, including discounts and tax. | 805.78 | +| `total_discount` | *Decimal* | :heavy_check_mark: | Total value of any discounts applied. | 0 | +| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax included in the bill credit note. | 0 | | `withholding_tax` | List[[shared.Items](../../models/shared/items.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbillcreditnotes.md b/lending/docs/models/shared/accountingbillcreditnotes.md index acc1f5313..a8d272ebf 100644 --- a/lending/docs/models/shared/accountingbillcreditnotes.md +++ b/lending/docs/models/shared/accountingbillcreditnotes.md @@ -1,12 +1,12 @@ -# AccountingBillCreditNotes - - -## 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.AccountingBillCreditNote]](../../models/shared/accountingbillcreditnote.md)] | :heavy_minus_sign: | N/A | | +# AccountingBillCreditNotes + + +## 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.AccountingBillCreditNote]](../../models/shared/accountingbillcreditnote.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/lending/docs/models/shared/accountingbillpayment.md b/lending/docs/models/shared/accountingbillpayment.md index 043e51d2c..fbbac537b 100644 --- a/lending/docs/models/shared/accountingbillpayment.md +++ b/lending/docs/models/shared/accountingbillpayment.md @@ -1,172 +1,172 @@ -# AccountingBillPayment - -> **Bill payments or payments?** -> -> We distinguish between transactions where the company received money vs. paid money. If the transaction represents a company spending money (accounts payable) we call this a Bill payment. -> -> See [payments](https://docs.codat.io/lending-api#/schemas/Payment) for the accounts receivable equivalent of Bill payments, which covers [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - -## Overview - -Bill payments include all accounts payable transaction data ([bills](https://docs.codat.io/lending-api#/schemas/Bill) and [credit notes against bills](https://docs.codat.io/lending-api#/schemas/BillCreditNote)). - -A bill payment in Codat usually represents an allocation of money within any customer accounts payable account. This includes, but is not strictly limited to: - -- A payment made against a bill — for example, a credit card payment, cheque payment, or cash payment. -- An allocation of a supplier's credit note to a bill or perhaps a refund. -- A bill payment made directly to an accounts payable account. This could be an overpayment or a prepayment, or a refund of a payment made directly to an accounts payable account. - -Depending on the bill payments which are allowed by the underlying accounting software, some of these types may be combined. Please see the example data section for samples of what these cases look like. - -In Codat, a bill payment contains details of: - -- When the bill payment was recorded in the accounting system. -- How much it is for and in the currency. -- Who the payment has been paid to, the _supplier_. -- The types of bill payments, the _line items_. - -Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's _expenses_. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. - -Bill payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - ---- - -## Bill payment types - -### Payment of a bill - -A payment paying a single bill should have the following properties: - -- A `totalAmount` indicating the amount of the bill that was paid. This is always positive. -- A `lines` array containing one element with the following properties: - - An `amount` equal to the `totalAmount` above. - - A `links` array containing one element with the following properties: - - A `type` indicating the type of link, in this case a `Bill`. - - An `id` containing the ID of the bill that was paid. - - An amount of `-totalAmount` (negative `totalAmount`), indicating that the entirety of the paid amount is allocated to the bill. - -### Payment of multiple bills - -It is possible for one payment to pay multiple bills. This can be represented using two possible formats, depending on how the supplier keeps their books: - -1. The payment has multiple entries in its **lines** array, one for each bill that is paid. Each line will follow the above example for paying a bill, and the rules detailed in the data model. -2. The payment has a line with multiple links to each bill. This occurs when the proportion of the original payment allocated to each bill is not available. - -Each line is the same as those described above, with the **amount** indicating how much of the payment is allocated to the bill. The **amount** on the lines sum to the **totalAmount** on the payment. - -> Pushing batch payments to Xero -> -> When pushing a single bill payment to Xero to pay multiple bills, only the first format is supported—multiple entries in the payment **lines** array. - -### Payments and refunds on account - -A payment on account, that is a payment that doesn’t pay a specific bill, has one entry in its lines array. - -The line has the following properties: - -- A **totalAmount** indicating the amount paid by a supplier or refunded to them by a company. A payment to the supplier is always negative. A refund is always positive. -- A **links** array containing one element with the following properties: - - A **type** indicating the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the supplier. - - An amount for the link is `0` **totalAmount** or the amount of the payment or refund. - -It is possible to have a payment that is part on account and part allocated to a bill. Each line should follow the examples above. - -### Using a credit note to pay a bill - -The payment of a bill using a credit note has one entry in its `lines` array. This **line** has the following properties: - -- An **amount** indicating the amount of money moved, which in this case is `0`, as the credit note and bill allocation must balance each other. -- A **links** array containing two elements: - - The first link has: - - A **type** indicating the type of link, in this case a `Bill`. - - An **id** containing the ID of the bill that was paid. - - The second link has: - - A **type** indicating the type of link, in this case a `CreditNote`. - - An **id** containing the ID of the credit note used by this payment. - -The **amount** field on the **line** equals the **totalAmount** on the payment. - -### Refunding a credit note - -A bill payment refunding a credit note has one entry in its **lines** array. This line has the following properties: - -- An **amount** indicating the amount of the credit note that was refunded. This is always negative, indicating that it is a refund. -- A **links** array containing one element with the following properties: - - A **type** indicating the type of `link`, in this case a `CreditNote`. - - An **id** containing the ID of the credit note that was refunded. - -The **totalAmount** field on the payment equals the line's **amount** field. These are both negative, as this is money leaving accounts payable. - -### Refunding a payment - -If a payment is refunded, for example, when a company overpaid a bill and the overpayment is returned, there are two payment records: - -- One for the incoming overpayment. -- Another for the outgoing refund. - -The payment issuing the refund is identified by the fact that the **totalAmount** is negative. This payment has one entry in its lines array that have the following properties: - -- An **amount** indicating the amount that was refunded. This is always negative. -- A **links** array containing one element with the following properties: - - A **type** indicating the type of a the link, in this case a `BillPayment`. - - An **id** containing the ID of the payment that was refunded. - -The **amount** field on the line equals the **totalAmount** on the payment and is negative as this is money leaving accounts payable. - -The payment that was refunded can be identified as it has a line where the `amount` on its `line` is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was partly used to pay an bill. For example, a £1,050 payment paying a £1,000 bill with a refund of £50 has two lines: - -- One for £1,000 linked to the bill that was paid -- Another for £50 linked to the payment that refunded the over payment. This link is of type `Refund` but the ID corresponds to a bill payment. - -The line linked to the bill payment has the following properties: - -- An **amount** indicating the amount that was refunded. This is positive as its money that was added to accounts payable, but is balanced out by the negative amount of the refund. -- A **links** array containing one element with the following properties: - - A **type** indicating the type of the link, in this case a `Refund`. - - An **id** containing the ID of the payment that refunded this line. - -> Linked payments -> -> Not all accounting software support linked payments in this way. In these platforms you may see a payment on account and a refund on account. - -## Foreign currencies - -There are two types of currency rate that are detailed in the bill payments data type: - -Payment currency rate: - -- Base currency of the accounts payable account. -- Foreign currency of the bill payment. - -Payment line link currency rate: - -- Base currency of the item that the link represents. -- Foreign currency of the payment. - -These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a bill payment is applied to an item in a currency that does not match either: - -- The base currency for the accounts payable account. -- The currency of the item. - - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | | -| `currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `date_` | *str* | :heavy_check_mark: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill payment, unique for the company in the accounting software. | 3d5a8e00-d108-4045-8823-7f342676cffa | -| `lines` | List[[shared.BillPaymentLine](../../models/shared/billpaymentline.md)] | :heavy_minus_sign: | An array of bill payment lines. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44 | -| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | N/A | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | -| `supplier_ref` | [Optional[shared.SupplierRef]](../../models/shared/supplierref.md) | :heavy_minus_sign: | N/A | | +# AccountingBillPayment + +> **Bill payments or payments?** +> +> We distinguish between transactions where the company received money vs. paid money. If the transaction represents a company spending money (accounts payable) we call this a Bill payment. +> +> See [payments](https://docs.codat.io/lending-api#/schemas/Payment) for the accounts receivable equivalent of Bill payments, which covers [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). + +## Overview + +Bill payments include all accounts payable transaction data ([bills](https://docs.codat.io/lending-api#/schemas/Bill) and [credit notes against bills](https://docs.codat.io/lending-api#/schemas/BillCreditNote)). + +A bill payment in Codat usually represents an allocation of money within any customer accounts payable account. This includes, but is not strictly limited to: + +- A payment made against a bill — for example, a credit card payment, cheque payment, or cash payment. +- An allocation of a supplier's credit note to a bill or perhaps a refund. +- A bill payment made directly to an accounts payable account. This could be an overpayment or a prepayment, or a refund of a payment made directly to an accounts payable account. + +Depending on the bill payments which are allowed by the underlying accounting software, some of these types may be combined. Please see the example data section for samples of what these cases look like. + +In Codat, a bill payment contains details of: + +- When the bill payment was recorded in the accounting system. +- How much it is for and in the currency. +- Who the payment has been paid to, the _supplier_. +- The types of bill payments, the _line items_. + +Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's _expenses_. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. + +Bill payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + +--- + +## Bill payment types + +### Payment of a bill + +A payment paying a single bill should have the following properties: + +- A `totalAmount` indicating the amount of the bill that was paid. This is always positive. +- A `lines` array containing one element with the following properties: + - An `amount` equal to the `totalAmount` above. + - A `links` array containing one element with the following properties: + - A `type` indicating the type of link, in this case a `Bill`. + - An `id` containing the ID of the bill that was paid. + - An amount of `-totalAmount` (negative `totalAmount`), indicating that the entirety of the paid amount is allocated to the bill. + +### Payment of multiple bills + +It is possible for one payment to pay multiple bills. This can be represented using two possible formats, depending on how the supplier keeps their books: + +1. The payment has multiple entries in its **lines** array, one for each bill that is paid. Each line will follow the above example for paying a bill, and the rules detailed in the data model. +2. The payment has a line with multiple links to each bill. This occurs when the proportion of the original payment allocated to each bill is not available. + +Each line is the same as those described above, with the **amount** indicating how much of the payment is allocated to the bill. The **amount** on the lines sum to the **totalAmount** on the payment. + +> Pushing batch payments to Xero +> +> When pushing a single bill payment to Xero to pay multiple bills, only the first format is supported—multiple entries in the payment **lines** array. + +### Payments and refunds on account + +A payment on account, that is a payment that doesn’t pay a specific bill, has one entry in its lines array. + +The line has the following properties: + +- A **totalAmount** indicating the amount paid by a supplier or refunded to them by a company. A payment to the supplier is always negative. A refund is always positive. +- A **links** array containing one element with the following properties: + - A **type** indicating the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. + - The **id** containing the ID of the supplier. + - An amount for the link is `0` **totalAmount** or the amount of the payment or refund. + +It is possible to have a payment that is part on account and part allocated to a bill. Each line should follow the examples above. + +### Using a credit note to pay a bill + +The payment of a bill using a credit note has one entry in its `lines` array. This **line** has the following properties: + +- An **amount** indicating the amount of money moved, which in this case is `0`, as the credit note and bill allocation must balance each other. +- A **links** array containing two elements: + - The first link has: + - A **type** indicating the type of link, in this case a `Bill`. + - An **id** containing the ID of the bill that was paid. + - The second link has: + - A **type** indicating the type of link, in this case a `CreditNote`. + - An **id** containing the ID of the credit note used by this payment. + +The **amount** field on the **line** equals the **totalAmount** on the payment. + +### Refunding a credit note + +A bill payment refunding a credit note has one entry in its **lines** array. This line has the following properties: + +- An **amount** indicating the amount of the credit note that was refunded. This is always negative, indicating that it is a refund. +- A **links** array containing one element with the following properties: + - A **type** indicating the type of `link`, in this case a `CreditNote`. + - An **id** containing the ID of the credit note that was refunded. + +The **totalAmount** field on the payment equals the line's **amount** field. These are both negative, as this is money leaving accounts payable. + +### Refunding a payment + +If a payment is refunded, for example, when a company overpaid a bill and the overpayment is returned, there are two payment records: + +- One for the incoming overpayment. +- Another for the outgoing refund. + +The payment issuing the refund is identified by the fact that the **totalAmount** is negative. This payment has one entry in its lines array that have the following properties: + +- An **amount** indicating the amount that was refunded. This is always negative. +- A **links** array containing one element with the following properties: + - A **type** indicating the type of a the link, in this case a `BillPayment`. + - An **id** containing the ID of the payment that was refunded. + +The **amount** field on the line equals the **totalAmount** on the payment and is negative as this is money leaving accounts payable. + +The payment that was refunded can be identified as it has a line where the `amount` on its `line` is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was partly used to pay an bill. For example, a £1,050 payment paying a £1,000 bill with a refund of £50 has two lines: + +- One for £1,000 linked to the bill that was paid +- Another for £50 linked to the payment that refunded the over payment. This link is of type `Refund` but the ID corresponds to a bill payment. + +The line linked to the bill payment has the following properties: + +- An **amount** indicating the amount that was refunded. This is positive as its money that was added to accounts payable, but is balanced out by the negative amount of the refund. +- A **links** array containing one element with the following properties: + - A **type** indicating the type of the link, in this case a `Refund`. + - An **id** containing the ID of the payment that refunded this line. + +> Linked payments +> +> Not all accounting software support linked payments in this way. In these platforms you may see a payment on account and a refund on account. + +## Foreign currencies + +There are two types of currency rate that are detailed in the bill payments data type: + +Payment currency rate: + +- Base currency of the accounts payable account. +- Foreign currency of the bill payment. + +Payment line link currency rate: + +- Base currency of the item that the link represents. +- Foreign currency of the payment. + +These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a bill payment is applied to an item in a currency that does not match either: + +- The base currency for the accounts payable account. +- The currency of the item. + + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | | +| `currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `date_` | *str* | :heavy_check_mark: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bill payment, unique for the company in the accounting software. | 3d5a8e00-d108-4045-8823-7f342676cffa | +| `lines` | List[[shared.BillPaymentLine](../../models/shared/billpaymentline.md)] | :heavy_minus_sign: | An array of bill payment lines. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | Bill Payment against bill c13e37b6-dfaa-4894-b3be-9fe97bda9f44 | +| `payment_method_ref` | [Optional[shared.AccountingBillPaymentAllOfPaymentMethodRef]](../../models/shared/accountingbillpaymentallofpaymentmethodref.md) | :heavy_minus_sign: | N/A | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Additional information associated with the payment. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | +| `supplier_ref` | [Optional[shared.AccountingBillPaymentAllOfSupplierRef]](../../models/shared/accountingbillpaymentallofsupplierref.md) | :heavy_minus_sign: | N/A | | | `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the payment in the payment currency. This value never changes and represents the amount of money that is paid into the supplier's account. | 1329.54 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingbillpayments.md b/lending/docs/models/shared/accountingbillpayments.md index 974e71876..93b39e4e3 100644 --- a/lending/docs/models/shared/accountingbillpayments.md +++ b/lending/docs/models/shared/accountingbillpayments.md @@ -1,12 +1,12 @@ -# AccountingBillPayments - - -## 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.AccountingBillPayment]](../../models/shared/accountingbillpayment.md)] | :heavy_minus_sign: | N/A | | +# AccountingBillPayments + + +## 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.AccountingBillPayment]](../../models/shared/accountingbillpayment.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/lending/docs/models/shared/accountingbills.md b/lending/docs/models/shared/accountingbills.md index ec2c190ed..a3fd2e028 100644 --- a/lending/docs/models/shared/accountingbills.md +++ b/lending/docs/models/shared/accountingbills.md @@ -1,12 +1,12 @@ -# AccountingBills - - -## 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.AccountingBill]](../../models/shared/accountingbill.md)] | :heavy_minus_sign: | N/A | | +# AccountingBills + + +## 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.AccountingBill]](../../models/shared/accountingbill.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/lending/docs/models/shared/accountingcashflowstatement.md b/lending/docs/models/shared/accountingcashflowstatement.md index 2488424de..c930c067b 100644 --- a/lending/docs/models/shared/accountingcashflowstatement.md +++ b/lending/docs/models/shared/accountingcashflowstatement.md @@ -1,25 +1,25 @@ -# AccountingCashFlowStatement - -> **Operating activities only** -> -> Currently, the cash flow statement shows cash that flows into and out of the company from operating activities *only*. Operating activities generate cash from the sale of goods or services. - -## Overview - -A cash flow statement is a financial report that records all cash that is received or spent by a company during a given period. It gives you a clearer picture of the company’s performance, and their ability to pay creditors and finance growth. - -> **Cash flow statement or balance sheet?** -> -> Look at the cash flow statement to understand a company's ability to pay its bills. Although the balance sheet may show healthy earnings at a specific point in time, the cash flow statement allows you to see whether the company is meeting its financial commitments, such as paying creditors or its employees. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `earliest_available_month` | *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 | -| `most_recent_available_month` | *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 | -| `report_basis` | [shared.ReportBasis](../../models/shared/reportbasis.md) | :heavy_check_mark: | Accounting method used when aggregating the report data. In this case, `Cash`. | | -| `report_input` | [shared.ReportInput](../../models/shared/reportinput.md) | :heavy_check_mark: | Accounting method used to prepare the cash flow statement. | | +# AccountingCashFlowStatement + +> **Operating activities only** +> +> Currently, the cash flow statement shows cash that flows into and out of the company from operating activities *only*. Operating activities generate cash from the sale of goods or services. + +## Overview + +A cash flow statement is a financial report that records all cash that is received or spent by a company during a given period. It gives you a clearer picture of the company’s performance, and their ability to pay creditors and finance growth. + +> **Cash flow statement or balance sheet?** +> +> Look at the cash flow statement to understand a company's ability to pay its bills. Although the balance sheet may show healthy earnings at a specific point in time, the cash flow statement allows you to see whether the company is meeting its financial commitments, such as paying creditors or its employees. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | +| `earliest_available_month` | *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 | +| `most_recent_available_month` | *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 | +| `report_basis` | [shared.ReportBasis](../../models/shared/reportbasis.md) | :heavy_check_mark: | Accounting method used when aggregating the report data. In this case, `Cash`. | | +| `report_input` | [shared.ReportInput](../../models/shared/reportinput.md) | :heavy_check_mark: | Accounting method used to prepare the cash flow statement. | | | `reports` | List[[shared.CashFlowStatement](../../models/shared/cashflowstatement.md)] | :heavy_check_mark: | Array of cash flow statements. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcompanyinfo.md b/lending/docs/models/shared/accountingcompanyinfo.md index 481d23308..06eee74d8 100644 --- a/lending/docs/models/shared/accountingcompanyinfo.md +++ b/lending/docs/models/shared/accountingcompanyinfo.md @@ -1,27 +1,27 @@ -# AccountingCompanyInfo - -Company info provides standard details about a linked company such as their address, phone number, and company registration. - -> **Company information or companies?** -> -> Company information is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `accounting_platform_ref` | *OptionalNullable[str]* | :heavy_minus_sign: | Identifier or reference for the company in the accounting software. | | -| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | -| `base_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. Used by the currency rate. | | -| `company_legal_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Registered legal name of the linked company. | | -| `company_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the linked company. | | -| `created_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 | -| `financial_year_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 | -| `ledger_lock_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 | -| `phone_numbers` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | An array of phone numbers. | | -| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House. | | -| `source_urls` | Dict[str, *Nullable[str]*] | :heavy_minus_sign: | URL addresses for the accounting source.

For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero). | | -| `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. | | -| `tax_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company tax number. | | +# AccountingCompanyInfo + +Company info provides standard details about a linked company such as their address, phone number, and company registration. + +> **Company information or companies?** +> +> Company information is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `accounting_platform_ref` | *OptionalNullable[str]* | :heavy_minus_sign: | Identifier or reference for the company in the accounting software. | | +| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | +| `base_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency set in the accounting software of the linked company. Used by the currency rate. | | +| `company_legal_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Registered legal name of the linked company. | | +| `company_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the linked company. | | +| `created_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 | +| `financial_year_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 | +| `ledger_lock_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 | +| `phone_numbers` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | An array of phone numbers. | | +| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House. | | +| `source_urls` | Dict[str, *str*] | :heavy_minus_sign: | URL addresses for the accounting source.

For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero). | | +| `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. | | +| `tax_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company tax number. | | | `web_links` | List[[shared.WebLink](../../models/shared/weblink.md)] | :heavy_minus_sign: | An array of weblinks. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreateaccountresponse.md b/lending/docs/models/shared/accountingcreateaccountresponse.md index fbd847cca..49291de36 100644 --- a/lending/docs/models/shared/accountingcreateaccountresponse.md +++ b/lending/docs/models/shared/accountingcreateaccountresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateAccountResponse - - -## 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.AccountingCreateAccountResponseAccountingAccount]](../../models/shared/accountingcreateaccountresponseaccountingaccount.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. | | +# AccountingCreateAccountResponse + + +## 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.AccountingCreateAccountResponseAllOfData]](../../models/shared/accountingcreateaccountresponseallofdata.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/lending/docs/models/shared/accountingcreateaccountresponseallofdata.md b/lending/docs/models/shared/accountingcreateaccountresponseallofdata.md new file mode 100644 index 000000000..ceb68b122 --- /dev/null +++ b/lending/docs/models/shared/accountingcreateaccountresponseallofdata.md @@ -0,0 +1,23 @@ +# AccountingCreateAccountResponseAllOfData + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `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. | +| `current_balance` | *Optional[Decimal]* | :heavy_minus_sign: | Current balance in the account. | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description for the account. | +| `fully_qualified_category` | *Optional[str]* | :heavy_minus_sign: | Full category of the account. For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | +| `fully_qualified_name` | *Optional[str]* | :heavy_minus_sign: | Full name of the account, for example: - `Cash On Hand` - `Rents Held In Trust` - `Fixed Asset` | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company. | +| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | +| `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. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the account. | +| `nominal_code` | *Optional[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | +| `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.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | N/A | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `type` | *Optional[str]* | :heavy_minus_sign: | The type of bank account e.g. Credit. | +| `valid_datatype_links` | List[[shared.ValidDataTypeLinks](../../models/shared/validdatatypelinks.md)] | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks). | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md b/lending/docs/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md deleted file mode 100644 index e575d41dd..000000000 --- a/lending/docs/models/shared/accountingcreateaccountresponsevaliddatatypelinks.md +++ /dev/null @@ -1,50 +0,0 @@ -# AccountingCreateAccountResponseValidDataTypeLinks - -When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - -For example, `validDatatypeLinks` might indicate the following references: - -- Which tax rates are valid to use on the line item of a bill. -- Which items can be used when creating an invoice. - -You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - -## `validDatatypeLinks` example - -The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - -```json validDatatypeLinks for an account -{ - "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", - "nominalCode": "090", - "name": "Business Bank Account", - #... - "validDatatypeLinks": [ - { - "property": "Id", - "links": [ - "Payment.AccountRef.Id", - "BillPayment.AccountRef.Id", - "DirectIncome.LineItems.AccountRef.Id", - "DirectCost.LineItems.AccountRef.Id" - ] - } - ] - } -``` - - - -## Support for `validDatatypeLinks` - -Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - -If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `links` | List[*str*] | :heavy_minus_sign: | Supported `dataTypes` that the record can be linked to. | -| `property` | *OptionalNullable[str]* | :heavy_minus_sign: | The property from the account that can be linked. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatebankaccountresponse.md b/lending/docs/models/shared/accountingcreatebankaccountresponse.md index 688a0e698..bd6d7259b 100644 --- a/lending/docs/models/shared/accountingcreatebankaccountresponse.md +++ b/lending/docs/models/shared/accountingcreatebankaccountresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateBankAccountResponse - - -## 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.AccountingCreateBankAccountResponseAccountingBankAccount]](../../models/shared/accountingcreatebankaccountresponseaccountingbankaccount.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. | | +# AccountingCreateBankAccountResponse + + +## 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.AccountingCreateBankAccountResponseAllOfData]](../../models/shared/accountingcreatebankaccountresponseallofdata.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/lending/docs/models/shared/accountingcreatetransferresponseaccountingtransfer.md b/lending/docs/models/shared/accountingcreatebankaccountresponseallofdata.md similarity index 85% rename from lending/docs/models/shared/accountingcreatetransferresponseaccountingtransfer.md rename to lending/docs/models/shared/accountingcreatebankaccountresponseallofdata.md index 525babeb7..cc7ab1cff 100644 --- a/lending/docs/models/shared/accountingcreatetransferresponseaccountingtransfer.md +++ b/lending/docs/models/shared/accountingcreatebankaccountresponseallofdata.md @@ -1,24 +1,24 @@ -# ~~AccountingCreateTransferResponseAccountingTransfer~~ - -A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - -> :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 | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `deposited_record_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer. | | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the transfer. | | -| `from_` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the transfer. | | -| `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 | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [OptionalNullable[shared.AccountingCreateTransferResponseStatus]](../../models/shared/accountingcreatetransferresponsestatus.md) | :heavy_minus_sign: | The status of the transfer in the account | | -| `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. | | -| `to` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | -| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories this transfer is being tracked against. | | \ No newline at end of file +# AccountingCreateBankAccountResponseAllOfData + + +## 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[shared.AccountingBankAccountType]](../../models/shared/accountingbankaccounttype.md) | :heavy_minus_sign: | N/A | +| `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/lending/docs/models/shared/accountingcreatebankaccounttransactions.md b/lending/docs/models/shared/accountingcreatebankaccounttransactions.md index 6b195f5fe..f86be4fc2 100644 --- a/lending/docs/models/shared/accountingcreatebankaccounttransactions.md +++ b/lending/docs/models/shared/accountingcreatebankaccounttransactions.md @@ -1,11 +1,9 @@ -# ~~AccountingCreateBankAccountTransactions~~ - -> :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_id` | *Optional[str]* | :heavy_minus_sign: | 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 | +# AccountingCreateBankAccountTransactions + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *Optional[str]* | :heavy_minus_sign: | 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.CreateBankAccountTransaction](../../models/shared/createbankaccounttransaction.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatebanktransactions.md b/lending/docs/models/shared/accountingcreatebanktransactions.md index 0b3633195..c442efbe4 100644 --- a/lending/docs/models/shared/accountingcreatebanktransactions.md +++ b/lending/docs/models/shared/accountingcreatebanktransactions.md @@ -1,9 +1,9 @@ -# AccountingCreateBankTransactions - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *Optional[str]* | :heavy_minus_sign: | 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 | +# AccountingCreateBankTransactions + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *Optional[str]* | :heavy_minus_sign: | 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.CreateBankAccountTransaction](../../models/shared/createbankaccounttransaction.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatebanktransactionsresponse.md b/lending/docs/models/shared/accountingcreatebanktransactionsresponse.md index 46e1a164b..145b2abb4 100644 --- a/lending/docs/models/shared/accountingcreatebanktransactionsresponse.md +++ b/lending/docs/models/shared/accountingcreatebanktransactionsresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateBankTransactionsResponse - - -## 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.AccountingCreateBankAccountTransactions]](../../models/shared/accountingcreatebankaccounttransactions.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. | | +# AccountingCreateBankTransactionsResponse + + +## 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.AccountingCreateBankTransactionsResponseAllOfData]](../../models/shared/accountingcreatebanktransactionsresponseallofdata.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/lending/docs/models/shared/accountingcreatedirectcostresponse.md b/lending/docs/models/shared/accountingcreatedirectcostresponse.md index 0a4b155f0..3f7f12d96 100644 --- a/lending/docs/models/shared/accountingcreatedirectcostresponse.md +++ b/lending/docs/models/shared/accountingcreatedirectcostresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateDirectCostResponse - - -## 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.AccountingCreateDirectCostResponseAccountingDirectCost]](../../models/shared/accountingcreatedirectcostresponseaccountingdirectcost.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. | | +# AccountingCreateDirectCostResponse + + +## 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.AccountingCreateDirectCostResponseAllOfData]](../../models/shared/accountingcreatedirectcostresponseallofdata.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/lending/docs/models/shared/accountingcreatedirectcostresponseaccountingdirectcost.md b/lending/docs/models/shared/accountingcreatedirectcostresponseallofdata.md similarity index 75% rename from lending/docs/models/shared/accountingcreatedirectcostresponseaccountingdirectcost.md rename to lending/docs/models/shared/accountingcreatedirectcostresponseallofdata.md index b63db3ca4..9ae60da4b 100644 --- a/lending/docs/models/shared/accountingcreatedirectcostresponseaccountingdirectcost.md +++ b/lending/docs/models/shared/accountingcreatedirectcostresponseallofdata.md @@ -1,37 +1,23 @@ -# ~~AccountingCreateDirectCostResponseAccountingDirectCost~~ - -> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - -## Overview - -Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - -Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - -Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - -> :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 | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct cost, unique for the company. | | -| `issue_date` | *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 | -| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | A note attached to the direct cost. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | | -| `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. | | -| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct costs, inclusive of tax. | | \ No newline at end of file +# AccountingCreateDirectCostResponseAllOfData + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | A customer or supplier associated with the direct cost. | +| `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. | +| `currency_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct cost, unique for the company. | +| `issue_date` | *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. | +| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | +| `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. | +| `note` | *Optional[str]* | :heavy_minus_sign: | A note attached to the direct cost. | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | +| `reference` | *Optional[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | +| `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. | +| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | +| `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct costs, inclusive of tax. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatepaymentresponse.md b/lending/docs/models/shared/accountingcreatepaymentresponse.md index 1a83e1171..8cda12986 100644 --- a/lending/docs/models/shared/accountingcreatepaymentresponse.md +++ b/lending/docs/models/shared/accountingcreatepaymentresponse.md @@ -1,21 +1,21 @@ -# AccountingCreatePaymentResponse - - -## 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.AccountingCreatePaymentResponseAccountingPayment]](../../models/shared/accountingcreatepaymentresponseaccountingpayment.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. | | +# AccountingCreatePaymentResponse + + +## 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.AccountingCreatePaymentResponseAllOfData]](../../models/shared/accountingcreatepaymentresponseallofdata.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/lending/docs/models/shared/accountingcreatepaymentresponseaccountingpayment.md b/lending/docs/models/shared/accountingcreatepaymentresponseallofdata.md similarity index 68% rename from lending/docs/models/shared/accountingcreatepaymentresponseaccountingpayment.md rename to lending/docs/models/shared/accountingcreatepaymentresponseallofdata.md index a9e967c88..57d7ba901 100644 --- a/lending/docs/models/shared/accountingcreatepaymentresponseaccountingpayment.md +++ b/lending/docs/models/shared/accountingcreatepaymentresponseallofdata.md @@ -1,701 +1,22 @@ -# ~~AccountingCreatePaymentResponseAccountingPayment~~ - -> **Payments or bill payments?** -> -> In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - -## Overview - -Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - -A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - -- A payment made against an invoice, like a credit card, cheque, or cash payment. -- An allocation of a customer's credit note, either to an invoice or maybe a refund. -- A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - -Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - -In Codat, a payment contains details of: - -- When the payment was recorded in the accounting system. -- How much it is for and in what currency that amount is in. -- Who the payment was _paid by_ – the _customer_. -- The payment method used. -- The breakdown of the types of payments – the _line items_. - -Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - -## Payment types - -## Payment of an invoice - -A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - -- An _amount_ that indicates the amount of the invoice that was paid. This is always positive. -- A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - -The **amount** field on the **line** equals the **totalAmount** on the payment. - -## Payment of multiple invoices - -A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - -- The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). -- The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - -Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - -## Payments and refunds on account - -A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - -- A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. -- A **links** array containing one element with the following properties: -- A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. -- The **id** containing the ID of the customer. -- The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - -It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - -## Using a credit note to pay an invoice - -The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - -- An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. -- A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - -The **amount** field on the **line** equals the **totalAmount** on the payment. - -## Refunding a credit note - -A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - -- An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. -- A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - -The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - -## Refunding a payment - -If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - -- One for the incoming over payment. -- Another for the outgoing refund. - -The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - -- An **amount** that indicates the amount that was refunded. This is always negative. -- A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - -The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - -The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - -For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - -- One for £1,000 linked to the invoice that was paid. -- Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - -The **line** linked to the payment has the following properties: - -- An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. -- A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - -> **Support for linked payments** -> -> Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - -## Foreign currencies - -There are two types of currency rate that are included in the payments data type: - -Payment currency rate: - -- Base currency of the accounts receivable account. -- Foreign currency of the payment. - -Payment line link currency rate: - -- Base currency of the item the link represents. -- Foreign currency of the payment. - -These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - -- The base currency for the accounts receivable account. -- The currency of the item. - - ```json title="Currency rate example" - { - "id": "123", - "note": "", - "totalAmount": 99.99, - "currency": "GBP", - "lines": [ - { - "amount": 99.99, - "links": [ - { - "type": "Invoice", - "id": "178", - "amount": -50, - "currencyRate": 1.9998 - } - ] - } - ] - } - ``` - - - -## Example data - -> **Object properties** -> -> For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - -## Simple examples - - ```json title="Payment for invoice" - { - "totalAmount": 1000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Allocation of credit note" - { - "totalAmount": 0, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Payment of invoice and payment on account" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "y", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Refund of credit note" - { - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Refund on accounts receivable account" - { - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Linked refund on accounts receivable account" - { - "id" : "payment-001", - "totalAmount": 1000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Refund", - "id" : "refund-001", - "amount" : -1000 - } - ] - } - ] - } - { - "id" : "refund-001", - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "Payment", - "id" : "payment-001", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Using a credit note and cash to pay an invoice" - { - "totalAmount": 250, - "lines": [ - { - "amount": 0, - "links": [ - { - "type": "Invoice", - "id": "x", - "amount": -750 - }, - { - "type": "CreditNote", - "id": "y", - "amount": 750 - } - ] - }, - { - "amount": 250, - "links": [ - { - "type": "Invoice", - "id": "x", - "amount": -250 - } - ] - } - ] - } - ``` - - - -## Complex examples - - ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" - { - "totalAmount": 1000, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - }, - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - }, - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "customer-001", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes pay two invoices with no allocation amount specified" - { - "totalAmount": 0, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "w", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "w", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "u", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Refund", - "id" : "refund-001", - "amount" : -1000 - } - ] - } - ] - } - { - "id" : "refund-001", - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "Payment", - "id" : "payment-001", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - -In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title="January" - { - "id": "001", - "totalAmount": 5000, - "date" : "1901-01-01", - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-x", - "amount" : -1000 - } - ] - }, - { - "amount" : 4000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "PaymentOnAccount-y", - "amount" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title="February" - { - "id": "001", - "totalAmount": 5000, - "date" : "1901-02-01", - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-y", - "amount" : -1000 - } - ] - }, - { - "amount" : 3000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "PaymentOnAccount-y", - "amount" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes and some cash pay two invoices with no allocations specified" - { - "totalAmount": 500, - "lines": [ - { - "amount": 500, - "links": [{ - "type": "Invoice", - "id": "a", - "amount": -1000 - }, { - "type": "Invoice", - "id": "b", - "amount": -1000 - }, { - "type": "CreditNote", - "id": "y", - "amount": 750 - },{ - "type": "CreditNote", - "id": "z", - "amount": 750 - } - ] - } - ] - } - ``` - -> :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_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `date_` | *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 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | | -| `lines` | List[[shared.PaymentLine](../../models/shared/paymentline.md)] | :heavy_minus_sign: | An array of payment lines. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information associated with the payment. | | -| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the payment. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | | \ No newline at end of file +# AccountingCreatePaymentResponseAllOfData + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Account the payment is recorded against in the accounting software. | +| `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. | +| `currency_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | Customer the payment is recorded against in the accounting software. | +| `date_` | *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. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | +| `lines` | List[[shared.PaymentLine](../../models/shared/paymentline.md)] | :heavy_minus_sign: | An array of payment lines. | +| `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. | +| `note` | *Optional[str]* | :heavy_minus_sign: | Any additional information associated with the payment. | +| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The Payment Method to which the payment is linked in the accounting software. | +| `reference` | *Optional[str]* | :heavy_minus_sign: | Friendly reference for the payment. | +| `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. | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatesupplierresponse.md b/lending/docs/models/shared/accountingcreatesupplierresponse.md index 95116727a..5e0a62f2b 100644 --- a/lending/docs/models/shared/accountingcreatesupplierresponse.md +++ b/lending/docs/models/shared/accountingcreatesupplierresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateSupplierResponse - - -## 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.AccountingCreateSupplierResponseAccountingSupplier]](../../models/shared/accountingcreatesupplierresponseaccountingsupplier.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} | -| `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. | | +# AccountingCreateSupplierResponse + + +## 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.AccountingCreateSupplierResponseAllOfData]](../../models/shared/accountingcreatesupplierresponseallofdata.md) | :heavy_minus_sign: | N/A | {
"id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F",
"supplierName": "Kelly's Industrial Supplies",
"contactName": "Kelly's Industrial Supplies",
"emailAddress": "sales@kellysupplies.com",
"phone": "07999 999999",
"addresses": [
{
"type": "Billing",
"line1": "Unit 51",
"line2": "Bakersfield Industrial Estate",
"city": "Bakersfield",
"region": "California",
"country": "USA",
"postalcode": "93308"
}
],
"registrationNumber": "string",
"taxNumber": "string",
"status": "Unknown",
"defaultCurrency": "string",
"metadata": {
"isDeleted": true
},
"supplementalData": {
"content": {
"property1": {
"property1": null,
"property2": null
},
"property2": {
"property1": null,
"property2": null
}
}
},
"modifiedDate": "2022-10-23T00:00:00Z",
"sourceModifiedDate": "2022-10-23T00:00:00Z"
} | +| `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/lending/docs/models/shared/accountingcreatesupplierresponseallofdata.md b/lending/docs/models/shared/accountingcreatesupplierresponseallofdata.md new file mode 100644 index 000000000..a58847aeb --- /dev/null +++ b/lending/docs/models/shared/accountingcreatesupplierresponseallofdata.md @@ -0,0 +1,21 @@ +# AccountingCreateSupplierResponseAllOfData + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | +| `contact_name` | *Optional[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | +| `default_currency` | *Optional[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | +| `email_address` | *Optional[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | +| `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. | +| `phone` | *Optional[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +| `registration_number` | *Optional[str]* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | +| `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` | [shared.SupplierStatus](../../models/shared/supplierstatus.md) | :heavy_check_mark: | N/A | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `supplier_name` | *Optional[str]* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | +| `tax_number` | *Optional[str]* | :heavy_minus_sign: | Supplier's company tax number. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatetransferresponse.md b/lending/docs/models/shared/accountingcreatetransferresponse.md index 8d5edc645..635a6dd44 100644 --- a/lending/docs/models/shared/accountingcreatetransferresponse.md +++ b/lending/docs/models/shared/accountingcreatetransferresponse.md @@ -1,21 +1,21 @@ -# AccountingCreateTransferResponse - - -## 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.AccountingCreateTransferResponseAccountingTransfer]](../../models/shared/accountingcreatetransferresponseaccountingtransfer.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. | | +# AccountingCreateTransferResponse + + +## 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.AccountingCreateTransferResponseAllOfData]](../../models/shared/accountingcreatetransferresponseallofdata.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/lending/docs/models/shared/accountingcreatetransferresponseallofdata.md b/lending/docs/models/shared/accountingcreatetransferresponseallofdata.md new file mode 100644 index 000000000..2d41ffbc8 --- /dev/null +++ b/lending/docs/models/shared/accountingcreatetransferresponseallofdata.md @@ -0,0 +1,20 @@ +# AccountingCreateTransferResponseAllOfData + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | The customer or supplier for the transfer, if available. | +| `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. | +| `deposited_record_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer. | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the transfer. | +| `from_` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | The details of the accounts the transfer is moving from. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the transfer. | +| `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. | +| `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[str]* | :heavy_minus_sign: | The status of the transfer in the account | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `to` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | The details of the accounts the transfer is moving to. | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories this transfer is being tracked against. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreatetransferresponsestatus.md b/lending/docs/models/shared/accountingcreatetransferresponsestatus.md index d0ac06b0a..7ee51ba31 100644 --- a/lending/docs/models/shared/accountingcreatetransferresponsestatus.md +++ b/lending/docs/models/shared/accountingcreatetransferresponsestatus.md @@ -1,21 +1,19 @@ -# AccountingCreateTransferResponseStatus - -The status of the transfer in the account - -## Example Usage - -```python -from codat_lending.models.shared import AccountingCreateTransferResponseStatus - -value = AccountingCreateTransferResponseStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `UNKNOWN` | Unknown | -| `UNRECONCILED` | Unreconciled | -| `RECONCILED` | Reconciled | +# AccountingCreateTransferResponseStatus + +## Example Usage + +```python +from codat_lending.models.shared import AccountingCreateTransferResponseStatus + +value = AccountingCreateTransferResponseStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `UNKNOWN` | Unknown | +| `UNRECONCILED` | Unreconciled | +| `RECONCILED` | Reconciled | | `VOID` | Void | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreditnote.md b/lending/docs/models/shared/accountingcreditnote.md index 7976f2a06..d9056ac94 100644 --- a/lending/docs/models/shared/accountingcreditnote.md +++ b/lending/docs/models/shared/accountingcreditnote.md @@ -1,42 +1,42 @@ -# AccountingCreditNote - -## Overview - -Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. - -In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/lending-api#/schemas/Customer) accounts receivable. - -It contains details of: -* The amount of credit remaining and its status. -* Payment allocations against the payments type, in this case an invoice. -* Which customers the credit notes have been issued to. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `additional_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Additional tax amount applied to credit note. | | -| `additional_tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate of any additional tax applied to the credit note. | | -| `allocated_on_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 | -| `credit_note_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the credit note. | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `discount_percentage` | *Decimal* | :heavy_check_mark: | Percentage rate (from 0 to 100) of discounts applied to the credit note. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the credit note, unique to the company in the accounting software. | | -| `issue_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 | -| `line_items` | List[[shared.CreditNoteLineItem](../../models/shared/creditnotelineitem.md)] | :heavy_minus_sign: | N/A | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | -| `remaining_credit` | *Decimal* | :heavy_check_mark: | Unused balance of totalAmount originally raised. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.CreditNoteStatus](../../models/shared/creditnotestatus.md) | :heavy_check_mark: | Current state of the credit note. | | -| `sub_total` | *Decimal* | :heavy_check_mark: | Value of the credit note, including discounts and excluding tax. | | -| `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. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | Total amount of credit that has been applied to the customer's accounts receivable | | -| `total_discount` | *Decimal* | :heavy_check_mark: | Any discounts applied to the credit note amount. | | -| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Any tax applied to the credit note amount. | | +# AccountingCreditNote + +## Overview + +Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. + +In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/lending-api#/schemas/Customer) accounts receivable. + +It contains details of: +* The amount of credit remaining and its status. +* Payment allocations against the payments type, in this case an invoice. +* Which customers the credit notes have been issued to. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Additional tax amount applied to credit note. | | +| `additional_tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate of any additional tax applied to the credit note. | | +| `allocated_on_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 | +| `credit_note_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the credit note. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | Reference to the customer the credit note has been issued to. | | +| `discount_percentage` | *Decimal* | :heavy_check_mark: | Percentage rate (from 0 to 100) of discounts applied to the credit note. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the credit note, unique to the company in the accounting software. | | +| `issue_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 | +| `line_items` | List[[shared.CreditNoteLineItem](../../models/shared/creditnotelineitem.md)] | :heavy_minus_sign: | N/A | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer. | | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | +| `remaining_credit` | *Decimal* | :heavy_check_mark: | Unused balance of totalAmount originally raised. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.CreditNoteStatus](../../models/shared/creditnotestatus.md) | :heavy_check_mark: | Current state of the credit note. | | +| `sub_total` | *Decimal* | :heavy_check_mark: | Value of the credit note, including discounts and excluding tax. | | +| `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. | | +| `total_amount` | *Decimal* | :heavy_check_mark: | Total amount of credit that has been applied to the customer's accounts receivable | | +| `total_discount` | *Decimal* | :heavy_check_mark: | Any discounts applied to the credit note amount. | | +| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Any tax applied to the credit note amount. | | | `withholding_tax` | List[[shared.Items](../../models/shared/items.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreditnotes.md b/lending/docs/models/shared/accountingcreditnotes.md index f2644a9a6..7f7eb6270 100644 --- a/lending/docs/models/shared/accountingcreditnotes.md +++ b/lending/docs/models/shared/accountingcreditnotes.md @@ -1,12 +1,12 @@ -# AccountingCreditNotes - - -## 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.AccountingCreditNote]](../../models/shared/accountingcreditnote.md)] | :heavy_minus_sign: | N/A | | +# AccountingCreditNotes + + +## 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.AccountingCreditNote]](../../models/shared/accountingcreditnote.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/lending/docs/models/shared/accountingcustomer.md b/lending/docs/models/shared/accountingcustomer.md index bc7d1347a..c39626d94 100644 --- a/lending/docs/models/shared/accountingcustomer.md +++ b/lending/docs/models/shared/accountingcustomer.md @@ -1,29 +1,29 @@ -# AccountingCustomer - -## Overview - -A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). - -Customers' data links to accounts receivable [invoices](https://docs.codat.io/lending-api#/schemas/Invoice). - - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | -| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the identified customer. | | -| `contacts` | List[[shared.Contact](../../models/shared/contact.md)] | :heavy_minus_sign: | An array of Contacts. | | -| `customer_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the customer as recorded in the accounting system, typically the company name. | | -| `default_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 | -| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address the customer can be contacted by. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | | -| `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 | -| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number the customer can be contacted by. | | -| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company number. In the UK, this is typically the Companies House company registration number. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.CustomerStatus](../../models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | -| `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. | | +# AccountingCustomer + +## Overview + +A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). + +Customers' data links to accounts receivable [invoices](https://docs.codat.io/lending-api#/schemas/Invoice). + + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | +| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the identified customer. | | +| `contacts` | List[[shared.Contact](../../models/shared/contact.md)] | :heavy_minus_sign: | An array of Contacts. | | +| `customer_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the customer as recorded in the accounting system, typically the company name. | | +| `default_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 | +| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address the customer can be contacted by. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | | +| `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 | +| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number the customer can be contacted by. | | +| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company number. In the UK, this is typically the Companies House company registration number. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.CustomerStatus](../../models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | +| `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. | | | `tax_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company tax number. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcustomerref.md b/lending/docs/models/shared/accountingcustomerref.md index 51871def0..754e91690 100644 --- a/lending/docs/models/shared/accountingcustomerref.md +++ b/lending/docs/models/shared/accountingcustomerref.md @@ -1,9 +1,9 @@ -# AccountingCustomerRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `company_name` | *OptionalNullable[str]* | :heavy_minus_sign: | `customerName` from the Customer data type | +# AccountingCustomerRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `company_name` | *OptionalNullable[str]* | :heavy_minus_sign: | `customerName` from the Customer data type | | `id` | *str* | :heavy_check_mark: | `id` from the Customers data type | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcustomers.md b/lending/docs/models/shared/accountingcustomers.md index 058b7fd35..bdeda755d 100644 --- a/lending/docs/models/shared/accountingcustomers.md +++ b/lending/docs/models/shared/accountingcustomers.md @@ -1,12 +1,12 @@ -# AccountingCustomers - - -## 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.AccountingCustomer]](../../models/shared/accountingcustomer.md)] | :heavy_minus_sign: | N/A | | +# AccountingCustomers + + +## 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.AccountingCustomer]](../../models/shared/accountingcustomer.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/lending/docs/models/shared/accountingdirectcost.md b/lending/docs/models/shared/accountingdirectcost.md index bb6da7835..2ff9b36e1 100644 --- a/lending/docs/models/shared/accountingdirectcost.md +++ b/lending/docs/models/shared/accountingdirectcost.md @@ -1,35 +1,35 @@ -# AccountingDirectCost - -> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - -## Overview - -Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - -Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - -Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct cost, unique for the company. | | -| `issue_date` | *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 | -| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | A note attached to the direct cost. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | | -| `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. | | -| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | | +# AccountingDirectCost + +> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. + +## Overview + +Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. + +Direct costs include: + * Purchasing an item and paying it off at the point of the purchase + * Receiving cash from a refunded item if the refund is made by the supplier + +Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | A customer or supplier associated with the direct cost. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct cost, unique for the company. | | +| `issue_date` | *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 | +| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | A note attached to the direct cost. | | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | | +| `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. | | +| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | | | `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct costs, inclusive of tax. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingdirectcosts.md b/lending/docs/models/shared/accountingdirectcosts.md index 1b81432a1..382cbb915 100644 --- a/lending/docs/models/shared/accountingdirectcosts.md +++ b/lending/docs/models/shared/accountingdirectcosts.md @@ -1,12 +1,12 @@ -# AccountingDirectCosts - - -## 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.AccountingDirectCost]](../../models/shared/accountingdirectcost.md)] | :heavy_minus_sign: | N/A | | +# AccountingDirectCosts + + +## 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.AccountingDirectCost]](../../models/shared/accountingdirectcost.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/lending/docs/models/shared/accountingdirectincome.md b/lending/docs/models/shared/accountingdirectincome.md index 869bf6b37..deaff7032 100644 --- a/lending/docs/models/shared/accountingdirectincome.md +++ b/lending/docs/models/shared/accountingdirectincome.md @@ -1,37 +1,37 @@ -# AccountingDirectIncome - -> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. - -## Overview - -Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes made at the point of sale. - -Direct incomes include: - -- Selling an item directly to a contact, and receiving payment at the point of the sale. -- Refunding an item sold at the point of sale in cash to a contact. - -Direct incomes is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct income, unique for the company. | | -| `issue_date` | *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 | -| `line_items` | List[[shared.DirectIncomeLineItem](../../models/shared/directincomelineitem.md)] | :heavy_check_mark: | An array of line items. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | N/A | | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct income. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct incomes, excluding any taxes. | | -| `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. | | -| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct incomes. | | +# AccountingDirectIncome + +> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. + +## Overview + +Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes made at the point of sale. + +Direct incomes include: + +- Selling an item directly to a contact, and receiving payment at the point of the sale. +- Refunding an item sold at the point of sale in cash to a contact. + +Direct incomes is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | A customer or supplier associated with the direct income. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the direct income, unique for the company. | | +| `issue_date` | *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 | +| `line_items` | List[[shared.DirectIncomeLineItem](../../models/shared/directincomelineitem.md)] | :heavy_check_mark: | An array of line items. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | An optional note on the direct income that can be used to assign the direct income with a reference ID in your application. | | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | N/A | | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct income. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct incomes, excluding any taxes. | | +| `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. | | +| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct incomes. | | | `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct incomes, inclusive of tax. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingdirectincomes.md b/lending/docs/models/shared/accountingdirectincomes.md index 5b94b42e2..00fdf0935 100644 --- a/lending/docs/models/shared/accountingdirectincomes.md +++ b/lending/docs/models/shared/accountingdirectincomes.md @@ -1,12 +1,12 @@ -# AccountingDirectIncomes - - -## 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.AccountingDirectIncome]](../../models/shared/accountingdirectincome.md)] | :heavy_minus_sign: | N/A | | +# AccountingDirectIncomes + + +## 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.AccountingDirectIncome]](../../models/shared/accountingdirectincome.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/lending/docs/models/shared/accountinginvoice.md b/lending/docs/models/shared/accountinginvoice.md index c16e20474..26dc24555 100644 --- a/lending/docs/models/shared/accountinginvoice.md +++ b/lending/docs/models/shared/accountinginvoice.md @@ -1,61 +1,61 @@ -# AccountingInvoice - -> **Invoices or bills?** -> -> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. -> -> See [Bills](https://docs.codat.io/lending-api#/schemas/Bill) for the accounts payable equivalent of bills. - -## Overview - -An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/lending-api#/schemas/Customer). - -In Codat, an invoice contains details of: - -- The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. -- How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. -- Who the invoice has been raised to; the _customer_. -- The breakdown of what the invoice is for; the _line items_. -- Any [payments](https://docs.codat.io/lending-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. - -> **Invoice PDF downloads** -> -> You can download a PDF version of an invoice for supported integrations. -> -> The filename will be invoice-{number}.pdf. - -> **Referencing an invoice in Sage 50 and ClearBooks** -> -> In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `additional_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Additional tax amount applied to invoice. | | -| `additional_tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate of any additional tax applied to the invoice. | | -| `amount_due` | *Decimal* | :heavy_check_mark: | Amount outstanding on the invoice. | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. | | -| `due_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: | Identifier for the invoice, unique to the company in the accounting software. | | -| `invoice_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. | | -| `issue_date` | *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 | -| `line_items` | List[[shared.InvoiceLineItem](../../models/shared/invoicelineitem.md)] | :heavy_minus_sign: | An array of line items. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. | | -| `paid_on_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 | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | -| `sales_order_refs` | List[[shared.SalesOrderReference](../../models/shared/salesorderreference.md)] | :heavy_minus_sign: | List of references to related Sales orders. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.InvoiceStatus](../../models/shared/invoicestatus.md) | :heavy_check_mark: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`.
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`.
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the invoice excluding any taxes. | | -| `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. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | Amount of the invoice, inclusive of tax. | | -| `total_discount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of discounts applied to the invoice. | | -| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax on the invoice. | | +# AccountingInvoice + +> **Invoices or bills?** +> +> We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. +> +> See [Bills](https://docs.codat.io/lending-api#/schemas/Bill) for the accounts payable equivalent of bills. + +## Overview + +An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/lending-api#/schemas/Customer). + +In Codat, an invoice contains details of: + +- The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. +- How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. +- Who the invoice has been raised to; the _customer_. +- The breakdown of what the invoice is for; the _line items_. +- Any [payments](https://docs.codat.io/lending-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. + +> **Invoice PDF downloads** +> +> You can download a PDF version of an invoice for supported integrations. +> +> The filename will be invoice-{number}.pdf. + +> **Referencing an invoice in Sage 50 and ClearBooks** +> +> In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Additional tax amount applied to invoice. | | +| `additional_tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate of any additional tax applied to the invoice. | | +| `amount_due` | *Decimal* | :heavy_check_mark: | Amount outstanding on the invoice. | | +| `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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | Reference to the customer the invoice has been issued to. | | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`. | | +| `due_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: | Identifier for the invoice, unique to the company in the accounting software. | | +| `invoice_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the invoice. If available, this appears in the file name of invoice attachments. | | +| `issue_date` | *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 | +| `line_items` | List[[shared.InvoiceLineItem](../../models/shared/invoicelineitem.md)] | :heavy_minus_sign: | An array of line items. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer. | | +| `paid_on_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 | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_minus_sign: | An array of payment allocations. | | +| `sales_order_refs` | List[[shared.SalesOrderReference](../../models/shared/salesorderreference.md)] | :heavy_minus_sign: | List of references to related Sales orders. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.InvoiceStatus](../../models/shared/invoicestatus.md) | :heavy_check_mark: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`.
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`.
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the invoice excluding any taxes. | | +| `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. | | +| `total_amount` | *Decimal* | :heavy_check_mark: | Amount of the invoice, inclusive of tax. | | +| `total_discount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of discounts applied to the invoice. | | +| `total_tax_amount` | *Decimal* | :heavy_check_mark: | Amount of tax on the invoice. | | | `withholding_tax` | List[[shared.Items](../../models/shared/items.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountinginvoicedatatype.md b/lending/docs/models/shared/accountinginvoicedatatype.md index eec47c5f5..14bb4fa61 100644 --- a/lending/docs/models/shared/accountinginvoicedatatype.md +++ b/lending/docs/models/shared/accountinginvoicedatatype.md @@ -1,18 +1,16 @@ -# AccountingInvoiceDataType - -The underlying data type associated to the reference `id`. - -## Example Usage - -```python -from codat_lending.models.shared import AccountingInvoiceDataType - -value = AccountingInvoiceDataType.SALES_ORDERS -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | +# AccountingInvoiceDataType + +## Example Usage + +```python +from codat_lending.models.shared import AccountingInvoiceDataType + +value = AccountingInvoiceDataType.SALES_ORDERS +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | | `SALES_ORDERS` | salesOrders | \ No newline at end of file diff --git a/lending/docs/models/shared/accountinginvoices.md b/lending/docs/models/shared/accountinginvoices.md index d6895e998..4aa13ea7f 100644 --- a/lending/docs/models/shared/accountinginvoices.md +++ b/lending/docs/models/shared/accountinginvoices.md @@ -1,12 +1,12 @@ -# AccountingInvoices - - -## 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.AccountingInvoice]](../../models/shared/accountinginvoice.md)] | :heavy_minus_sign: | N/A | | +# AccountingInvoices + + +## 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.AccountingInvoice]](../../models/shared/accountinginvoice.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/lending/docs/models/shared/accountingjournal.md b/lending/docs/models/shared/accountingjournal.md index da940c937..4de140b5f 100644 --- a/lending/docs/models/shared/accountingjournal.md +++ b/lending/docs/models/shared/accountingjournal.md @@ -1,40 +1,40 @@ -# AccountingJournal - -> **Language tip:** For line items, or individual transactions, of a company's financial documents, refer to the [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) data type - -## Overview - -In accounting software, journals are used to record all the financial transactions of a company. Each transaction in a journal is represented by a separate [journal entry](https://docs.codat.io/lending-api#/schemas/JournalEntry). These entries are used to create the general ledger, which is then used to create the financial statements of a business. - -When a company records all their transactions in a single journal, it can become large and difficult to maintain and track. This is why large companies often use multiple journals (also known as subjournals) to categorize and manage journal entries. - -Such journals can be divided into two categories: - -- Special journals: journals used to record specific types of transactions; for example, a purchases journal, a sales journal, or a cash management journal. -- General journals: journals used to record transactions that fall outside the scope of the special journals. - -Multiple journals or subjournals are used in the following Codat integrations: - -- [Sage Intacct](https://docs.codat.io/integrations/accounting/sage-intacct/accounting-sage-intacct) (mandatory) -- [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) -- [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) - -> When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. - - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created_on` | *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 | -| `has_children` | *Optional[bool]* | :heavy_minus_sign: | If the journal has child journals, this value is true. If it doesn’t, it is false. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Journal ID. | | -| `journal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Native journal number or code. | | -| `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 | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Journal name.
The maximum length for a journal name is 256 characters. All characters above that number will be truncated. | | -| `parent_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Parent journal ID.
If the journal is a parent journal, this value is not present. | | -| `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.JournalStatus]](../../models/shared/journalstatus.md) | :heavy_minus_sign: | Current journal status. | | +# AccountingJournal + +> **Language tip:** For line items, or individual transactions, of a company's financial documents, refer to the [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) data type + +## Overview + +In accounting software, journals are used to record all the financial transactions of a company. Each transaction in a journal is represented by a separate [journal entry](https://docs.codat.io/lending-api#/schemas/JournalEntry). These entries are used to create the general ledger, which is then used to create the financial statements of a business. + +When a company records all their transactions in a single journal, it can become large and difficult to maintain and track. This is why large companies often use multiple journals (also known as subjournals) to categorize and manage journal entries. + +Such journals can be divided into two categories: + +- Special journals: journals used to record specific types of transactions; for example, a purchases journal, a sales journal, or a cash management journal. +- General journals: journals used to record transactions that fall outside the scope of the special journals. + +Multiple journals or subjournals are used in the following Codat integrations: + +- [Sage Intacct](https://docs.codat.io/integrations/accounting/sage-intacct/accounting-sage-intacct) (mandatory) +- [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) +- [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) + +> When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. + + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_on` | *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 | +| `has_children` | *Optional[bool]* | :heavy_minus_sign: | If the journal has child journals, this value is true. If it doesn’t, it is false. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Journal ID. | | +| `journal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Native journal number or code. | | +| `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 | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Journal name.
The maximum length for a journal name is 256 characters. All characters above that number will be truncated. | | +| `parent_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Parent journal ID.
If the journal is a parent journal, this value is not present. | | +| `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.JournalStatus]](../../models/shared/journalstatus.md) | :heavy_minus_sign: | Current journal status. | | | `type` | *OptionalNullable[str]* | :heavy_minus_sign: | The type of the journal. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingjournalentries.md b/lending/docs/models/shared/accountingjournalentries.md index 00e8ed8de..f84280d75 100644 --- a/lending/docs/models/shared/accountingjournalentries.md +++ b/lending/docs/models/shared/accountingjournalentries.md @@ -1,12 +1,12 @@ -# AccountingJournalEntries - - -## 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.AccountingJournalEntry]](../../models/shared/accountingjournalentry.md)] | :heavy_minus_sign: | N/A | | +# AccountingJournalEntries + + +## 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.AccountingJournalEntry]](../../models/shared/accountingjournalentry.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/lending/docs/models/shared/accountingjournalentry.md b/lending/docs/models/shared/accountingjournalentry.md index e803a5d4e..06faef91c 100644 --- a/lending/docs/models/shared/accountingjournalentry.md +++ b/lending/docs/models/shared/accountingjournalentry.md @@ -1,40 +1,40 @@ -# AccountingJournalEntry - -> **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/lending-api#/schemas/Journal) data type - -## Overview - -A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/lending-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. - -A journal entry line item is a single transaction line on the journal entry. For example: - -- When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. -- When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. - -In Codat a journal entry contains details of: - -- The date on which the entry was created and posted. -- Itemised lines, including amounts and currency. -- A reference to the associated accounts. -- A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. - -> **Pushing journal entries** -> Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created_on` | *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 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional description of the journal entry. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the journal entry for the company in the accounting software. | | -| `journal_lines` | List[[shared.JournalLine](../../models/shared/journalline.md)] | :heavy_minus_sign: | An array of journal lines. | | -| `journal_ref` | [Optional[shared.JournalRef]](../../models/shared/journalref.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | -| `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 | -| `posted_on` | *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 | -| `record_ref` | [Optional[shared.JournalEntryRecordRef]](../../models/shared/journalentryrecordref.md) | :heavy_minus_sign: | Links a journal entry to the underlying record that created it. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | +# AccountingJournalEntry + +> **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/lending-api#/schemas/Journal) data type + +## Overview + +A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/lending-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. + +A journal entry line item is a single transaction line on the journal entry. For example: + +- When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. +- When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. + +In Codat a journal entry contains details of: + +- The date on which the entry was created and posted. +- Itemised lines, including amounts and currency. +- A reference to the associated accounts. +- A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. + +> **Pushing journal entries** +> Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_on` | *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 | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Optional description of the journal entry. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the journal entry for the company in the accounting software. | | +| `journal_lines` | List[[shared.JournalLine](../../models/shared/journalline.md)] | :heavy_minus_sign: | An array of journal lines. | | +| `journal_ref` | [Optional[shared.JournalRef]](../../models/shared/journalref.md) | :heavy_minus_sign: | Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). | | +| `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 | +| `posted_on` | *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 | +| `record_ref` | [Optional[shared.JournalEntryRecordRef]](../../models/shared/journalentryrecordref.md) | :heavy_minus_sign: | Links a journal entry to the underlying record that created it. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | | `updated_on` | *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 | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingjournalentrydatatype.md b/lending/docs/models/shared/accountingjournalentrydatatype.md new file mode 100644 index 000000000..b939e2f80 --- /dev/null +++ b/lending/docs/models/shared/accountingjournalentrydatatype.md @@ -0,0 +1,17 @@ +# AccountingJournalEntryDataType + +## Example Usage + +```python +from codat_lending.models.shared import AccountingJournalEntryDataType + +value = AccountingJournalEntryDataType.CUSTOMERS +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `CUSTOMERS` | customers | +| `SUPPLIERS` | suppliers | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingjournals.md b/lending/docs/models/shared/accountingjournals.md index 97b9030e7..04560bb7e 100644 --- a/lending/docs/models/shared/accountingjournals.md +++ b/lending/docs/models/shared/accountingjournals.md @@ -1,12 +1,12 @@ -# AccountingJournals - - -## 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.AccountingJournal]](../../models/shared/accountingjournal.md)] | :heavy_minus_sign: | N/A | | +# AccountingJournals + + +## 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.AccountingJournal]](../../models/shared/accountingjournal.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/lending/docs/models/shared/accountingpayment.md b/lending/docs/models/shared/accountingpayment.md index cf8274846..4e7824c8f 100644 --- a/lending/docs/models/shared/accountingpayment.md +++ b/lending/docs/models/shared/accountingpayment.md @@ -1,699 +1,699 @@ -# AccountingPayment - -> **Payments or bill payments?** -> -> In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - -## Overview - -Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - -A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - -- A payment made against an invoice, like a credit card, cheque, or cash payment. -- An allocation of a customer's credit note, either to an invoice or maybe a refund. -- A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - -Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - -In Codat, a payment contains details of: - -- When the payment was recorded in the accounting system. -- How much it is for and in what currency that amount is in. -- Who the payment was _paid by_ – the _customer_. -- The payment method used. -- The breakdown of the types of payments – the _line items_. - -Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - -## Payment types - -## Payment of an invoice - -A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - -- An _amount_ that indicates the amount of the invoice that was paid. This is always positive. -- A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - -The **amount** field on the **line** equals the **totalAmount** on the payment. - -## Payment of multiple invoices - -A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - -- The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). -- The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - -Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - -## Payments and refunds on account - -A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - -- A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. -- A **links** array containing one element with the following properties: -- A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. -- The **id** containing the ID of the customer. -- The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - -It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - -## Using a credit note to pay an invoice - -The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - -- An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. -- A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - -The **amount** field on the **line** equals the **totalAmount** on the payment. - -## Refunding a credit note - -A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - -- An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. -- A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - -The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - -## Refunding a payment - -If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - -- One for the incoming over payment. -- Another for the outgoing refund. - -The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - -- An **amount** that indicates the amount that was refunded. This is always negative. -- A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - -The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - -The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - -For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - -- One for £1,000 linked to the invoice that was paid. -- Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - -The **line** linked to the payment has the following properties: - -- An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. -- A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - -> **Support for linked payments** -> -> Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - -## Foreign currencies - -There are two types of currency rate that are included in the payments data type: - -Payment currency rate: - -- Base currency of the accounts receivable account. -- Foreign currency of the payment. - -Payment line link currency rate: - -- Base currency of the item the link represents. -- Foreign currency of the payment. - -These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - -- The base currency for the accounts receivable account. -- The currency of the item. - - ```json title="Currency rate example" - { - "id": "123", - "note": "", - "totalAmount": 99.99, - "currency": "GBP", - "lines": [ - { - "amount": 99.99, - "links": [ - { - "type": "Invoice", - "id": "178", - "amount": -50, - "currencyRate": 1.9998 - } - ] - } - ] - } - ``` - - - -## Example data - -> **Object properties** -> -> For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - -## Simple examples - - ```json title="Payment for invoice" - { - "totalAmount": 1000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Allocation of credit note" - { - "totalAmount": 0, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Payment of invoice and payment on account" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "y", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Refund of credit note" - { - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Refund on accounts receivable account" - { - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "y", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Linked refund on accounts receivable account" - { - "id" : "payment-001", - "totalAmount": 1000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Refund", - "id" : "refund-001", - "amount" : -1000 - } - ] - } - ] - } - { - "id" : "refund-001", - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "Payment", - "id" : "payment-001", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Using a credit note and cash to pay an invoice" - { - "totalAmount": 250, - "lines": [ - { - "amount": 0, - "links": [ - { - "type": "Invoice", - "id": "x", - "amount": -750 - }, - { - "type": "CreditNote", - "id": "y", - "amount": 750 - } - ] - }, - { - "amount": 250, - "links": [ - { - "type": "Invoice", - "id": "x", - "amount": -250 - } - ] - } - ] - } - ``` - - - -## Complex examples - - ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" - { - "totalAmount": 1000, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - }, - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - } - ] - }, - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "customer-001", - "amount" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes pay two invoices with no allocation amount specified" - { - "totalAmount": 0, - "lines": [ - { - "amount" : 0, - "links" : [ - { - "type" : "Invoice", - "id" : "w", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" - { - "totalAmount": 2000, - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "w", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "x", - "amount" : -1000 - }, - { - "type" : "Invoice", - "id" : "u", - "amount" : -1000 - }, - { - "type" : "CreditNote", - "id" : "y", - "amount" : 1000 - }, - { - "type" : "CreditNote", - "id" : "z", - "amount" : 1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Refund", - "id" : "refund-001", - "amount" : -1000 - } - ] - } - ] - } - { - "id" : "refund-001", - "totalAmount": -1000, - "lines": [ - { - "amount" : -1000, - "links" : [ - { - "type" : "Payment", - "id" : "payment-001", - "amount" : 1000 - } - ] - } - ] - } - ``` - - - -In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title="January" - { - "id": "001", - "totalAmount": 5000, - "date" : "1901-01-01", - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-x", - "amount" : -1000 - } - ] - }, - { - "amount" : 4000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "PaymentOnAccount-y", - "amount" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title="February" - { - "id": "001", - "totalAmount": 5000, - "date" : "1901-02-01", - "lines": [ - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-x", - "amount" : -1000 - } - ] - }, - { - "amount" : 1000, - "links" : [ - { - "type" : "Invoice", - "id" : "Invoice-y", - "amount" : -1000 - } - ] - }, - { - "amount" : 3000, - "links" : [ - { - "type" : "PaymentOnAccount", - "id" : "PaymentOnAccount-y", - "amount" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title="Two credit notes and some cash pay two invoices with no allocations specified" - { - "totalAmount": 500, - "lines": [ - { - "amount": 500, - "links": [{ - "type": "Invoice", - "id": "a", - "amount": -1000 - }, { - "type": "Invoice", - "id": "b", - "amount": -1000 - }, { - "type": "CreditNote", - "id": "y", - "amount": 750 - },{ - "type": "CreditNote", - "id": "z", - "amount": 750 - } - ] - } - ] - } - ``` - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `date_` | *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 | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | | -| `lines` | List[[shared.PaymentLine](../../models/shared/paymentline.md)] | :heavy_minus_sign: | An array of payment lines. | | -| `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 | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information associated with the payment. | | -| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the payment. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | +# AccountingPayment + +> **Payments or bill payments?** +> +> In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. + +## Overview + +Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). + +A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: + +- A payment made against an invoice, like a credit card, cheque, or cash payment. +- An allocation of a customer's credit note, either to an invoice or maybe a refund. +- A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. + +Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. + +In Codat, a payment contains details of: + +- When the payment was recorded in the accounting system. +- How much it is for and in what currency that amount is in. +- Who the payment was _paid by_ – the _customer_. +- The payment method used. +- The breakdown of the types of payments – the _line items_. + +Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + +## Payment types + +## Payment of an invoice + +A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: + +- An _amount_ that indicates the amount of the invoice that was paid. This is always positive. +- A **links** array containing one element with the following properties: + - A **type** that indicates the type of **link**, in this case an `Invoice`. + - An **id** that contains the ID of the invoice that was paid. + - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. + +The **amount** field on the **line** equals the **totalAmount** on the payment. + +## Payment of multiple invoices + +A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: + +- The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). +- The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. + +Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. + +## Payments and refunds on account + +A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: + +- A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. +- A **links** array containing one element with the following properties: +- A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. +- The **id** containing the ID of the customer. +- The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. + +It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. + +## Using a credit note to pay an invoice + +The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: + +- An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. +- A **links** array containing two elements: + - The first **link** has: + - A **type** that indicates the type of **link**, in this case an `Invoice`. + - An **id** that contains the ID of the invoice that was paid. + - The second **link** has: + - A **type** that indicates the type of **link**, in this case a `CreditNote`. + - An **id** that contains the ID of the credit note used by this payment. + +The **amount** field on the **line** equals the **totalAmount** on the payment. + +## Refunding a credit note + +A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: + +- An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. +- A **links** array that contains one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `CreditNote`. + - An **id** that contains the ID of the credit note that was refunded. + +The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. + +## Refunding a payment + +If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: + +- One for the incoming over payment. +- Another for the outgoing refund. + +The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: + +- An **amount** that indicates the amount that was refunded. This is always negative. +- A **links** array that contains one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `Payment`. + - An **id** that contains the ID of the payment that was refunded. + +The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. + +The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. + +For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: + +- One for £1,000 linked to the invoice that was paid. +- Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. + +The **line** linked to the payment has the following properties: + +- An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. +- A **links** array containing one element with the following properties: + - A **type** that indicates the type of **link**, in this case a `Refund`. + - An **id** that contains the ID of the payment that refunded this line. + +> **Support for linked payments** +> +> Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. + +## Foreign currencies + +There are two types of currency rate that are included in the payments data type: + +Payment currency rate: + +- Base currency of the accounts receivable account. +- Foreign currency of the payment. + +Payment line link currency rate: + +- Base currency of the item the link represents. +- Foreign currency of the payment. + +These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: + +- The base currency for the accounts receivable account. +- The currency of the item. + + ```json title="Currency rate example" + { + "id": "123", + "note": "", + "totalAmount": 99.99, + "currency": "GBP", + "lines": [ + { + "amount": 99.99, + "links": [ + { + "type": "Invoice", + "id": "178", + "amount": -50, + "currencyRate": 1.9998 + } + ] + } + ] + } + ``` + + + +## Example data + +> **Object properties** +> +> For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). + +## Simple examples + + ```json title="Payment for invoice" + { + "totalAmount": 1000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Allocation of credit note" + { + "totalAmount": 0, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Payment of invoice and payment on account" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "y", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Refund of credit note" + { + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Refund on accounts receivable account" + { + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "y", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Linked refund on accounts receivable account" + { + "id" : "payment-001", + "totalAmount": 1000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Refund", + "id" : "refund-001", + "amount" : -1000 + } + ] + } + ] + } + { + "id" : "refund-001", + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "Payment", + "id" : "payment-001", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Using a credit note and cash to pay an invoice" + { + "totalAmount": 250, + "lines": [ + { + "amount": 0, + "links": [ + { + "type": "Invoice", + "id": "x", + "amount": -750 + }, + { + "type": "CreditNote", + "id": "y", + "amount": 750 + } + ] + }, + { + "amount": 250, + "links": [ + { + "type": "Invoice", + "id": "x", + "amount": -250 + } + ] + } + ] + } + ``` + + + +## Complex examples + + ```json title="Use two credit notes and 1000 in to "bank" (cash, cheque etc.) to pay invoice" + { + "totalAmount": 1000, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + }, + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Pay an invoice with two credit notes and cash, with 1000 left 'on account'" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + } + ] + }, + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "customer-001", + "amount" : -1000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes pay two invoices with no allocation amount specified" + { + "totalAmount": 0, + "lines": [ + { + "amount" : 0, + "links" : [ + { + "type" : "Invoice", + "id" : "w", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash" + { + "totalAmount": 2000, + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "w", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "x", + "amount" : -1000 + }, + { + "type" : "Invoice", + "id" : "u", + "amount" : -1000 + }, + { + "type" : "CreditNote", + "id" : "y", + "amount" : 1000 + }, + { + "type" : "CreditNote", + "id" : "z", + "amount" : 1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Refund", + "id" : "refund-001", + "amount" : -1000 + } + ] + } + ] + } + { + "id" : "refund-001", + "totalAmount": -1000, + "lines": [ + { + "amount" : -1000, + "links" : [ + { + "type" : "Payment", + "id" : "payment-001", + "amount" : 1000 + } + ] + } + ] + } + ``` + + + +In this example, a payment on account is used to pay the same invoice in January and again in February. + + ```json title="January" + { + "id": "001", + "totalAmount": 5000, + "date" : "1901-01-01", + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-x", + "amount" : -1000 + } + ] + }, + { + "amount" : 4000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "PaymentOnAccount-y", + "amount" : -4000 + } + ] + } + ] + } + ``` + + + + ```json title="February" + { + "id": "001", + "totalAmount": 5000, + "date" : "1901-02-01", + "lines": [ + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-x", + "amount" : -1000 + } + ] + }, + { + "amount" : 1000, + "links" : [ + { + "type" : "Invoice", + "id" : "Invoice-y", + "amount" : -1000 + } + ] + }, + { + "amount" : 3000, + "links" : [ + { + "type" : "PaymentOnAccount", + "id" : "PaymentOnAccount-y", + "amount" : -3000 + } + ] + } + ] + } + ``` + + + + ```json title="Two credit notes and some cash pay two invoices with no allocations specified" + { + "totalAmount": 500, + "lines": [ + { + "amount": 500, + "links": [{ + "type": "Invoice", + "id": "a", + "amount": -1000 + }, { + "type": "Invoice", + "id": "b", + "amount": -1000 + }, { + "type": "CreditNote", + "id": "y", + "amount": 750 + },{ + "type": "CreditNote", + "id": "z", + "amount": 750 + } + ] + } + ] + } + ``` + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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 | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | Customer the payment is recorded against in the accounting software. | | +| `date_` | *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 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the payment, unique to the company in the accounting software. | | +| `lines` | List[[shared.PaymentLine](../../models/shared/paymentline.md)] | :heavy_minus_sign: | An array of payment lines. | | +| `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 | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Any additional information associated with the payment. | | +| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the payment. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | | `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingpaymentallocation.md b/lending/docs/models/shared/accountingpaymentallocation.md index 57b45b9a4..a75227237 100644 --- a/lending/docs/models/shared/accountingpaymentallocation.md +++ b/lending/docs/models/shared/accountingpaymentallocation.md @@ -1,9 +1,9 @@ -# AccountingPaymentAllocation - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `allocation` | [shared.Allocation](../../models/shared/allocation.md) | :heavy_check_mark: | N/A | -| `payment` | [shared.PaymentAllocationPayment](../../models/shared/paymentallocationpayment.md) | :heavy_check_mark: | N/A | \ No newline at end of file +# AccountingPaymentAllocation + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `allocation` | [shared.AccountingPaymentAllocationAllocation](../../models/shared/accountingpaymentallocationallocation.md) | :heavy_check_mark: | N/A | +| `payment` | [shared.PaymentAllocationPayment](../../models/shared/paymentallocationpayment.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/allocation.md b/lending/docs/models/shared/accountingpaymentallocationallocation.md similarity index 99% rename from lending/docs/models/shared/allocation.md rename to lending/docs/models/shared/accountingpaymentallocationallocation.md index fc348b8c3..0732c41c2 100644 --- a/lending/docs/models/shared/allocation.md +++ b/lending/docs/models/shared/accountingpaymentallocationallocation.md @@ -1,11 +1,11 @@ -# Allocation - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allocated_on_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 | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +# AccountingPaymentAllocationAllocation + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allocated_on_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 | +| `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 | +| `currency_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | | `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | The total amount that has been allocated. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingpaymentmethod.md b/lending/docs/models/shared/accountingpaymentmethod.md new file mode 100644 index 000000000..d05f40e7c --- /dev/null +++ b/lending/docs/models/shared/accountingpaymentmethod.md @@ -0,0 +1,18 @@ +# AccountingPaymentMethod + +## Overview + +A Payment Method represents the payment method(s) used to pay a Bill. Payment Methods are referenced on [Bill Payments](https://docs.codat.io/lending-api#/schemas/BillPayment) and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the payment method. | | +| `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 | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the payment method. | | +| `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.Status]](../../models/shared/status.md) | :heavy_minus_sign: | Status of the Payment Method. | | +| `type` | [Optional[shared.PaymentMethodType]](../../models/shared/paymentmethodtype.md) | :heavy_minus_sign: | Method of payment. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingpayments.md b/lending/docs/models/shared/accountingpayments.md index 0e4655b83..54ca78739 100644 --- a/lending/docs/models/shared/accountingpayments.md +++ b/lending/docs/models/shared/accountingpayments.md @@ -1,12 +1,12 @@ -# AccountingPayments - - -## 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.AccountingPayment]](../../models/shared/accountingpayment.md)] | :heavy_minus_sign: | N/A | | +# AccountingPayments + + +## 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.AccountingPayment]](../../models/shared/accountingpayment.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/lending/docs/models/shared/accountingprofitandlossreport.md b/lending/docs/models/shared/accountingprofitandlossreport.md index 848b0112a..5872448f2 100644 --- a/lending/docs/models/shared/accountingprofitandlossreport.md +++ b/lending/docs/models/shared/accountingprofitandlossreport.md @@ -1,33 +1,33 @@ -# AccountingProfitAndLossReport - -> **Language tip:** Profit and loss statement is also referred to as **income statement** under US GAAP (Generally Accepted Accounting Principles). - -## Overview - -The purpose of a profit and loss report is to present the financial performance of a company over a specified time period. - -A profit and loss report shows a company's total income and expenses for a specified period of time and whether a profit or loss has been made. - -> **Profit and loss or balance sheet?** -> Profit and loss reports summarise the total revenue, expenses, and profit or loss over a specified time period. A balance sheet report presents all assets, liability, and equity for a given date. - - -**Structure of this report** -This report will reflect the structure and line descriptions that the business has set in their own accounting software. - -**History** -By default, Codat pulls (up to) 24 months of profit and loss history for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `profitAndLoss` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/post-profile-syncSettings). - -**Want to pull this in a standardised structure?** -Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `currency` | *Optional[str]* | :heavy_minus_sign: | Base currency of the company in which the profit and loss report is presented. | | -| `earliest_available_month` | *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 | -| `most_recent_available_month` | *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 | -| `report_basis` | [shared.ReportBasis](../../models/shared/reportbasis.md) | :heavy_check_mark: | The basis of a report. | | +# AccountingProfitAndLossReport + +> **Language tip:** Profit and loss statement is also referred to as **income statement** under US GAAP (Generally Accepted Accounting Principles). + +## Overview + +The purpose of a profit and loss report is to present the financial performance of a company over a specified time period. + +A profit and loss report shows a company's total income and expenses for a specified period of time and whether a profit or loss has been made. + +> **Profit and loss or balance sheet?** +> Profit and loss reports summarise the total revenue, expenses, and profit or loss over a specified time period. A balance sheet report presents all assets, liability, and equity for a given date. + + +**Structure of this report** +This report will reflect the structure and line descriptions that the business has set in their own accounting software. + +**History** +By default, Codat pulls (up to) 24 months of profit and loss history for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `profitAndLoss` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/post-profile-syncSettings). + +**Want to pull this in a standardised structure?** +Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `currency` | *Optional[str]* | :heavy_minus_sign: | Base currency of the company in which the profit and loss report is presented. | | +| `earliest_available_month` | *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 | +| `most_recent_available_month` | *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 | +| `report_basis` | [shared.ReportBasis](../../models/shared/reportbasis.md) | :heavy_check_mark: | The basis of a report. | | | `reports` | List[[shared.ProfitAndLossReport](../../models/shared/profitandlossreport.md)] | :heavy_check_mark: | An array of profit and loss reports. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingrecordref.md b/lending/docs/models/shared/accountingrecordref.md index 9f41fbcc3..9e81f3c15 100644 --- a/lending/docs/models/shared/accountingrecordref.md +++ b/lending/docs/models/shared/accountingrecordref.md @@ -1,13 +1,13 @@ -# AccountingRecordRef - -Links the current record to the underlying record or data type that created it. - -For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `data_type` | *Optional[str]* | :heavy_minus_sign: | Allowed name of the 'dataType'. | **Example 1:** journalEntry
**Example 2:** invoice
**Example 3:** accountTransaction
**Example 4:** transfer | +# AccountingRecordRef + +Links the current record to the underlying record or data type that created it. + +For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `data_type` | *Optional[str]* | :heavy_minus_sign: | Allowed name of the 'dataType'. | **Example 1:** journalEntry
**Example 2:** invoice
**Example 3:** accountTransaction
**Example 4:** transfer | | `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingsupplier.md b/lending/docs/models/shared/accountingsupplier.md index 5bfe7afa7..711a816b5 100644 --- a/lending/docs/models/shared/accountingsupplier.md +++ b/lending/docs/models/shared/accountingsupplier.md @@ -1,25 +1,25 @@ -# AccountingSupplier - -## Overview - -From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | -| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | | -| `default_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | -| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | -| `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 | -| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | -| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [shared.SupplierStatus](../../models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | -| `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. | | -| `supplier_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | +# AccountingSupplier + +## Overview + +From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `addresses` | List[[shared.AccountingAddress](../../models/shared/accountingaddress.md)] | :heavy_minus_sign: | An array of Addresses. | | +| `contact_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the main contact for the supplier. | | +| `default_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | +| `email_address` | *OptionalNullable[str]* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | +| `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 | +| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | +| `registration_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [shared.SupplierStatus](../../models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | +| `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. | | +| `supplier_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | | `tax_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Supplier's company tax number. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingsuppliers.md b/lending/docs/models/shared/accountingsuppliers.md index 728739549..3d455b19a 100644 --- a/lending/docs/models/shared/accountingsuppliers.md +++ b/lending/docs/models/shared/accountingsuppliers.md @@ -1,12 +1,12 @@ -# AccountingSuppliers - - -## 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.AccountingSupplier]](../../models/shared/accountingsupplier.md)] | :heavy_minus_sign: | N/A | | +# AccountingSuppliers + + +## 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.AccountingSupplier]](../../models/shared/accountingsupplier.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/lending/docs/models/shared/accountingtrackingcategory.md b/lending/docs/models/shared/accountingtrackingcategory.md new file mode 100644 index 000000000..77413142d --- /dev/null +++ b/lending/docs/models/shared/accountingtrackingcategory.md @@ -0,0 +1,142 @@ +# AccountingTrackingCategory + +Details of a category used for tracking transactions. + +> Language tip +> +> Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting software. In Codat, we refer to these as tracking categories. + +## Overview + +Tracking categories are used to monitor cost centres and control budgets that sit outside the standard chart of accounts. Customers may use tracking categories to group together and track the income and costs of specific departments, projects, locations or customers. + +From their accounting system, customers can: + +- Create and maintain tracking categories and tracking category types. +- View all tracking categories that are available for use. +- View the relationships between the categories. +- Assign invoices, bills, credit notes, or bill credit notes to one or more categories. +- View the categories that a transaction belongs to. +- View all transactions in a tracking category. + +### Tracking categories per platform + +Review the platform-specific tracking categories that Codat supports, and the level they are assigned to in the source platform. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PlatformTracking categoryTracking level
Dynamics 365DimensionsLine item
FreshbooksExpense categoriesLine item
MYOBCategoriesTransaction
NetsuiteClassesLine item
LocationsLine item
DepartmentsLine item
Custom segmentsLine item
QuickBooks DesktopClassesLine item or transaction level
LocationsTransaction
QuickBooks OnlineClassesLine item or transaction level
LocationsTransaction
Sage 200Cost centersLine item
DepartmentsLine item
Analysis codesTransaction
Sage 50DepartmentsLine item
CostcodesLine item
ProjectsLine item
Sage IntacctDimensionsLine item
XeroTracking categoriesLine item
+ +> **Example use case** +> +> Monitor the budget for your annual conference using a tracking category called 'AnnualConference2020' with the **type** set to **Costing**. + +If a tracking category has a parent category, the ID of that parent category is displayed. There is also a `hasChildren` field that shows whether there are child subcategories nested beneath. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `has_children` | *Optional[bool]* | :heavy_minus_sign: | Boolean value indicating whether this category has SubCategories. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | The identifier for the item, unique per tracking category. | | +| `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 | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the tracking category. | | +| `parent_id` | *Optional[str]* | :heavy_minus_sign: | The identifier for this item's immediate parent. | | +| `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.Status]](../../models/shared/status.md) | :heavy_minus_sign: | Current state of the tracking category. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingtransfer.md b/lending/docs/models/shared/accountingtransfer.md index 97b379693..82beda2e8 100644 --- a/lending/docs/models/shared/accountingtransfer.md +++ b/lending/docs/models/shared/accountingtransfer.md @@ -1,22 +1,22 @@ -# AccountingTransfer - -A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `deposited_record_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer. | | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the transfer. | | -| `from_` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the transfer. | | -| `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 | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `status` | [OptionalNullable[shared.AccountingTransferStatus]](../../models/shared/accountingtransferstatus.md) | :heavy_minus_sign: | The status of the transfer in the account | | -| `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. | | -| `to` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | +# AccountingTransfer + +A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | The customer or supplier for the transfer, if available. | | +| `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 | +| `deposited_record_refs` | List[[shared.AccountingRecordRef](../../models/shared/accountingrecordref.md)] | :heavy_minus_sign: | List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer. | | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the transfer. | | +| `from_` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the transfer. | | +| `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 | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `status` | [OptionalNullable[shared.AccountingTransferStatus]](../../models/shared/accountingtransferstatus.md) | :heavy_minus_sign: | The status of the transfer in the account | | +| `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. | | +| `to` | [Optional[shared.TransferAccount]](../../models/shared/transferaccount.md) | :heavy_minus_sign: | Account details of the account sending or receiving the transfer. | | | `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories this transfer is being tracked against. | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingtransfers.md b/lending/docs/models/shared/accountingtransfers.md index 087fd44cc..4f101115a 100644 --- a/lending/docs/models/shared/accountingtransfers.md +++ b/lending/docs/models/shared/accountingtransfers.md @@ -1,12 +1,12 @@ -# AccountingTransfers - - -## 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.AccountingTransfer]](../../models/shared/accountingtransfer.md)] | :heavy_minus_sign: | N/A | | +# AccountingTransfers + + +## 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.AccountingTransfer]](../../models/shared/accountingtransfer.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/lending/docs/models/shared/accountingtransferstatus.md b/lending/docs/models/shared/accountingtransferstatus.md index b495f3abd..2849de6fa 100644 --- a/lending/docs/models/shared/accountingtransferstatus.md +++ b/lending/docs/models/shared/accountingtransferstatus.md @@ -1,21 +1,19 @@ -# AccountingTransferStatus - -The status of the transfer in the account - -## Example Usage - -```python -from codat_lending.models.shared import AccountingTransferStatus - -value = AccountingTransferStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `UNKNOWN` | Unknown | -| `UNRECONCILED` | Unreconciled | -| `RECONCILED` | Reconciled | +# AccountingTransferStatus + +## Example Usage + +```python +from codat_lending.models.shared import AccountingTransferStatus + +value = AccountingTransferStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `UNKNOWN` | Unknown | +| `UNRECONCILED` | Unreconciled | +| `RECONCILED` | Reconciled | | `VOID` | Void | \ No newline at end of file diff --git a/lending/docs/models/shared/accountinstitution.md b/lending/docs/models/shared/accountinstitution.md index 71c17d374..a6b49b03c 100644 --- a/lending/docs/models/shared/accountinstitution.md +++ b/lending/docs/models/shared/accountinstitution.md @@ -1,11 +1,12 @@ -# AccountInstitution - -The bank or other financial institution providing the account. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | The institution's ID, according to the provider. | +# AccountInstitution + +The bank or other financial institution providing the account. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `id` | *Optional[str]* | :heavy_minus_sign: | The institution's ID, according to the provider. | | `name` | *Optional[str]* | :heavy_minus_sign: | The institution's name, according to the underlying provider. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountprototype.md b/lending/docs/models/shared/accountprototype.md index 84fb66578..3a164044c 100644 --- a/lending/docs/models/shared/accountprototype.md +++ b/lending/docs/models/shared/accountprototype.md @@ -1,19 +1,19 @@ -# AccountPrototype - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `current_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Current balance in the account. | 0 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | -| `fully_qualified_category` | *OptionalNullable[str]* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | -| `fully_qualified_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | **Example 1:** Cash On Hand
**Example 2:** Fixed Asset | -| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | -| `status` | [Optional[shared.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the 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. | | -| `type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | +# AccountPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | +| `current_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Current balance in the account. | 0 | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | +| `fully_qualified_category` | *OptionalNullable[str]* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | +| `fully_qualified_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | **Example 1:** Cash On Hand
**Example 2:** Fixed Asset | +| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | +| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | +| `status` | [Optional[shared.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the 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. | | +| `type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | | `valid_datatype_links` | List[[shared.ValidDataTypeLinks](../../models/shared/validdatatypelinks.md)] | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/lending/docs/models/shared/accountref.md b/lending/docs/models/shared/accountref.md index 167b8047c..9dedb5c0c 100644 --- a/lending/docs/models/shared/accountref.md +++ b/lending/docs/models/shared/accountref.md @@ -1,11 +1,9 @@ -# AccountRef - -Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' from the Accounts data type. | +# AccountRef + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' from the Accounts data type. | | `name` | *Optional[str]* | :heavy_minus_sign: | 'name' from the Accounts data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/accounts.md b/lending/docs/models/shared/accounts.md index 574b3e86b..56d3c466f 100644 --- a/lending/docs/models/shared/accounts.md +++ b/lending/docs/models/shared/accounts.md @@ -1,14 +1,14 @@ -# Accounts - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_name` | *Optional[str]* | :heavy_minus_sign: | The name of the account according to the provider. | | -| `account_provider` | *Optional[str]* | :heavy_minus_sign: | The bank or other financial institution providing the account. | | -| `account_type` | *Optional[str]* | :heavy_minus_sign: | The type of banking account, e.g. credit or debit. | | -| `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 | -| `current_balance` | *Optional[Decimal]* | :heavy_minus_sign: | The balance of the bank account. | | -| `platform_name` | *Optional[str]* | :heavy_minus_sign: | Name of the banking data source, e.g. "Plaid". | | +# Accounts + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_name` | *Optional[str]* | :heavy_minus_sign: | The name of the account according to the provider. | | +| `account_provider` | *Optional[str]* | :heavy_minus_sign: | The bank or other financial institution providing the account. | | +| `account_type` | *Optional[str]* | :heavy_minus_sign: | The type of banking account, e.g. credit or debit. | | +| `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 | +| `current_balance` | *Optional[Decimal]* | :heavy_minus_sign: | The balance of the bank account. | | +| `platform_name` | *Optional[str]* | :heavy_minus_sign: | Name of the banking data source, e.g. "Plaid". | | | `source_ref` | [Optional[shared.ReportSourceReference]](../../models/shared/reportsourcereference.md) | :heavy_minus_sign: | A source reference containing the `sourceType` object "Banking". | {
"Example": {
"value": {
"sourceRef": {
"sourceType": "Banking"
}
}
}
} | \ No newline at end of file diff --git a/lending/docs/models/shared/accountspayabletracking.md b/lending/docs/models/shared/accountspayabletracking.md index 9f576a8ed..9ae8ca32b 100644 --- a/lending/docs/models/shared/accountspayabletracking.md +++ b/lending/docs/models/shared/accountspayabletracking.md @@ -1,14 +1,14 @@ -# AccountsPayableTracking - -Categories, and a project and customer, against which the item is tracked. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_check_mark: | N/A | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | -| `is_billed_to` | [shared.BilledToType](../../models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the invoice or credit note is billed/rebilled to a project or customer. | -| `is_rebilled_to` | [shared.BilledToType](../../models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the invoice or credit note is billed/rebilled to a project or customer. | +# AccountsPayableTracking + +Categories, and a project and customer, against which the item is tracked. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_check_mark: | N/A | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | +| `is_billed_to` | [shared.BilledToType](../../models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the invoice or credit note is billed/rebilled to a project or customer. | +| `is_rebilled_to` | [shared.BilledToType](../../models/shared/billedtotype.md) | :heavy_check_mark: | Defines if the invoice or credit note is billed/rebilled to a project or customer. | | `project_ref` | [Optional[shared.ProjectRef]](../../models/shared/projectref.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/accountsreceivabletracking.md b/lending/docs/models/shared/accountsreceivabletracking.md index bf3d1bb64..65ac2c12d 100644 --- a/lending/docs/models/shared/accountsreceivabletracking.md +++ b/lending/docs/models/shared/accountsreceivabletracking.md @@ -1,15 +1,15 @@ -# AccountsReceivableTracking - -Categories, and a project and customer, against which the item is tracked. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_check_mark: | N/A | -| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | -| `is_billed_to` | [shared.BilledToType1](../../models/shared/billedtotype1.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | -| `is_rebilled_to` | [shared.BilledToType1](../../models/shared/billedtotype1.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | -| `project_ref` | [Optional[shared.ProjectRef]](../../models/shared/projectref.md) | :heavy_minus_sign: | N/A | +# AccountsReceivableTracking + +Categories, and a project and customer, against which the item is tracked. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_check_mark: | N/A | +| `customer_ref` | [Optional[shared.AccountingCustomerRef]](../../models/shared/accountingcustomerref.md) | :heavy_minus_sign: | N/A | +| `is_billed_to` | [shared.BilledToType1](../../models/shared/billedtotype1.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | +| `is_rebilled_to` | [shared.BilledToType1](../../models/shared/billedtotype1.md) | :heavy_check_mark: | Defines if the bill or bill credit note is billed/rebilled to a project. | +| `project_ref` | [Optional[shared.ProjectRef]](../../models/shared/projectref.md) | :heavy_minus_sign: | N/A | | `record_ref` | [Optional[shared.AccountingRecordRef]](../../models/shared/accountingrecordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | \ No newline at end of file diff --git a/lending/docs/models/shared/accountstatus.md b/lending/docs/models/shared/accountstatus.md index fe504a526..7a4b8e76d 100644 --- a/lending/docs/models/shared/accountstatus.md +++ b/lending/docs/models/shared/accountstatus.md @@ -1,21 +1,21 @@ -# AccountStatus - -Status of the account - -## Example Usage - -```python -from codat_lending.models.shared import AccountStatus - -value = AccountStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | -| `ARCHIVED` | Archived | +# AccountStatus + +Status of the account + +## Example Usage + +```python +from codat_lending.models.shared import AccountStatus + +value = AccountStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | +| `ARCHIVED` | Archived | | `PENDING` | Pending | \ No newline at end of file diff --git a/lending/docs/models/shared/accounttransactionline.md b/lending/docs/models/shared/accounttransactionline.md index 539d9321e..440b5a820 100644 --- a/lending/docs/models/shared/accounttransactionline.md +++ b/lending/docs/models/shared/accounttransactionline.md @@ -1,10 +1,10 @@ -# AccountTransactionLine - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount in the bill payment currency. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the account transaction. | -| `record_ref` | [Optional[shared.AccountTransactionLineRecordRef]](../../models/shared/accounttransactionlinerecordref.md) | :heavy_minus_sign: | Links an account transaction line to the underlying record that created it. | \ No newline at end of file +# AccountTransactionLine + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount in the bill payment currency. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the account transaction. | +| `record_ref` | [Optional[shared.AccountTransactionLineRecordRef]](../../models/shared/accounttransactionlinerecordref.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/accounttransactionlinerecordref.md b/lending/docs/models/shared/accounttransactionlinerecordref.md index 63fd94984..ba5428448 100644 --- a/lending/docs/models/shared/accounttransactionlinerecordref.md +++ b/lending/docs/models/shared/accounttransactionlinerecordref.md @@ -1,11 +1,9 @@ -# AccountTransactionLineRecordRef - -Links an account transaction line to the underlying record that created it. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `data_type` | [Optional[shared.AccountTransactionLineRecordRefDataType]](../../models/shared/accounttransactionlinerecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | transfers | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file +# AccountTransactionLineRecordRef + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `data_type` | [Optional[shared.AccountTransactionLineRecordRefDataType]](../../models/shared/accounttransactionlinerecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/accounttransactionlinerecordrefdatatype.md b/lending/docs/models/shared/accounttransactionlinerecordrefdatatype.md index bda8321f4..fa9bd7273 100644 --- a/lending/docs/models/shared/accounttransactionlinerecordrefdatatype.md +++ b/lending/docs/models/shared/accounttransactionlinerecordrefdatatype.md @@ -1,28 +1,28 @@ -# AccountTransactionLineRecordRefDataType - -Name of underlying data type. - -## Example Usage - -```python -from codat_lending.models.shared import AccountTransactionLineRecordRefDataType - -value = AccountTransactionLineRecordRefDataType.BANK_TRANSACTIONS -``` - - -## Values - -| Name | Value | -| ------------------- | ------------------- | -| `BANK_TRANSACTIONS` | bankTransactions | -| `BILL_CREDIT_NOTES` | billCreditNotes | -| `BILL_PAYMENTS` | billPayments | -| `BILLS` | bills | -| `CREDIT_NOTES` | creditNotes | -| `DIRECT_COSTS` | directCosts | -| `DIRECT_INCOMES` | directIncomes | -| `INVOICES` | invoices | -| `JOURNAL_ENTRIES` | journalEntries | -| `PAYMENTS` | payments | +# AccountTransactionLineRecordRefDataType + +Name of underlying data type. + +## Example Usage + +```python +from codat_lending.models.shared import AccountTransactionLineRecordRefDataType + +value = AccountTransactionLineRecordRefDataType.BANK_TRANSACTIONS +``` + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `BANK_TRANSACTIONS` | bankTransactions | +| `BILL_CREDIT_NOTES` | billCreditNotes | +| `BILL_PAYMENTS` | billPayments | +| `BILLS` | bills | +| `CREDIT_NOTES` | creditNotes | +| `DIRECT_COSTS` | directCosts | +| `DIRECT_INCOMES` | directIncomes | +| `INVOICES` | invoices | +| `JOURNAL_ENTRIES` | journalEntries | +| `PAYMENTS` | payments | | `TRANSFERS` | transfers | \ No newline at end of file diff --git a/lending/docs/models/shared/accounttype.md b/lending/docs/models/shared/accounttype.md index ffccd6cde..bfe3603ae 100644 --- a/lending/docs/models/shared/accounttype.md +++ b/lending/docs/models/shared/accounttype.md @@ -1,23 +1,23 @@ -# AccountType - -Type of account - -## Example Usage - -```python -from codat_lending.models.shared import AccountType - -value = AccountType.UNKNOWN -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `UNKNOWN` | Unknown | -| `ASSET` | Asset | -| `EXPENSE` | Expense | -| `INCOME` | Income | -| `LIABILITY` | Liability | -| `EQUITY` | Equity | \ No newline at end of file +# AccountType + +Type of account + +## Example Usage + +```python +from codat_lending.models.shared import AccountType + +value = AccountType.ASSET +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ASSET` | Asset | +| `EQUITY` | Equity | +| `EXPENSE` | Expense | +| `INCOME` | Income | +| `LIABILITY` | Liability | +| `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/agedcreditor.md b/lending/docs/models/shared/agedcreditor.md index 198f8b726..16c9507d0 100644 --- a/lending/docs/models/shared/agedcreditor.md +++ b/lending/docs/models/shared/agedcreditor.md @@ -1,10 +1,10 @@ -# AgedCreditor - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `aged_currency_outstanding` | List[[shared.AgedCurrencyOutstanding](../../models/shared/agedcurrencyoutstanding.md)] | :heavy_minus_sign: | Array of aged creditors by currency. | | -| `supplier_id` | *Optional[str]* | :heavy_minus_sign: | Supplier ID of the aged creditor. | f594cefb-7750-4c3a-bab2-b5322026dee9 | +# AgedCreditor + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `aged_currency_outstanding` | List[[shared.AgedCurrencyOutstanding](../../models/shared/agedcurrencyoutstanding.md)] | :heavy_minus_sign: | Array of aged creditors by currency. | | +| `supplier_id` | *Optional[str]* | :heavy_minus_sign: | Supplier ID of the aged creditor. | f594cefb-7750-4c3a-bab2-b5322026dee9 | | `supplier_name` | *Optional[str]* | :heavy_minus_sign: | Supplier name of the aged creditor. | John Doe | \ No newline at end of file diff --git a/lending/docs/models/shared/agedcurrencyoutstanding.md b/lending/docs/models/shared/agedcurrencyoutstanding.md index c426795a6..0d917c394 100644 --- a/lending/docs/models/shared/agedcurrencyoutstanding.md +++ b/lending/docs/models/shared/agedcurrencyoutstanding.md @@ -1,9 +1,9 @@ -# AgedCurrencyOutstanding - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `aged_outstanding_amounts` | List[[shared.AgedOutstandingAmount](../../models/shared/agedoutstandingamount.md)] | :heavy_minus_sign: | Array of outstanding amounts by period. | | +# AgedCurrencyOutstanding + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `aged_outstanding_amounts` | List[[shared.AgedOutstandingAmount](../../models/shared/agedoutstandingamount.md)] | :heavy_minus_sign: | Array of outstanding amounts by period. | | | `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 | \ No newline at end of file diff --git a/lending/docs/models/shared/ageddebtor.md b/lending/docs/models/shared/ageddebtor.md index 6b32dc704..0776e0deb 100644 --- a/lending/docs/models/shared/ageddebtor.md +++ b/lending/docs/models/shared/ageddebtor.md @@ -1,10 +1,10 @@ -# AgedDebtor - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `aged_currency_outstanding` | List[[shared.AgedCurrencyOutstanding](../../models/shared/agedcurrencyoutstanding.md)] | :heavy_minus_sign: | Array of aged debtors by currency. | | -| `customer_id` | *Optional[str]* | :heavy_minus_sign: | Customer ID of the aged debtor. | f594cefb-7750-4c3a-bab2-b5322026dee9 | +# AgedDebtor + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `aged_currency_outstanding` | List[[shared.AgedCurrencyOutstanding](../../models/shared/agedcurrencyoutstanding.md)] | :heavy_minus_sign: | Array of aged debtors by currency. | | +| `customer_id` | *Optional[str]* | :heavy_minus_sign: | Customer ID of the aged debtor. | f594cefb-7750-4c3a-bab2-b5322026dee9 | | `customer_name` | *Optional[str]* | :heavy_minus_sign: | Customer name of the aged debtor. | John Doe | \ No newline at end of file diff --git a/lending/docs/models/shared/agedoutstandingamount.md b/lending/docs/models/shared/agedoutstandingamount.md index 7aeda103d..b8f8b52bd 100644 --- a/lending/docs/models/shared/agedoutstandingamount.md +++ b/lending/docs/models/shared/agedoutstandingamount.md @@ -1,11 +1,11 @@ -# AgedOutstandingAmount - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount outstanding. | | -| `details` | List[[shared.AgedOutstandingAmountDetail](../../models/shared/agedoutstandingamountdetail.md)] | :heavy_minus_sign: | Array of details. | | -| `from_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 | +# AgedOutstandingAmount + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount outstanding. | | +| `details` | List[[shared.AgedOutstandingAmountDetail](../../models/shared/agedoutstandingamountdetail.md)] | :heavy_minus_sign: | Array of details. | | +| `from_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 | | `to_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/agedoutstandingamountdetail.md b/lending/docs/models/shared/agedoutstandingamountdetail.md index 4016cffe4..990bf00e5 100644 --- a/lending/docs/models/shared/agedoutstandingamountdetail.md +++ b/lending/docs/models/shared/agedoutstandingamountdetail.md @@ -1,9 +1,9 @@ -# AgedOutstandingAmountDetail - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount outstanding. | +# AgedOutstandingAmountDetail + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount outstanding. | | `name` | *Optional[str]* | :heavy_minus_sign: | Name of data type with outstanding amount for given period. | \ No newline at end of file diff --git a/lending/docs/models/shared/attachments.md b/lending/docs/models/shared/attachments.md index a0878172a..7319e4346 100644 --- a/lending/docs/models/shared/attachments.md +++ b/lending/docs/models/shared/attachments.md @@ -1,8 +1,8 @@ -# Attachments - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +# Attachments + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | | `attachments` | List[[Nullable[shared.AccountingAttachment]](../../models/shared/accountingattachment.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/balancesheet.md b/lending/docs/models/shared/balancesheet.md index cd5e497c5..2fd5492ae 100644 --- a/lending/docs/models/shared/balancesheet.md +++ b/lending/docs/models/shared/balancesheet.md @@ -1,12 +1,12 @@ -# BalanceSheet - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `assets` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `equity` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `liabilities` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `net_assets` | *Decimal* | :heavy_check_mark: | Value of net assets for a company in their base currency. | | \ No newline at end of file +# BalanceSheet + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `assets` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLines for assets. For example, fixed and current assets. | +| `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. | +| `equity` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLines for equities. For example, retained and current year earnings. See below. | +| `liabilities` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLines for liabilities. For example, current liabilities. | +| `net_assets` | *Decimal* | :heavy_check_mark: | Value of net assets for a company in their base currency. | \ No newline at end of file diff --git a/lending/docs/models/shared/bankaccountprototype.md b/lending/docs/models/shared/bankaccountprototype.md new file mode 100644 index 000000000..f6e28788b --- /dev/null +++ b/lending/docs/models/shared/bankaccountprototype.md @@ -0,0 +1,19 @@ +# BankAccountPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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[shared.AccountingBankAccountType]](../../models/shared/accountingbankaccounttype.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` | *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. | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `i_ban` | *Optional[str]* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | +| `institution` | *Optional[str]* | :heavy_minus_sign: | The institution of the bank account. | | +| `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. | | +| `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/lending/docs/models/shared/bankaccountref.md b/lending/docs/models/shared/bankaccountref.md index 71c366a90..49eca5da3 100644 --- a/lending/docs/models/shared/bankaccountref.md +++ b/lending/docs/models/shared/bankaccountref.md @@ -1,11 +1,9 @@ -# BankAccountRef - -Links to the Account transactions data type. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `id` | *Optional[str]* | :heavy_minus_sign: | Bank account 'id' for the account transaction. | +# BankAccountRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | Bank account 'id' for the account transaction. | | `name` | *Optional[str]* | :heavy_minus_sign: | bank account 'name' for the account transaction. | \ No newline at end of file diff --git a/lending/docs/models/shared/bankaccountstatus.md b/lending/docs/models/shared/bankaccountstatus.md index 8aef6d11b..c8d46c8a5 100644 --- a/lending/docs/models/shared/bankaccountstatus.md +++ b/lending/docs/models/shared/bankaccountstatus.md @@ -1,21 +1,19 @@ -# BankAccountStatus - -Status of the bank account. - -## Example Usage - -```python -from codat_lending.models.shared import BankAccountStatus - -value = BankAccountStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | -| `ARCHIVED` | Archived | +# BankAccountStatus + +## Example Usage + +```python +from codat_lending.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/lending/docs/models/shared/bankfeedbankaccountmapping.md b/lending/docs/models/shared/bankfeedbankaccountmapping.md index 86f7ea99f..8408fb1d0 100644 --- a/lending/docs/models/shared/bankfeedbankaccountmapping.md +++ b/lending/docs/models/shared/bankfeedbankaccountmapping.md @@ -1,10 +1,11 @@ -# BankFeedBankAccountMapping - - -## 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 | | +# BankFeedBankAccountMapping + + +## 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/lending/docs/models/shared/bankfeedbankaccountmappingresponse.md b/lending/docs/models/shared/bankfeedbankaccountmappingresponse.md index c7299e6c8..1d8fde1c2 100644 --- a/lending/docs/models/shared/bankfeedbankaccountmappingresponse.md +++ b/lending/docs/models/shared/bankfeedbankaccountmappingresponse.md @@ -1,11 +1,12 @@ -# BankFeedBankAccountMappingResponse - - -## 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. | +# BankFeedBankAccountMappingResponse + + +## 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/lending/docs/models/shared/bankfeedmapping.md b/lending/docs/models/shared/bankfeedmapping.md index 0334478b5..187472389 100644 --- a/lending/docs/models/shared/bankfeedmapping.md +++ b/lending/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/lending/docs/models/shared/bankingaccount.md b/lending/docs/models/shared/bankingaccount.md index 06f09c78a..3f8ec352f 100644 --- a/lending/docs/models/shared/bankingaccount.md +++ b/lending/docs/models/shared/bankingaccount.md @@ -1,22 +1,22 @@ -# BankingAccount - -This data type provides a list of all the SMB's bank accounts, with rich data like balances, account numbers, and institutions holding the accounts. - -Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `balance` | [shared.AccountBalanceAmounts](../../models/shared/accountbalanceamounts.md) | :heavy_check_mark: | Depending on the data provided by the underlying bank, not all balances are always available. | | -| `currency` | *str* | :heavy_check_mark: | The currency code for the account. | | -| `holder` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the person or company who holds the account. | | -| `id` | *str* | :heavy_check_mark: | The ID of the account from the provider. | | -| `identifiers` | [shared.AccountIdentifiers](../../models/shared/accountidentifiers.md) | :heavy_check_mark: | An object containing bank account identification information. | | -| `informal_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available. | | -| `institution` | [shared.AccountInstitution](../../models/shared/accountinstitution.md) | :heavy_check_mark: | The bank or other financial institution providing the account. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *str* | :heavy_check_mark: | The name of the account according to the provider. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# BankingAccount + +This data type provides a list of all the SMB's bank accounts, with rich data like balances, account numbers, and institutions holding the accounts. + +Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `balance` | [shared.AccountBalanceAmounts](../../models/shared/accountbalanceamounts.md) | :heavy_check_mark: | Depending on the data provided by the underlying bank, not all balances are always available. | | +| `currency` | *str* | :heavy_check_mark: | The currency code for the account. | | +| `holder` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the person or company who holds the account. | | +| `id` | *str* | :heavy_check_mark: | The ID of the account from the provider. | | +| `identifiers` | [shared.AccountIdentifiers](../../models/shared/accountidentifiers.md) | :heavy_check_mark: | An object containing bank account identification information. | | +| `informal_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available. | | +| `institution` | [shared.AccountInstitution](../../models/shared/accountinstitution.md) | :heavy_check_mark: | The bank or other financial institution providing the account. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *str* | :heavy_check_mark: | The name of the account according to the provider. | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `type` | [shared.AccountingBankAccountType](../../models/shared/accountingbankaccounttype.md) | :heavy_check_mark: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | \ No newline at end of file diff --git a/lending/docs/models/shared/bankingaccountbalance.md b/lending/docs/models/shared/bankingaccountbalance.md index 35879def4..259e245fc 100644 --- a/lending/docs/models/shared/bankingaccountbalance.md +++ b/lending/docs/models/shared/bankingaccountbalance.md @@ -1,22 +1,22 @@ -# BankingAccountBalance - -The Banking Account Balances data type provides a list of balances for a bank account including end-of-day batch balance or running balances per transaction. - -Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - -> **How often should I pull Account Balances?** -> -> Because these balances are closing balances, we recommend you pull Account Balance no more frequently than daily. If you require a live intraday balance, this can be found for each account on the [Account](https://docs.codat.io/lending-api#/schemas/Account) data type. -> -> Whilst you can choose to sync hourly, this may incur usage charges from Plaid or TrueLayer. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *str* | :heavy_check_mark: | The unique identifier of the account. | | -| `balance` | [shared.AccountBalanceAmounts](../../models/shared/accountbalanceamounts.md) | :heavy_check_mark: | Depending on the data provided by the underlying bank, not all balances are always available. | | -| `date_` | *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 | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# BankingAccountBalance + +The Banking Account Balances data type provides a list of balances for a bank account including end-of-day batch balance or running balances per transaction. + +Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + +> **How often should I pull Account Balances?** +> +> Because these balances are closing balances, we recommend you pull Account Balance no more frequently than daily. If you require a live intraday balance, this can be found for each account on the [Account](https://docs.codat.io/lending-api#/schemas/Account) data type. +> +> Whilst you can choose to sync hourly, this may incur usage charges from Plaid or TrueLayer. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | The unique identifier of the account. | | +| `balance` | [shared.AccountBalanceAmounts](../../models/shared/accountbalanceamounts.md) | :heavy_check_mark: | Depending on the data provided by the underlying bank, not all balances are always available. | | +| `date_` | *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 | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/bankingaccountbalances.md b/lending/docs/models/shared/bankingaccountbalances.md index 05f8f26e2..6b89ca880 100644 --- a/lending/docs/models/shared/bankingaccountbalances.md +++ b/lending/docs/models/shared/bankingaccountbalances.md @@ -1,12 +1,12 @@ -# BankingAccountBalances - - -## 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.BankingAccountBalance]](../../models/shared/bankingaccountbalance.md)] | :heavy_minus_sign: | N/A | | +# BankingAccountBalances + + +## 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.BankingAccountBalance]](../../models/shared/bankingaccountbalance.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/lending/docs/models/shared/bankingaccounts.md b/lending/docs/models/shared/bankingaccounts.md index 7fb9088cc..2bc52deb1 100644 --- a/lending/docs/models/shared/bankingaccounts.md +++ b/lending/docs/models/shared/bankingaccounts.md @@ -1,12 +1,12 @@ -# BankingAccounts - - -## 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.BankingAccount]](../../models/shared/bankingaccount.md)] | :heavy_minus_sign: | N/A | | +# BankingAccounts + + +## 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.BankingAccount]](../../models/shared/bankingaccount.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/lending/docs/models/shared/bankingtransaction.md b/lending/docs/models/shared/bankingtransaction.md index 892fa2995..e33f28951 100644 --- a/lending/docs/models/shared/bankingtransaction.md +++ b/lending/docs/models/shared/bankingtransaction.md @@ -1,23 +1,23 @@ -# BankingTransaction - -The Banking Transactions data type provides an immutable source of up-to-date information on income and expenditure. - -Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *str* | :heavy_check_mark: | The unique identifier of the bank account. | | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount of the bank transaction. | | -| `authorized_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 | -| `code` | [Optional[shared.TransactionCode]](../../models/shared/transactioncode.md) | :heavy_minus_sign: | Code to identify the underlying transaction. | | -| `currency` | *str* | :heavy_check_mark: | The currency of the bank transaction. | | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | The description of the bank transaction. | | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the bank transaction. | | -| `merchant_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the merchant. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `posted_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_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# BankingTransaction + +The Banking Transactions data type provides an immutable source of up-to-date information on income and expenditure. + +Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *str* | :heavy_check_mark: | The unique identifier of the bank account. | | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount of the bank transaction. | | +| `authorized_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 | +| `code` | [Optional[shared.TransactionCode]](../../models/shared/transactioncode.md) | :heavy_minus_sign: | Code to identify the underlying transaction. | | +| `currency` | *str* | :heavy_check_mark: | The currency of the bank transaction. | | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | The description of the bank transaction. | | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the bank transaction. | | +| `merchant_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the merchant. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `posted_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_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | | `transaction_category_ref` | [Optional[shared.TransactionCategoryRef]](../../models/shared/transactioncategoryref.md) | :heavy_minus_sign: | An object of bank transaction category reference data. | | \ No newline at end of file diff --git a/lending/docs/models/shared/bankingtransactioncategories.md b/lending/docs/models/shared/bankingtransactioncategories.md index a152809d2..cabd859d8 100644 --- a/lending/docs/models/shared/bankingtransactioncategories.md +++ b/lending/docs/models/shared/bankingtransactioncategories.md @@ -1,12 +1,12 @@ -# BankingTransactionCategories - - -## 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.BankingTransactionCategory]](../../models/shared/bankingtransactioncategory.md)] | :heavy_minus_sign: | N/A | | +# BankingTransactionCategories + + +## 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.BankingTransactionCategory]](../../models/shared/bankingtransactioncategory.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/lending/docs/models/shared/bankingtransactioncategory.md b/lending/docs/models/shared/bankingtransactioncategory.md index d2fbc1b0c..cd15da963 100644 --- a/lending/docs/models/shared/bankingtransactioncategory.md +++ b/lending/docs/models/shared/bankingtransactioncategory.md @@ -1,18 +1,18 @@ -# BankingTransactionCategory - -The Banking Transaction Categories data type provides a list of hierarchical categories associated with a transaction for greater contextual meaning to transaction activity. - -Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `has_children` | *Optional[bool]* | :heavy_minus_sign: | A Boolean indicating whether there are other bank transaction categories beneath this one in the hierarchy. | | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the bank transaction category. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *str* | :heavy_check_mark: | The name of the bank transaction category. | | -| `parent_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The unique identifier of the parent bank transaction category. | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# BankingTransactionCategory + +The Banking Transaction Categories data type provides a list of hierarchical categories associated with a transaction for greater contextual meaning to transaction activity. + +Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `has_children` | *Optional[bool]* | :heavy_minus_sign: | A Boolean indicating whether there are other bank transaction categories beneath this one in the hierarchy. | | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the bank transaction category. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *str* | :heavy_check_mark: | The name of the bank transaction category. | | +| `parent_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The unique identifier of the parent bank transaction category. | | +| `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.TransactionCategoryStatus]](../../models/shared/transactioncategorystatus.md) | :heavy_minus_sign: | The status of the transaction category. | | \ No newline at end of file diff --git a/lending/docs/models/shared/bankingtransactionref.md b/lending/docs/models/shared/bankingtransactionref.md index 5c6bcca9b..be186a0cc 100644 --- a/lending/docs/models/shared/bankingtransactionref.md +++ b/lending/docs/models/shared/bankingtransactionref.md @@ -1,14 +1,14 @@ -# BankingTransactionRef - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the bank transaction's account. | | -| `account_name` | *Optional[str]* | :heavy_minus_sign: | Name given to account. | | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Bank transaction amount. | | -| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the bank transaction's connection. | | -| `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 | -| `description` | *Optional[str]* | :heavy_minus_sign: | Description given to bank transaction. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the bank transaction. | | \ No newline at end of file +# BankingTransactionRef + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the bank transaction's account. | +| `account_name` | *Optional[str]* | :heavy_minus_sign: | Name given to account. | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Bank transaction amount. | +| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the bank transaction's connection. | +| `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. | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description given to bank transaction. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the bank transaction. | \ No newline at end of file diff --git a/lending/docs/models/shared/bankingtransactions.md b/lending/docs/models/shared/bankingtransactions.md index b483575ec..1239d0633 100644 --- a/lending/docs/models/shared/bankingtransactions.md +++ b/lending/docs/models/shared/bankingtransactions.md @@ -1,12 +1,12 @@ -# BankingTransactions - - -## 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.BankingTransaction]](../../models/shared/bankingtransaction.md)] | :heavy_minus_sign: | N/A | | +# BankingTransactions + + +## 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.BankingTransaction]](../../models/shared/bankingtransaction.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/lending/docs/models/shared/bankstatementuploadconfiguration.md b/lending/docs/models/shared/bankstatementuploadconfiguration.md index 03be244fc..7bc560379 100644 --- a/lending/docs/models/shared/bankstatementuploadconfiguration.md +++ b/lending/docs/models/shared/bankstatementuploadconfiguration.md @@ -1,12 +1,13 @@ -# BankStatementUploadConfiguration - -Configuration settings for uploading banking data to Codat - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `account_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the account in the third-party platform | -| `provider_id` | *Optional[str]* | :heavy_minus_sign: | TrueLayer provider ID (only required if source is TrueLayer) | +# BankStatementUploadConfiguration + +Configuration settings for uploading banking data to Codat + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `account_id` | *Optional[str]* | :heavy_minus_sign: | The ID of the account in the third-party platform | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `provider_id` | *Optional[str]* | :heavy_minus_sign: | TrueLayer provider ID (only required if source is TrueLayer) | | `source` | [Optional[shared.Source]](../../models/shared/source.md) | :heavy_minus_sign: | The source of the banking data that determines its format | \ No newline at end of file diff --git a/lending/docs/models/shared/banktransactiontype.md b/lending/docs/models/shared/banktransactiontype.md index 6d8a4e002..9b33663cb 100644 --- a/lending/docs/models/shared/banktransactiontype.md +++ b/lending/docs/models/shared/banktransactiontype.md @@ -1,35 +1,35 @@ -# BankTransactionType - -Type of transaction for the bank statement line. - -## Example Usage - -```python -from codat_lending.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_lending.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/lending/docs/models/shared/billcreditnotelineitem.md b/lending/docs/models/shared/billcreditnotelineitem.md index 970ed1831..9d78ff72e 100644 --- a/lending/docs/models/shared/billcreditnotelineitem.md +++ b/lending/docs/models/shared/billcreditnotelineitem.md @@ -1,22 +1,22 @@ -# BillCreditNoteLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `created_from_line_ref` | [Optional[shared.Zero]](../../models/shared/zero.md) | :heavy_minus_sign: | Links the current record line to the underlying record line that created it.

For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of each line item. For example, the goods or service for which credit has been received. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Value of any discounts applied. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the line item. | -| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of the goods or service for which credit has been received. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of credit associated with the line item, including discounts but excluding tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax associated with the line item. | -| `tax_rate_ref` | [Optional[shared.TaxRateReference]](../../models/shared/taxratereference.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | -| `tracking` | [Optional[shared.AccountsPayableTracking]](../../models/shared/accountspayabletracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | -| ~~`tracking_category_refs`~~ | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Reference to the tracking categories to which the line item is linked. | -| `unit_amount` | *Decimal* | :heavy_check_mark: | Unit price of the goods or service. | -| `unit_of_measurement` | *OptionalNullable[str]* | :heavy_minus_sign: | The measurement which defines a unit for this item (e.g. 'kilogram', 'litre'). | \ No newline at end of file +# BillCreditNoteLineItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | N/A | +| `created_from_line_ref` | [Optional[shared.RecordLineReference]](../../models/shared/recordlinereference.md) | :heavy_minus_sign: | Reference to the line of the item that the current line was created from. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of each line item. For example, the goods or service for which credit has been received. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Value of any discounts applied. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the line item. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | N/A | +| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of the goods or service for which credit has been received. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of credit associated with the line item, including discounts but excluding tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax associated with the line item. | +| `tax_rate_ref` | [Optional[shared.TaxRateReference]](../../models/shared/taxratereference.md) | :heavy_minus_sign: | N/A | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | +| `tracking` | [Optional[shared.AccountsPayableTracking]](../../models/shared/accountspayabletracking.md) | :heavy_minus_sign: | N/A | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories to which the line item is linked. | +| `unit_amount` | *Decimal* | :heavy_check_mark: | Unit price of the goods or service. | +| `unit_of_measurement` | *OptionalNullable[str]* | :heavy_minus_sign: | The measurement which defines a unit for this item (e.g. 'kilogram', 'litre'). | \ No newline at end of file diff --git a/lending/docs/models/shared/billcreditnotestatus.md b/lending/docs/models/shared/billcreditnotestatus.md index 56a207dc3..073ccf129 100644 --- a/lending/docs/models/shared/billcreditnotestatus.md +++ b/lending/docs/models/shared/billcreditnotestatus.md @@ -1,23 +1,21 @@ -# BillCreditNoteStatus - -Current state of the bill credit note - -## Example Usage - -```python -from codat_lending.models.shared import BillCreditNoteStatus - -value = BillCreditNoteStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `DRAFT` | Draft | -| `SUBMITTED` | Submitted | -| `PAID` | Paid | -| `VOID` | Void | +# BillCreditNoteStatus + +## Example Usage + +```python +from codat_lending.models.shared import BillCreditNoteStatus + +value = BillCreditNoteStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `DRAFT` | Draft | +| `SUBMITTED` | Submitted | +| `PAID` | Paid | +| `VOID` | Void | | `PARTIALLY_PAID` | PartiallyPaid | \ No newline at end of file diff --git a/lending/docs/models/shared/billedtotype.md b/lending/docs/models/shared/billedtotype.md index 64d401594..62bc88ad4 100644 --- a/lending/docs/models/shared/billedtotype.md +++ b/lending/docs/models/shared/billedtotype.md @@ -1,21 +1,19 @@ -# BilledToType - -Defines if the invoice or credit note is billed/rebilled to a project or customer. - -## Example Usage - -```python -from codat_lending.models.shared import BilledToType - -value = BilledToType.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `NOT_APPLICABLE` | NotApplicable | -| `CUSTOMER` | Customer | +# BilledToType + +## Example Usage + +```python +from codat_lending.models.shared import BilledToType + +value = BilledToType.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `NOT_APPLICABLE` | NotApplicable | +| `CUSTOMER` | Customer | | `PROJECT` | Project | \ No newline at end of file diff --git a/lending/docs/models/shared/billedtotype1.md b/lending/docs/models/shared/billedtotype1.md index e075008d3..b94c6479f 100644 --- a/lending/docs/models/shared/billedtotype1.md +++ b/lending/docs/models/shared/billedtotype1.md @@ -1,20 +1,18 @@ -# BilledToType1 - -Defines if the bill or bill credit note is billed/rebilled to a project. - -## Example Usage - -```python -from codat_lending.models.shared import BilledToType1 - -value = BilledToType1.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `NOT_APPLICABLE` | NotApplicable | +# BilledToType1 + +## Example Usage + +```python +from codat_lending.models.shared import BilledToType1 + +value = BilledToType1.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `NOT_APPLICABLE` | NotApplicable | | `PROJECT` | Project | \ No newline at end of file diff --git a/lending/docs/models/shared/billlineitem.md b/lending/docs/models/shared/billlineitem.md index 1342bb63f..384b38b22 100644 --- a/lending/docs/models/shared/billlineitem.md +++ b/lending/docs/models/shared/billlineitem.md @@ -1,24 +1,24 @@ -# BillLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services received. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of any discounts applied.

Do not use to apply discounts in Oracle NetSuite—see Oracle NetSuite integration reference. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the bill. | -| `is_direct_cost` | *Optional[bool]* | :heavy_minus_sign: | The bill is a direct cost if `True`. | -| `item_ref` | [Optional[shared.PropertieItemRef]](../../models/shared/propertieitemref.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `line_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The bill line's number. | -| `purchase_order_line_ref` | [Optional[shared.RecordLineReference]](../../models/shared/recordlinereference.md) | :heavy_minus_sign: | N/A | -| `quantity` | *Optional[Decimal]* | :heavy_minus_sign: | Number of units of goods or services received. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | -| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. | -| `tracking` | [Optional[shared.AccountsPayableTracking]](../../models/shared/accountspayabletracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | -| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Collection of categories against which this item is tracked. | -| `unit_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Price of each unit of goods or services. | +# BillLineItem + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services received. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of any discounts applied.

Do not use to apply discounts in Oracle NetSuite—see Oracle NetSuite integration reference. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the bill. | +| `is_direct_cost` | *Optional[bool]* | :heavy_minus_sign: | The bill is a direct cost if `True`. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | +| `line_number` | *OptionalNullable[str]* | :heavy_minus_sign: | The bill line's number. | +| `purchase_order_line_ref` | [Optional[shared.BillLineItemPurchaseOrderLineRef]](../../models/shared/billlineitempurchaseorderlineref.md) | :heavy_minus_sign: | N/A | +| `quantity` | *Optional[Decimal]* | :heavy_minus_sign: | Number of units of goods or services received. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | +| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. | +| `tracking` | [Optional[shared.AccountsPayableTracking]](../../models/shared/accountspayabletracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Collection of categories against which this item is tracked. | +| `unit_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Price of each unit of goods or services. | | `unit_of_measurement` | *OptionalNullable[str]* | :heavy_minus_sign: | The measurement which defines a unit for this item (e.g. 'kilogram', 'litre'). | \ No newline at end of file diff --git a/lending/docs/models/shared/billlineitemdatatype.md b/lending/docs/models/shared/billlineitemdatatype.md index 8a7a3c7ed..154405d06 100644 --- a/lending/docs/models/shared/billlineitemdatatype.md +++ b/lending/docs/models/shared/billlineitemdatatype.md @@ -1,19 +1,19 @@ -# BillLineItemDataType - -Allowed name of the 'dataType'. - -## Example Usage - -```python -from codat_lending.models.shared import BillLineItemDataType - -value = BillLineItemDataType.PURCHASE_ORDERS -``` - - -## Values - -| Name | Value | -| ----------------- | ----------------- | -| `PURCHASE_ORDERS` | purchaseOrders | +# BillLineItemDataType + +Allowed name of the 'dataType'. + +## Example Usage + +```python +from codat_lending.models.shared import BillLineItemDataType + +value = BillLineItemDataType.PURCHASE_ORDERS +``` + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `PURCHASE_ORDERS` | purchaseOrders | | `BILLS` | bills | \ No newline at end of file diff --git a/lending/docs/models/shared/billlineitempurchaseorderlinerefdatatype.md b/lending/docs/models/shared/billlineitempurchaseorderlinerefdatatype.md new file mode 100644 index 000000000..e91e6b5ff --- /dev/null +++ b/lending/docs/models/shared/billlineitempurchaseorderlinerefdatatype.md @@ -0,0 +1,17 @@ +# BillLineItemPurchaseOrderLineRefDataType + +## Example Usage + +```python +from codat_lending.models.shared import BillLineItemPurchaseOrderLineRefDataType + +value = BillLineItemPurchaseOrderLineRefDataType.PURCHASE_ORDERS +``` + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `PURCHASE_ORDERS` | purchaseOrders | +| `BILLS` | bills | \ No newline at end of file diff --git a/lending/docs/models/shared/billpaymentline.md b/lending/docs/models/shared/billpaymentline.md index fc0bb7d67..dca2410b6 100644 --- a/lending/docs/models/shared/billpaymentline.md +++ b/lending/docs/models/shared/billpaymentline.md @@ -1,10 +1,10 @@ -# BillPaymentLine - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allocated_on_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 | -| `amount` | *Decimal* | :heavy_check_mark: | Amount in the bill payment currency. | | -| `links` | List[[shared.BillPaymentLineLink](../../models/shared/billpaymentlinelink.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file +# BillPaymentLine + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allocated_on_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. | +| `amount` | *Decimal* | :heavy_check_mark: | Amount in the bill payment currency. | +| `links` | List[[shared.BillPaymentLineLink](../../models/shared/billpaymentlinelink.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/billpaymentlinelink.md b/lending/docs/models/shared/billpaymentlinelink.md index c28f1e0df..75b22cab5 100644 --- a/lending/docs/models/shared/billpaymentlinelink.md +++ b/lending/docs/models/shared/billpaymentlinelink.md @@ -1,11 +1,11 @@ -# BillPaymentLineLink - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity.

- A negative link amount reduces the outstanding amount on the accounts payable account.
- A positive link amount increases the outstanding amount on the accounts payable account. | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier of the transaction represented by the link. | -| `type` | [shared.BillPaymentLineLinkType](../../models/shared/billpaymentlinelinktype.md) | :heavy_check_mark: | Types of links to bill payment lines. | \ No newline at end of file +# BillPaymentLineLink + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity. - A negative link amount reduces the outstanding amount on the accounts payable account. - A positive link amount increases the outstanding amount on the accounts payable account. | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier of the transaction represented by the link. | +| `type` | [shared.BillPaymentLineLinkType](../../models/shared/billpaymentlinelinktype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/billpaymentlinelinktype.md b/lending/docs/models/shared/billpaymentlinelinktype.md index bb0f43694..94e89378d 100644 --- a/lending/docs/models/shared/billpaymentlinelinktype.md +++ b/lending/docs/models/shared/billpaymentlinelinktype.md @@ -1,27 +1,25 @@ -# BillPaymentLineLinkType - -Types of links to bill payment lines. - -## Example Usage - -```python -from codat_lending.models.shared import BillPaymentLineLinkType - -value = BillPaymentLineLinkType.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `UNKNOWN` | Unknown | -| `UNLINKED` | Unlinked | -| `BILL` | Bill | -| `OTHER` | Other | -| `CREDIT_NOTE` | CreditNote | -| `BILL_PAYMENT` | BillPayment | -| `PAYMENT_ON_ACCOUNT` | PaymentOnAccount | -| `REFUND` | Refund | -| `MANUAL_JOURNAL` | ManualJournal | +# BillPaymentLineLinkType + +## Example Usage + +```python +from codat_lending.models.shared import BillPaymentLineLinkType + +value = BillPaymentLineLinkType.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------------- | -------------------- | +| `UNKNOWN` | Unknown | +| `UNLINKED` | Unlinked | +| `BILL` | Bill | +| `OTHER` | Other | +| `CREDIT_NOTE` | CreditNote | +| `BILL_PAYMENT` | BillPayment | +| `PAYMENT_ON_ACCOUNT` | PaymentOnAccount | +| `REFUND` | Refund | +| `MANUAL_JOURNAL` | ManualJournal | | `DISCOUNT` | Discount | \ No newline at end of file diff --git a/lending/docs/models/shared/billstatus.md b/lending/docs/models/shared/billstatus.md index 73bc4be0d..abc3efcf6 100644 --- a/lending/docs/models/shared/billstatus.md +++ b/lending/docs/models/shared/billstatus.md @@ -1,23 +1,21 @@ -# BillStatus - -Current state of the bill. - -## Example Usage - -```python -from codat_lending.models.shared import BillStatus - -value = BillStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `OPEN` | Open | -| `PARTIALLY_PAID` | PartiallyPaid | -| `PAID` | Paid | -| `VOID` | Void | +# BillStatus + +## Example Usage + +```python +from codat_lending.models.shared import BillStatus + +value = BillStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `OPEN` | Open | +| `PARTIALLY_PAID` | PartiallyPaid | +| `PAID` | Paid | +| `VOID` | Void | | `DRAFT` | Draft | \ No newline at end of file diff --git a/lending/docs/models/shared/cashflowstatement.md b/lending/docs/models/shared/cashflowstatement.md index cf7d8dd6a..35f12caa6 100644 --- a/lending/docs/models/shared/cashflowstatement.md +++ b/lending/docs/models/shared/cashflowstatement.md @@ -1,11 +1,11 @@ -# CashFlowStatement - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cash_payments` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `cash_receipts` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `from_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 | +# CashFlowStatement + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cash_payments` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLines for cash payments to suppliers for the purchase of goods or services. | | +| `cash_receipts` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLines for cash receipts from the sale of goods. | | +| `from_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 | | `to_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/cashflowtransaction.md b/lending/docs/models/shared/cashflowtransaction.md index 542dba574..d37740bdb 100644 --- a/lending/docs/models/shared/cashflowtransaction.md +++ b/lending/docs/models/shared/cashflowtransaction.md @@ -1,19 +1,19 @@ -# CashFlowTransaction - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | An account reference containing the account id and name. | | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The bank transaction amount. | | -| `counterparty_names` | List[*str*] | :heavy_minus_sign: | An array of counterparty names involved in the transaction. | | -| `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 | -| `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 | -| `description` | *Optional[str]* | :heavy_minus_sign: | The description of the bank transaction. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier of the bank transaction. | | -| `is_recurring` | *OptionalNullable[bool]* | :heavy_minus_sign: | Indicates if the transaction is classified as recurring by Codat's categorization engine. | | -| `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 | -| `platform_name` | *Optional[str]* | :heavy_minus_sign: | Returns the payment processor responsible for the transaction. | | -| `source_ref` | [Optional[shared.SourceRef]](../../models/shared/sourceref.md) | :heavy_minus_sign: | A source reference containing the `sourceType` object "Banking". | {
"Example": {
"value": {
"sourceRef": {
"sourceType": "Banking"
}
}
}
} | -| `transaction_category` | [Optional[shared.TransactionCategory]](../../models/shared/transactioncategory.md) | :heavy_minus_sign: | N/A | {
"Example": {
"value": {
"transactionCategory": {
"confidence": 92.7,
"levels": [
"Asset",
"Current",
"Bank",
"BankTransfers",
"ShareholderTransfers"
],
"confidences": [
92.7,
95,
96,
97.5,
100
]
}
}
}
} | \ No newline at end of file +# CashFlowTransaction + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | An account reference containing the account id and name. | {
"Example": {
"value": {
"accountRef": {
"id": "4f78a6b0-e9bb-40f2-82fd-f3a2daa1fd0a",
"name": "Business Current Account"
}
}
}
} | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The bank transaction amount. | | +| `counterparty_names` | List[*str*] | :heavy_minus_sign: | An array of counterparty names involved in the transaction. | | +| `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 | +| `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 | +| `description` | *Optional[str]* | :heavy_minus_sign: | The description of the bank transaction. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier of the bank transaction. | | +| `is_recurring` | *OptionalNullable[bool]* | :heavy_minus_sign: | Indicates if the transaction is classified as recurring by Codat's categorization engine. | | +| `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 | +| `platform_name` | *Optional[str]* | :heavy_minus_sign: | Returns the payment processor responsible for the transaction. | | +| `source_ref` | [Optional[shared.SourceRef]](../../models/shared/sourceref.md) | :heavy_minus_sign: | A source reference containing the `sourceType` object "Banking". | {
"Example": {
"value": {
"sourceRef": {
"sourceType": "Banking"
}
}
}
} | +| `transaction_category` | [Optional[shared.TransactionCategory]](../../models/shared/transactioncategory.md) | :heavy_minus_sign: | Contains an array of category levels. | {
"Example": {
"value": {
"transactionCategory": {
"confidence": 92.7,
"levels": [
"Asset",
"Current",
"Bank",
"BankTransfers",
"ShareholderTransfers"
],
"confidences": [
92.7,
95,
96,
97.5,
100
]
}
}
}
} | \ No newline at end of file diff --git a/lending/docs/models/shared/categorizedbankstatementaccounts.md b/lending/docs/models/shared/categorizedbankstatementaccounts.md new file mode 100644 index 000000000..6f0fd7afa --- /dev/null +++ b/lending/docs/models/shared/categorizedbankstatementaccounts.md @@ -0,0 +1,18 @@ +# CategorizedBankStatementAccounts + +> **Categorization engine** +> +> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. + +The Enhanced Cash Flow accounts endpoint provides a list of accounts that categorized transactions have been taken from. + + +## 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.Account](../../models/shared/account.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/lending/docs/models/shared/categorizedbankstatementtransactions.md b/lending/docs/models/shared/categorizedbankstatementtransactions.md new file mode 100644 index 000000000..417e52e3d --- /dev/null +++ b/lending/docs/models/shared/categorizedbankstatementtransactions.md @@ -0,0 +1,18 @@ +# CategorizedBankStatementTransactions + +> **Categorization engine** +> +> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. + +The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. + + +## 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.CashFlowTransaction](../../models/shared/cashflowtransaction.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/lending/docs/models/shared/clientratelimitwebhook.md b/lending/docs/models/shared/clientratelimitwebhook.md index 36e2030f0..8ecf1141e 100644 --- a/lending/docs/models/shared/clientratelimitwebhook.md +++ b/lending/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/lending/docs/models/shared/clientratelimitwebhookpayload.md b/lending/docs/models/shared/clientratelimitwebhookpayload.md index 41b82096c..ae6051b29 100644 --- a/lending/docs/models/shared/clientratelimitwebhookpayload.md +++ b/lending/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/lending/docs/models/shared/codatfile.md b/lending/docs/models/shared/codatfile.md index 07b4ca48c..3eba70262 100644 --- a/lending/docs/models/shared/codatfile.md +++ b/lending/docs/models/shared/codatfile.md @@ -1,10 +1,10 @@ -# CodatFile - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| `content` | *Union[bytes, IO[bytes], io.BufferedReader]* | :heavy_check_mark: | N/A | -| `content_type` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `file_name` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +# CodatFile + + +## Fields + +| Field | Type | Required | Description | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `content` | *Union[bytes, IO[bytes]]* | :heavy_check_mark: | N/A | +| `content_type` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `file_name` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/commerceaddress.md b/lending/docs/models/shared/commerceaddress.md index a0c582e06..4ef80ab9a 100644 --- a/lending/docs/models/shared/commerceaddress.md +++ b/lending/docs/models/shared/commerceaddress.md @@ -1,14 +1,14 @@ -# CommerceAddress - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `city` | *Optional[str]* | :heavy_minus_sign: | The third line of the address, or city | -| `country` | *Optional[str]* | :heavy_minus_sign: | The country for the address | -| `line1` | *Optional[str]* | :heavy_minus_sign: | The first line of the address | -| `line2` | *Optional[str]* | :heavy_minus_sign: | The second line of the address | -| `postal_code` | *Optional[str]* | :heavy_minus_sign: | The postal (or zip) code for the address | -| `region` | *Optional[str]* | :heavy_minus_sign: | The fourth line of the address, or region | +# CommerceAddress + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `city` | *Optional[str]* | :heavy_minus_sign: | The third line of the address, or city | +| `country` | *Optional[str]* | :heavy_minus_sign: | The country for the address | +| `line1` | *Optional[str]* | :heavy_minus_sign: | The first line of the address | +| `line2` | *Optional[str]* | :heavy_minus_sign: | The second line of the address | +| `postal_code` | *Optional[str]* | :heavy_minus_sign: | The postal (or zip) code for the address | +| `region` | *Optional[str]* | :heavy_minus_sign: | The fourth line of the address, or region | | `type` | [Optional[shared.CommerceAddressType]](../../models/shared/commerceaddresstype.md) | :heavy_minus_sign: | The type of the address | \ No newline at end of file diff --git a/lending/docs/models/shared/commerceaddresstype.md b/lending/docs/models/shared/commerceaddresstype.md index 928bc5f23..cf85bff1a 100644 --- a/lending/docs/models/shared/commerceaddresstype.md +++ b/lending/docs/models/shared/commerceaddresstype.md @@ -1,22 +1,20 @@ -# CommerceAddressType - -The type of the address - -## Example Usage - -```python -from codat_lending.models.shared import CommerceAddressType - -value = CommerceAddressType.BILLING -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `BILLING` | Billing | -| `DELIVERY` | Delivery | -| `ORDER` | Order | -| `INVENTORY` | Inventory | +# CommerceAddressType + +## Example Usage + +```python +from codat_lending.models.shared import CommerceAddressType + +value = CommerceAddressType.BILLING +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `BILLING` | Billing | +| `DELIVERY` | Delivery | +| `ORDER` | Order | +| `INVENTORY` | Inventory | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/commercecompanyinfo.md b/lending/docs/models/shared/commercecompanyinfo.md index 1f011eb97..99bc8d191 100644 --- a/lending/docs/models/shared/commercecompanyinfo.md +++ b/lending/docs/models/shared/commercecompanyinfo.md @@ -1,24 +1,24 @@ -# CommerceCompanyInfo - -In the Codat system, company profile includes standard commercial details about -a linked company, such as their address, phone number, and company registration. - - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_balances` | List[[shared.AccountBalance](../../models/shared/accountbalance.md)] | :heavy_minus_sign: | The available and current cash balances for the company's accounts | | -| `addresses` | List[[shared.CommerceAddress](../../models/shared/commerceaddress.md)] | :heavy_minus_sign: | Addresses associated with the company | | -| `base_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 | -| `commerce_platform_ref` | *Optional[str]* | :heavy_minus_sign: | Identifier or reference for the company in the commerce software | | -| `company_legal_name` | *Optional[str]* | :heavy_minus_sign: | The full legal name of the company | Codat Limited | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | The name of the company | Codat | -| `created_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 | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `phone_numbers` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | Phone numbers associated with the company | | -| `registration_number` | *Optional[str]* | :heavy_minus_sign: | The registration number of the company | 10480375 | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `source_urls` | Dict[str, *str*] | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | {
"url1": "https://connect.sandbox.com/v2/customers",
"url2": "https://connect.sandbox.com/v2/disputes"
} | +# CommerceCompanyInfo + +In the Codat system, company profile includes standard commercial details about +a linked company, such as their address, phone number, and company registration. + + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_balances` | List[[shared.AccountBalance](../../models/shared/accountbalance.md)] | :heavy_minus_sign: | The available and current cash balances for the company's accounts | | +| `addresses` | List[[shared.CommerceAddress](../../models/shared/commerceaddress.md)] | :heavy_minus_sign: | Addresses associated with the company | | +| `base_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 | +| `commerce_platform_ref` | *Optional[str]* | :heavy_minus_sign: | Identifier or reference for the company in the commerce software | | +| `company_legal_name` | *Optional[str]* | :heavy_minus_sign: | The full legal name of the company | Codat Limited | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | The name of the company | Codat | +| `created_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 | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `phone_numbers` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | Phone numbers associated with the company | | +| `registration_number` | *Optional[str]* | :heavy_minus_sign: | The registration number of the company | 10480375 | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `source_urls` | Dict[str, *str*] | :heavy_minus_sign: | URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system | {
"url1": "https://connect.sandbox.com/v2/customers",
"url2": "https://connect.sandbox.com/v2/disputes"
} | | `web_links` | List[[shared.WebLink](../../models/shared/weblink.md)] | :heavy_minus_sign: | Weblinks associated with the company | | \ No newline at end of file diff --git a/lending/docs/models/shared/commercecustomer.md b/lending/docs/models/shared/commercecustomer.md index ebf47fc53..8b77c169f 100644 --- a/lending/docs/models/shared/commercecustomer.md +++ b/lending/docs/models/shared/commercecustomer.md @@ -1,19 +1,19 @@ -# CommerceCustomer - -When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `addresses` | List[[shared.CommerceAddress](../../models/shared/commerceaddress.md)] | :heavy_minus_sign: | Addresses of the customer | | -| `created_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 | -| `customer_name` | *Optional[str]* | :heavy_minus_sign: | Name of the customer | Fred Smith | -| `default_currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `email_address` | *Optional[str]* | :heavy_minus_sign: | Email address of the customer | fred.smith@myCompany.com | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `note` | *Optional[str]* | :heavy_minus_sign: | Any additional information about the customer | | -| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | A phone number. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | +# CommerceCustomer + +When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `addresses` | List[[shared.CommerceAddress](../../models/shared/commerceaddress.md)] | :heavy_minus_sign: | Addresses of the customer | | +| `created_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 | +| `customer_name` | *Optional[str]* | :heavy_minus_sign: | Name of the customer | Fred Smith | +| `default_currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `email_address` | *Optional[str]* | :heavy_minus_sign: | Email address of the customer | fred.smith@myCompany.com | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `note` | *Optional[str]* | :heavy_minus_sign: | Any additional information about the customer | | +| `phone` | *OptionalNullable[str]* | :heavy_minus_sign: | A phone number. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | | `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/commercecustomerref.md b/lending/docs/models/shared/commercecustomerref.md index 581921de8..3cf1482a3 100644 --- a/lending/docs/models/shared/commercecustomerref.md +++ b/lending/docs/models/shared/commercecustomerref.md @@ -1,11 +1,9 @@ -# CommerceCustomerRef - -Reference to the customer that placed the order. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identitifer of the customer being referenced | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the customer being referenced. | | \ No newline at end of file +# CommerceCustomerRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identitifer of the customer being referenced | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the customer being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/commercecustomers.md b/lending/docs/models/shared/commercecustomers.md index a47ccef6d..c309df55c 100644 --- a/lending/docs/models/shared/commercecustomers.md +++ b/lending/docs/models/shared/commercecustomers.md @@ -1,12 +1,12 @@ -# CommerceCustomers - - -## 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.CommerceCustomer]](../../models/shared/commercecustomer.md)] | :heavy_minus_sign: | N/A | | +# CommerceCustomers + + +## 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.CommerceCustomer]](../../models/shared/commercecustomer.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/lending/docs/models/shared/commercedispute.md b/lending/docs/models/shared/commercedispute.md index 4f749faca..ecfb5f72e 100644 --- a/lending/docs/models/shared/commercedispute.md +++ b/lending/docs/models/shared/commercedispute.md @@ -1,24 +1,24 @@ -# CommerceDispute - -A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example: -- They didn't receive an order. -- The product they received was different to the commerce store's description. -- They've been the victim of online fraud. - -You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created_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 | -| `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 | -| `disputed_transactions` | List[[shared.TransactionSourceRef](../../models/shared/transactionsourceref.md)] | :heavy_minus_sign: | Link to the source event(s) which triggered this transaction. | | -| `due_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `reason` | *Optional[str]* | :heavy_minus_sign: | Reason for the dispute | Unhappy with product | -| `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.DisputeStatus]](../../models/shared/disputestatus.md) | :heavy_minus_sign: | Current status of the dispute | EvidenceRequired | +# CommerceDispute + +A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example: +- They didn't receive an order. +- The product they received was different to the commerce store's description. +- They've been the victim of online fraud. + +You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_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 | +| `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 | +| `disputed_transactions` | List[[shared.TransactionSourceRef](../../models/shared/transactionsourceref.md)] | :heavy_minus_sign: | Link to the source event(s) which triggered this transaction. | | +| `due_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `reason` | *Optional[str]* | :heavy_minus_sign: | Reason for the dispute | Unhappy with product | +| `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.DisputeStatus]](../../models/shared/disputestatus.md) | :heavy_minus_sign: | Current status of the dispute | EvidenceRequired | | `total_amount` | *Optional[Any]* | :heavy_minus_sign: | Total transaction amount that is under dispute. | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | \ No newline at end of file diff --git a/lending/docs/models/shared/commercedisputes.md b/lending/docs/models/shared/commercedisputes.md index c0206afec..05f996d4c 100644 --- a/lending/docs/models/shared/commercedisputes.md +++ b/lending/docs/models/shared/commercedisputes.md @@ -1,12 +1,12 @@ -# CommerceDisputes - - -## 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.CommerceDispute]](../../models/shared/commercedispute.md)] | :heavy_minus_sign: | N/A | | +# CommerceDisputes + + +## 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.CommerceDispute]](../../models/shared/commercedispute.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/lending/docs/models/shared/commercelocation.md b/lending/docs/models/shared/commercelocation.md index d05cac891..07a4b3db2 100644 --- a/lending/docs/models/shared/commercelocation.md +++ b/lending/docs/models/shared/commercelocation.md @@ -1,16 +1,16 @@ -# CommerceLocation - -The Location datatype holds information on the geographic location at which stocks of products may be held, as referenced in the Products data type. - -A Location also holds information on geographic locations where orders were placed, as referenced in the Orders data type. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `address` | [Optional[shared.CommerceAddress]](../../models/shared/commerceaddress.md) | :heavy_minus_sign: | N/A | | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of this location | | +# CommerceLocation + +The Location datatype holds information on the geographic location at which stocks of products may be held, as referenced in the Products data type. + +A Location also holds information on geographic locations where orders were placed, as referenced in the Orders data type. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `address` | [Optional[shared.CommerceAddress]](../../models/shared/commerceaddress.md) | :heavy_minus_sign: | Address associated with the location | | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of this location | | | `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/commercelocations.md b/lending/docs/models/shared/commercelocations.md index 8d6710086..bf91b4045 100644 --- a/lending/docs/models/shared/commercelocations.md +++ b/lending/docs/models/shared/commercelocations.md @@ -1,12 +1,12 @@ -# CommerceLocations - - -## 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.CommerceLocation]](../../models/shared/commercelocation.md)] | :heavy_minus_sign: | N/A | | +# CommerceLocations + + +## 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.CommerceLocation]](../../models/shared/commercelocation.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/lending/docs/models/shared/commerceorder.md b/lending/docs/models/shared/commerceorder.md index 313248927..0d425e95d 100644 --- a/lending/docs/models/shared/commerceorder.md +++ b/lending/docs/models/shared/commerceorder.md @@ -1,29 +1,29 @@ -# CommerceOrder - -Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR). - - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `closed_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 | -| `country` | *Optional[str]* | :heavy_minus_sign: | The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part.

Depending on the platform the value of this property will either be an ISO 3166 code (2-alpha or 3-alpha) or free-form text returned as a string name in our model.

For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/lending-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint. | **Example 1:** GBR
**Example 2:** USA
**Example 3:** ABW | -| `created_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 | -| `currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | -| `customer_ref` | [Optional[shared.CommerceCustomerRef]](../../models/shared/commercecustomerref.md) | :heavy_minus_sign: | Reference to the customer that placed the order. | | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `location_ref` | [Optional[shared.LocationRef]](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `order_line_items` | List[[shared.OrderLineItem](../../models/shared/orderlineitem.md)] | :heavy_minus_sign: | N/A | | -| `order_number` | *Optional[str]* | :heavy_minus_sign: | Friendly reference for the order in the commerce or point of sale platform. | | -| `payments` | List[[Nullable[shared.PaymentRef]](../../models/shared/paymentref.md)] | :heavy_minus_sign: | N/A | | -| `service_charges` | List[[shared.ServiceCharge](../../models/shared/servicecharge.md)] | :heavy_minus_sign: | N/A | | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `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. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. | | -| `total_discount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order). | | -| `total_gratuity` | *Optional[Decimal]* | :heavy_minus_sign: | Extra amount added to the order. | | -| `total_refund` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative. | | +# CommerceOrder + +Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR). + + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `closed_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 | +| `country` | *Optional[str]* | :heavy_minus_sign: | The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part.

Depending on the platform the value of this property will either be an ISO 3166 code (2-alpha or 3-alpha) or free-form text returned as a string name in our model.

For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/lending-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint. | **Example 1:** GBR
**Example 2:** USA
**Example 3:** ABW | +| `created_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 | +| `currency` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** GBP
**Example 2:** USD
**Example 3:** EUR | +| `customer_ref` | [Optional[shared.CommerceCustomerRef]](../../models/shared/commercecustomerref.md) | :heavy_minus_sign: | Reference to the customer that placed the order. | | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `location_ref` | [Optional[shared.LocationRef]](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `order_line_items` | List[[shared.OrderLineItem](../../models/shared/orderlineitem.md)] | :heavy_minus_sign: | N/A | | +| `order_number` | *Optional[str]* | :heavy_minus_sign: | Friendly reference for the order in the commerce or point of sale platform. | | +| `payments` | List[[Nullable[shared.PaymentRef]](../../models/shared/paymentref.md)] | :heavy_minus_sign: | N/A | | +| `service_charges` | List[[shared.ServiceCharge](../../models/shared/servicecharge.md)] | :heavy_minus_sign: | N/A | | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `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. | | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the order, including discounts, refunds, and tax, but excluding gratuities. | | +| `total_discount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order). | | +| `total_gratuity` | *Optional[Decimal]* | :heavy_minus_sign: | Extra amount added to the order. | | +| `total_refund` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative. | | | `total_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of tax applied to the order. | | \ No newline at end of file diff --git a/lending/docs/models/shared/commerceorders.md b/lending/docs/models/shared/commerceorders.md index b3470d8a8..57d1a7ee1 100644 --- a/lending/docs/models/shared/commerceorders.md +++ b/lending/docs/models/shared/commerceorders.md @@ -1,12 +1,12 @@ -# CommerceOrders - - -## 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.CommerceOrder]](../../models/shared/commerceorder.md)] | :heavy_minus_sign: | N/A | | +# CommerceOrders + + +## 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.CommerceOrder]](../../models/shared/commerceorder.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/lending/docs/models/shared/commercepayment.md b/lending/docs/models/shared/commercepayment.md index c699d32ed..80c10f28d 100644 --- a/lending/docs/models/shared/commercepayment.md +++ b/lending/docs/models/shared/commercepayment.md @@ -1,24 +1,24 @@ -# CommercePayment - -Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. - -Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`. - -You can use data from the Payments endpoints to calculate key metrics, such as gross sales and monthly recurring revenue (MRR). - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Payment Amount (including gratuity) | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | -| `created_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 | -| `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 | -| `due_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | -| `payment_provider` | *Optional[str]* | :heavy_minus_sign: | Service provider of the payment, if applicable. | **Example 1:** Amazon Pay
**Example 2:** Checkout.com
**Example 3:** SagePay | -| `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.PaymentStatus]](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | +# CommercePayment + +Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. + +Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`. + +You can use data from the Payments endpoints to calculate key metrics, such as gross sales and monthly recurring revenue (MRR). + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Payment Amount (including gratuity) | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | +| `created_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 | +| `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 | +| `due_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `payment_method_ref` | [Optional[shared.PaymentMethodRef]](../../models/shared/paymentmethodref.md) | :heavy_minus_sign: | The payment method the record is linked to in the accounting or commerce software. | {
"id": "EILBDVJVNUAGVKRQ",
"name": "AliPay"
} | +| `payment_provider` | *Optional[str]* | :heavy_minus_sign: | Service provider of the payment, if applicable. | **Example 1:** Amazon Pay
**Example 2:** Checkout.com
**Example 3:** SagePay | +| `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.PaymentStatus]](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | | `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 diff --git a/lending/docs/models/shared/commercepaymentmethod.md b/lending/docs/models/shared/commercepaymentmethod.md index cd3885d5c..819338967 100644 --- a/lending/docs/models/shared/commercepaymentmethod.md +++ b/lending/docs/models/shared/commercepaymentmethod.md @@ -1,14 +1,14 @@ -# CommercePaymentMethod - -A Payment Method represents the payment method(s) used to make payments. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the PaymentMethod | Alipay | -| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +# CommercePaymentMethod + +A Payment Method represents the payment method(s) used to make payments. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the PaymentMethod | Alipay | +| `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.CommercePaymentMethodStatus]](../../models/shared/commercepaymentmethodstatus.md) | :heavy_minus_sign: | Status of the Payment Method. | | \ No newline at end of file diff --git a/lending/docs/models/shared/commercepaymentmethods.md b/lending/docs/models/shared/commercepaymentmethods.md index 72f1af46b..21f01ca45 100644 --- a/lending/docs/models/shared/commercepaymentmethods.md +++ b/lending/docs/models/shared/commercepaymentmethods.md @@ -1,12 +1,12 @@ -# CommercePaymentMethods - - -## 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.CommercePaymentMethod]](../../models/shared/commercepaymentmethod.md)] | :heavy_minus_sign: | N/A | | +# CommercePaymentMethods + + +## 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.CommercePaymentMethod]](../../models/shared/commercepaymentmethod.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/lending/docs/models/shared/commercepaymentmethodstatus.md b/lending/docs/models/shared/commercepaymentmethodstatus.md index 1e0f539db..744ebf624 100644 --- a/lending/docs/models/shared/commercepaymentmethodstatus.md +++ b/lending/docs/models/shared/commercepaymentmethodstatus.md @@ -1,20 +1,18 @@ -# CommercePaymentMethodStatus - -Status of the Payment Method. - -## Example Usage - -```python -from codat_lending.models.shared import CommercePaymentMethodStatus - -value = CommercePaymentMethodStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | +# CommercePaymentMethodStatus + +## Example Usage + +```python +from codat_lending.models.shared import CommercePaymentMethodStatus + +value = CommercePaymentMethodStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | | `ARCHIVED` | Archived | \ No newline at end of file diff --git a/lending/docs/models/shared/commercepayments.md b/lending/docs/models/shared/commercepayments.md index 632407ce8..881203b2a 100644 --- a/lending/docs/models/shared/commercepayments.md +++ b/lending/docs/models/shared/commercepayments.md @@ -1,12 +1,12 @@ -# CommercePayments - - -## 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.CommercePayment]](../../models/shared/commercepayment.md)] | :heavy_minus_sign: | N/A | | +# CommercePayments + + +## 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.CommercePayment]](../../models/shared/commercepayment.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/lending/docs/models/shared/commerceproduct.md b/lending/docs/models/shared/commerceproduct.md index b633a5c88..6e92d8d9b 100644 --- a/lending/docs/models/shared/commerceproduct.md +++ b/lending/docs/models/shared/commerceproduct.md @@ -1,17 +1,17 @@ -# CommerceProduct - -A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale. - - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `categorization` | *Optional[str]* | :heavy_minus_sign: | Retail category that the product is assigned to e.g. `Hardware`. | **Example 1:** Hardware
**Example 2:** Software
**Example 3:** Support Services | -| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the product recorded in the commerce or point of sale platform. | **Example 1:** 1tb Western Digital Hard Drive
**Example 2:** Install of Windows 11 (Professional Edition)
**Example 3:** 1 hour of support from an agent (phone or remote) | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `is_gift_card` | *Optional[bool]* | :heavy_minus_sign: | Whether the product represents a gift card or voucher that
can be redeemed in the commerce or POS platform.
| | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product in the commerce or POS system | **Example 1:** Hard Drive
**Example 2:** Windows Installation
**Example 3:** Software Support (Hourly) | -| `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. | | +# CommerceProduct + +A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale. + + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `categorization` | *Optional[str]* | :heavy_minus_sign: | Retail category that the product is assigned to e.g. `Hardware`. | **Example 1:** Hardware
**Example 2:** Software
**Example 3:** Support Services | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the product recorded in the commerce or point of sale platform. | **Example 1:** 1tb Western Digital Hard Drive
**Example 2:** Install of Windows 11 (Professional Edition)
**Example 3:** 1 hour of support from an agent (phone or remote) | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `is_gift_card` | *Optional[bool]* | :heavy_minus_sign: | Whether the product represents a gift card or voucher that
can be redeemed in the commerce or POS platform.
| | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product in the commerce or POS system | **Example 1:** Hard Drive
**Example 2:** Windows Installation
**Example 3:** Software Support (Hourly) | +| `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. | | | `variants` | List[[Nullable[shared.ProductVariant]](../../models/shared/productvariant.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/commerceproductcategories.md b/lending/docs/models/shared/commerceproductcategories.md index a2e6b3884..489f4e612 100644 --- a/lending/docs/models/shared/commerceproductcategories.md +++ b/lending/docs/models/shared/commerceproductcategories.md @@ -1,12 +1,12 @@ -# CommerceProductCategories - - -## 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.CommerceProductCategory]](../../models/shared/commerceproductcategory.md)] | :heavy_minus_sign: | N/A | | +# CommerceProductCategories + + +## 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.CommerceProductCategory]](../../models/shared/commerceproductcategory.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/lending/docs/models/shared/commerceproductcategory.md b/lending/docs/models/shared/commerceproductcategory.md index c97a344b4..47f97dc19 100644 --- a/lending/docs/models/shared/commerceproductcategory.md +++ b/lending/docs/models/shared/commerceproductcategory.md @@ -1,15 +1,15 @@ -# CommerceProductCategory - -Product categories are used to classify a group of products together, either by type (e.g. "Furniture"), or sometimes by tax profile. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `ancestor_refs` | List[[shared.CommerceRecordRef](../../models/shared/commercerecordref.md)] | :heavy_minus_sign: | A collection of parent product categories implicitly ordered with the immediate parent last in the list. | | -| `has_children` | *Optional[bool]* | :heavy_minus_sign: | A boolean indicating whether there are other product categories beneath this one in the hierarchy. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier of the product category | "102" | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the product category | Entertainment | +# CommerceProductCategory + +Product categories are used to classify a group of products together, either by type (e.g. "Furniture"), or sometimes by tax profile. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `ancestor_refs` | List[[shared.CommerceRecordRef](../../models/shared/commercerecordref.md)] | :heavy_minus_sign: | A collection of parent product categories implicitly ordered with the immediate parent last in the list. | | +| `has_children` | *Optional[bool]* | :heavy_minus_sign: | A boolean indicating whether there are other product categories beneath this one in the hierarchy. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | The unique identifier of the product category | "102" | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *Optional[str]* | :heavy_minus_sign: | The name of the product category | Entertainment | | `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/commerceproducts.md b/lending/docs/models/shared/commerceproducts.md index 9b17c9694..1a1ab9d09 100644 --- a/lending/docs/models/shared/commerceproducts.md +++ b/lending/docs/models/shared/commerceproducts.md @@ -1,12 +1,12 @@ -# CommerceProducts - - -## 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.CommerceProduct](../../models/shared/commerceproduct.md)] | :heavy_minus_sign: | N/A | | +# CommerceProducts + + +## 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.CommerceProduct](../../models/shared/commerceproduct.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/lending/docs/models/shared/commercerecordref.md b/lending/docs/models/shared/commercerecordref.md index 7a499ab27..6c15d5580 100644 --- a/lending/docs/models/shared/commercerecordref.md +++ b/lending/docs/models/shared/commercerecordref.md @@ -1,9 +1,9 @@ -# CommerceRecordRef - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identitifer of the record being referenced | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +# CommerceRecordRef + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identitifer of the record being referenced | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | | `type` | *str* | :heavy_check_mark: | The type of record being referenced. | | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereport.md b/lending/docs/models/shared/commercereport.md index cc62f0048..25d96510f 100644 --- a/lending/docs/models/shared/commercereport.md +++ b/lending/docs/models/shared/commercereport.md @@ -1,54 +1,54 @@ -# CommerceReport - -## Structure - -Assess reports follow a consistent structure. Reports contain four sections of information: - -### 1. Report definition - -Information such as: - - 1. The report info (e.g. enhanced_profit_and_loss). - 2. The display name of the report (e.g. Enhanced Profit and Loss). - -### 2. Dimension info - -Information about the dimension contained in the reports such as: - - 1. The type of dimension (e.g. datetime, recordRef). - 2. The display name of the dimension (e.g. Period, Category type, Category sub type). - 3. The details about each item within the dimension (e.g. displayName:"Jan 2022", start:"...", end:"...", id:"...", name:"..."). - -### 3. Measure info - -Information about the measures contained in the report such as: - - 1. The display name of the measure (e.g. value of account, percentage change). - 2. The type of the measure (e.g. currency, percentage). - 3. The unit of the measure (e.g. %, GBP). - -### 4. The data for the report - -When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*. - - -## Displaying the report - -Reports can be rendered as follows (ordering is implicit rather than explicit): - -![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png) - -# Data model - -## Dimensions - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `dimensions` | List[[shared.CommerceReportDimension](../../models/shared/commercereportdimension.md)] | :heavy_minus_sign: | N/A | -| `errors` | List[[shared.CommerceReportError](../../models/shared/commercereporterror.md)] | :heavy_minus_sign: | N/A | -| `measures` | List[[shared.CommerceReportMeasure](../../models/shared/commercereportmeasure.md)] | :heavy_minus_sign: | N/A | -| `report_data` | List[[shared.CommerceReportComponent](../../models/shared/commercereportcomponent.md)] | :heavy_minus_sign: | N/A | +# CommerceReport + +## Structure + +Assess reports follow a consistent structure. Reports contain four sections of information: + +### 1. Report definition + +Information such as: + + 1. The report info (e.g. enhanced_profit_and_loss). + 2. The display name of the report (e.g. Enhanced Profit and Loss). + +### 2. Dimension info + +Information about the dimension contained in the reports such as: + + 1. The type of dimension (e.g. datetime, recordRef). + 2. The display name of the dimension (e.g. Period, Category type, Category sub type). + 3. The details about each item within the dimension (e.g. displayName:"Jan 2022", start:"...", end:"...", id:"...", name:"..."). + +### 3. Measure info + +Information about the measures contained in the report such as: + + 1. The display name of the measure (e.g. value of account, percentage change). + 2. The type of the measure (e.g. currency, percentage). + 3. The unit of the measure (e.g. %, GBP). + +### 4. The data for the report + +When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*. + + +## Displaying the report + +Reports can be rendered as follows (ordering is implicit rather than explicit): + +![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png) + +# Data model + +## Dimensions + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `dimensions` | List[[shared.CommerceReportDimension](../../models/shared/commercereportdimension.md)] | :heavy_minus_sign: | N/A | +| `errors` | List[[shared.CommerceReportError](../../models/shared/commercereporterror.md)] | :heavy_minus_sign: | N/A | +| `measures` | List[[shared.CommerceReportMeasure](../../models/shared/commercereportmeasure.md)] | :heavy_minus_sign: | N/A | +| `report_data` | List[[shared.CommerceReportComponent](../../models/shared/commercereportcomponent.md)] | :heavy_minus_sign: | N/A | | `report_info` | Dict[str, *str*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereportcomponent.md b/lending/docs/models/shared/commercereportcomponent.md index 847e22aab..4ce5d9a68 100644 --- a/lending/docs/models/shared/commercereportcomponent.md +++ b/lending/docs/models/shared/commercereportcomponent.md @@ -1,13 +1,13 @@ -# CommerceReportComponent - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `components` | List[[shared.CommerceReportComponent](../../models/shared/commercereportcomponent.md)] | :heavy_minus_sign: | N/A | -| `dimension` | *Optional[int]* | :heavy_minus_sign: | The component's dimension. | -| `dimension_display_name` | *Optional[str]* | :heavy_minus_sign: | The component's display name. | -| `item` | *Optional[int]* | :heavy_minus_sign: | The component's item number. | -| `item_display_name` | *Optional[str]* | :heavy_minus_sign: | The component's item display name. | +# CommerceReportComponent + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `components` | List[[shared.CommerceReportComponent](../../models/shared/commercereportcomponent.md)] | :heavy_minus_sign: | N/A | +| `dimension` | *Optional[int]* | :heavy_minus_sign: | The component's dimension. | +| `dimension_display_name` | *Optional[str]* | :heavy_minus_sign: | The component's display name. | +| `item` | *Optional[int]* | :heavy_minus_sign: | The component's item number. | +| `item_display_name` | *Optional[str]* | :heavy_minus_sign: | The component's item display name. | | `measures` | List[[shared.ReportComponentMeasure](../../models/shared/reportcomponentmeasure.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereportdimension.md b/lending/docs/models/shared/commercereportdimension.md index 5dcbd3e0e..a99e3fd88 100644 --- a/lending/docs/models/shared/commercereportdimension.md +++ b/lending/docs/models/shared/commercereportdimension.md @@ -1,11 +1,11 @@ -# CommerceReportDimension - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | The dimension's display name. | -| `index` | *Optional[int]* | :heavy_minus_sign: | The dimension's index. | -| `items` | List[[shared.CommerceReportDimensionItems](../../models/shared/commercereportdimensionitems.md)] | :heavy_minus_sign: | N/A | +# CommerceReportDimension + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | The dimension's display name. | +| `index` | *Optional[int]* | :heavy_minus_sign: | The dimension's index. | +| `items` | List[[shared.CommerceReportDimensionItems](../../models/shared/commercereportdimensionitems.md)] | :heavy_minus_sign: | N/A | | `type` | *Optional[str]* | :heavy_minus_sign: | The dimension's type. | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereportdimensionitems.md b/lending/docs/models/shared/commercereportdimensionitems.md index 6dd2d2f97..e569b26c4 100644 --- a/lending/docs/models/shared/commercereportdimensionitems.md +++ b/lending/docs/models/shared/commercereportdimensionitems.md @@ -1,8 +1,8 @@ -# CommerceReportDimensionItems - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +# CommerceReportDimensionItems + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | | `index` | *Optional[int]* | :heavy_minus_sign: | The dimension's items index. | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereporterror.md b/lending/docs/models/shared/commercereporterror.md index b4e20f1c6..bc231ed2c 100644 --- a/lending/docs/models/shared/commercereporterror.md +++ b/lending/docs/models/shared/commercereporterror.md @@ -1,10 +1,10 @@ -# CommerceReportError - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `details` | Dict[str, List[*str*]] | :heavy_minus_sign: | Additional details on the error. | -| `message` | *Optional[str]* | :heavy_minus_sign: | Message returned by error. | +# CommerceReportError + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `details` | Dict[str, *List[str]*] | :heavy_minus_sign: | Additional details on the error. | +| `message` | *Optional[str]* | :heavy_minus_sign: | Message returned by error. | | `type` | *Optional[str]* | :heavy_minus_sign: | The type of error. | \ No newline at end of file diff --git a/lending/docs/models/shared/commercereportmeasure.md b/lending/docs/models/shared/commercereportmeasure.md index 368742f88..b73725fe0 100644 --- a/lending/docs/models/shared/commercereportmeasure.md +++ b/lending/docs/models/shared/commercereportmeasure.md @@ -1,11 +1,11 @@ -# CommerceReportMeasure - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | The measure's display name. | -| `index` | *Optional[int]* | :heavy_minus_sign: | The measure's index. | -| `type` | *Optional[str]* | :heavy_minus_sign: | The measure's type. | +# CommerceReportMeasure + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | The measure's display name. | +| `index` | *Optional[int]* | :heavy_minus_sign: | The measure's index. | +| `type` | *Optional[str]* | :heavy_minus_sign: | The measure's type. | | `units` | *Optional[str]* | :heavy_minus_sign: | The measure's units e.g. percentage (%). | \ No newline at end of file diff --git a/lending/docs/models/shared/commercetaxcomponent.md b/lending/docs/models/shared/commercetaxcomponent.md new file mode 100644 index 000000000..66e8fa759 --- /dev/null +++ b/lending/docs/models/shared/commercetaxcomponent.md @@ -0,0 +1,15 @@ +# CommerceTaxComponent + +The Tax Components endpoints return tax rates data from the commerce software, including tax rate names and values. This is to support the mapping of tax rates from the commerce software to those in the accounting software. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `is_compound` | *Optional[bool]* | :heavy_minus_sign: | The Boolean flag to indicate when a Tax Rate Component compounds on a sale. | **Example 1:** true
**Example 2:** false | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the Tax Rate Component in the source commerce software. | Sales Tax | +| `rate` | *Optional[Decimal]* | :heavy_minus_sign: | Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00). | **Example 1:** 0.15
**Example 2:** 0.2 | +| `source_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | \ No newline at end of file diff --git a/lending/docs/models/shared/commercetransaction.md b/lending/docs/models/shared/commercetransaction.md index 865e6f822..d9a94c9ed 100644 --- a/lending/docs/models/shared/commercetransaction.md +++ b/lending/docs/models/shared/commercetransaction.md @@ -1,27 +1,27 @@ -# CommerceTransaction - -Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. - -You can use data from the Transactions endpoints to calculate key metrics, such as: -- Transaction volumes -- Average transaction volume -- Average transaction value -- Returns -- Payouts - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `created_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 | -| `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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `source_created_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_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `sub_type` | *Optional[str]* | :heavy_minus_sign: | Non-standardised transaction type data from the commerce software | **Example 1:** CardPayment
**Example 2:** Invoice payment | -| `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. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | The total transaction amount | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | -| `transaction_source_ref` | [Optional[shared.TransactionSourceRef]](../../models/shared/transactionsourceref.md) | :heavy_minus_sign: | Link to the source event which triggered this transaction | | +# CommerceTransaction + +Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. + +You can use data from the Transactions endpoints to calculate key metrics, such as: +- Transaction volumes +- Average transaction volume +- Average transaction value +- Returns +- Payouts + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_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 | +| `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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | +| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `source_created_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_modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | +| `sub_type` | *Optional[str]* | :heavy_minus_sign: | Non-standardised transaction type data from the commerce software | **Example 1:** CardPayment
**Example 2:** Invoice payment | +| `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. | | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | The total transaction amount | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | +| `transaction_source_ref` | [Optional[shared.TransactionSourceRef]](../../models/shared/transactionsourceref.md) | :heavy_minus_sign: | Link to the source event which triggered this transaction | | | `type` | [Optional[shared.TransactionType]](../../models/shared/transactiontype.md) | :heavy_minus_sign: | The type of the platform transaction:
- `Unknown`
- `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account.
- `Payment` — Credit and debit card payments.
- `PaymentFee` — Payment provider's fee on each card payment.
- `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller.
- `Payout` — Transfer of funds from the seller's merchant account to their bank account.
- `Refund` — Refunds to a customer's credit or debit card.
- `Transfer` — Secure transfer of funds to the seller's bank account. | | \ No newline at end of file diff --git a/lending/docs/models/shared/commercetransactions.md b/lending/docs/models/shared/commercetransactions.md index 9a0bba05d..b283f21f7 100644 --- a/lending/docs/models/shared/commercetransactions.md +++ b/lending/docs/models/shared/commercetransactions.md @@ -1,12 +1,12 @@ -# CommerceTransactions - - -## 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.CommerceTransaction]](../../models/shared/commercetransaction.md)] | :heavy_minus_sign: | N/A | | +# CommerceTransactions + + +## 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.CommerceTransaction]](../../models/shared/commercetransaction.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/lending/docs/models/shared/companies.md b/lending/docs/models/shared/companies.md index 670c41db2..a4a43b1c2 100644 --- a/lending/docs/models/shared/companies.md +++ b/lending/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/lending/docs/models/shared/company.md b/lending/docs/models/shared/company.md index 098c4eabe..cb20d1c1a 100644 --- a/lending/docs/models/shared/company.md +++ b/lending/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/lending-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/lending-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/lending/docs/models/shared/companydetails.md b/lending/docs/models/shared/companydetails.md new file mode 100644 index 000000000..ec8efb694 --- /dev/null +++ b/lending/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/lending/docs/models/shared/companyreference.md b/lending/docs/models/shared/companyreference.md index b651f69d5..97b15c6bc 100644 --- a/lending/docs/models/shared/companyreference.md +++ b/lending/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/lending/docs/models/shared/companyreferencelinks.md b/lending/docs/models/shared/companyreferencelinks.md index ee01fd320..a4c491724 100644 --- a/lending/docs/models/shared/companyreferencelinks.md +++ b/lending/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/lending/docs/models/shared/companyrequestbody.md b/lending/docs/models/shared/companyrequestbody.md index 3ae35b3c7..107790e6e 100644 --- a/lending/docs/models/shared/companyrequestbody.md +++ b/lending/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/lending/docs/models/shared/companyupdaterequest.md b/lending/docs/models/shared/companyupdaterequest.md index c79edb11b..1ae031209 100644 --- a/lending/docs/models/shared/companyupdaterequest.md +++ b/lending/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/lending/docs/models/shared/connection.md b/lending/docs/models/shared/connection.md index 5628fe06e..eac2f3fd4 100644 --- a/lending/docs/models/shared/connection.md +++ b/lending/docs/models/shared/connection.md @@ -1,30 +1,31 @@ -# Connection - -A connection represents a [company's](https://docs.codat.io/lending-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/lending-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` | [operations.SourceType](../../models/operations/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/lending/docs/models/shared/connections.md b/lending/docs/models/shared/connections.md index 69b3bdc2c..29a1b8ed3 100644 --- a/lending/docs/models/shared/connections.md +++ b/lending/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/lending/docs/models/shared/contact.md b/lending/docs/models/shared/contact.md index 822b70dfc..8056acb47 100644 --- a/lending/docs/models/shared/contact.md +++ b/lending/docs/models/shared/contact.md @@ -1,13 +1,13 @@ -# Contact - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `address` | [Optional[shared.AccountingAddress]](../../models/shared/accountingaddress.md) | :heavy_minus_sign: | N/A | | -| `email` | *OptionalNullable[str]* | :heavy_minus_sign: | Email of a contact for a customer. | | -| `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 | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of a contact for a customer. | | -| `phone` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | An array of Phone numbers. | | -| `status` | [shared.CustomerStatus](../../models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | \ No newline at end of file +# Contact + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `address` | [Optional[shared.AccountingAddress]](../../models/shared/accountingaddress.md) | :heavy_minus_sign: | An object of Address information. | +| `email` | *OptionalNullable[str]* | :heavy_minus_sign: | Email of a contact for a customer. | +| `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. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of a contact for a customer. | +| `phone` | List[[shared.PhoneNumber](../../models/shared/phonenumber.md)] | :heavy_minus_sign: | An array of Phone numbers. | +| `status` | [shared.CustomerStatus](../../models/shared/customerstatus.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/contactref.md b/lending/docs/models/shared/contactref.md index d6b77d151..ddf333542 100644 --- a/lending/docs/models/shared/contactref.md +++ b/lending/docs/models/shared/contactref.md @@ -1,9 +1,9 @@ -# ContactRef - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `data_type` | [OptionalNullable[shared.ContactRefDataType]](../../models/shared/contactrefdatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | +# ContactRef + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `data_type` | [OptionalNullable[shared.ContactRefDataType]](../../models/shared/contactrefdatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | | `id` | *str* | :heavy_check_mark: | Unique identifier for a customer or supplier. | \ No newline at end of file diff --git a/lending/docs/models/shared/contactrefdatatype.md b/lending/docs/models/shared/contactrefdatatype.md index 721fdba6d..207062013 100644 --- a/lending/docs/models/shared/contactrefdatatype.md +++ b/lending/docs/models/shared/contactrefdatatype.md @@ -1,19 +1,19 @@ -# ContactRefDataType - -Allowed name of the 'dataType'. - -## Example Usage - -```python -from codat_lending.models.shared import ContactRefDataType - -value = ContactRefDataType.CUSTOMERS -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `CUSTOMERS` | customers | +# ContactRefDataType + +Allowed name of the 'dataType'. + +## Example Usage + +```python +from codat_lending.models.shared import ContactRefDataType + +value = ContactRefDataType.CUSTOMERS +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `CUSTOMERS` | customers | | `SUPPLIERS` | suppliers | \ No newline at end of file diff --git a/lending/docs/models/shared/contactreference.md b/lending/docs/models/shared/contactreference.md index b6b26ca3c..f6b0408e5 100644 --- a/lending/docs/models/shared/contactreference.md +++ b/lending/docs/models/shared/contactreference.md @@ -1,9 +1,9 @@ -# ContactReference - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `data_type` | [OptionalNullable[shared.JournalLineDataType]](../../models/shared/journallinedatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | +# ContactReference + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `data_type` | [OptionalNullable[shared.JournalLineDataType]](../../models/shared/journallinedatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | | `id` | *str* | :heavy_check_mark: | Unique identifier for a customer or supplier. | \ No newline at end of file diff --git a/lending/docs/models/shared/createbankaccounttransaction.md b/lending/docs/models/shared/createbankaccounttransaction.md index b650a205b..59491a355 100644 --- a/lending/docs/models/shared/createbankaccounttransaction.md +++ b/lending/docs/models/shared/createbankaccounttransaction.md @@ -1,12 +1,12 @@ -# CreateBankAccountTransaction - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | | -| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. | | -| `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 | -| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the bank transaction. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank account transaction, unique for the company in the accounting software. | | \ No newline at end of file +# CreateBankAccountTransaction + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transacted in the bank transaction. | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The remaining balance in the account with ID `accountId`. | +| `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. | +| `description` | *Optional[str]* | :heavy_minus_sign: | Description of the bank transaction. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the bank account transaction, unique for the company in the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/createconnectionrequest.md b/lending/docs/models/shared/createconnectionrequest.md new file mode 100644 index 000000000..dcf930d2f --- /dev/null +++ b/lending/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/lending/docs/models/shared/createddate.md b/lending/docs/models/shared/createddate.md new file mode 100644 index 000000000..e36844218 --- /dev/null +++ b/lending/docs/models/shared/createddate.md @@ -0,0 +1,8 @@ +# CreatedDate + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/createsourceaccount200response.md b/lending/docs/models/shared/createsourceaccount200response.md new file mode 100644 index 000000000..2f646e66c --- /dev/null +++ b/lending/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/lending/docs/models/shared/createsourceaccountrequest.md b/lending/docs/models/shared/createsourceaccountrequest.md new file mode 100644 index 000000000..96ce20b9c --- /dev/null +++ b/lending/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/lending/docs/models/shared/creditnotelineitem.md b/lending/docs/models/shared/creditnotelineitem.md index 38a79ed23..427a29db5 100644 --- a/lending/docs/models/shared/creditnotelineitem.md +++ b/lending/docs/models/shared/creditnotelineitem.md @@ -1,21 +1,21 @@ -# CreditNoteLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of each line item. For example, the goods or service for which credit has been issued. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Value of any discounts applied. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the line item. | -| `is_direct_income` | *Optional[bool]* | :heavy_minus_sign: | The credit note is a direct income if `True`. | -| `item_ref` | [Optional[shared.PropertieItemRef]](../../models/shared/propertieitemref.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of the goods or service for which credit has been issued. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of credit associated with the line item, including discounts but excluding tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax associated with the line item. | -| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | -| `tracking` | [Optional[shared.AccountsReceivableTracking]](../../models/shared/accountsreceivabletracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | -| ~~`tracking_category_refs`~~ | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Reference to the tracking categories to which the line item is linked. | -| `unit_amount` | *Decimal* | :heavy_check_mark: | Unit price of the goods or service. | \ No newline at end of file +# CreditNoteLineItem + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Reference to the account to which the line item is linked. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of each line item. For example, the goods or service for which credit has been issued. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Value of any discounts applied. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate of any discount applied to the line item. | +| `is_direct_income` | *Optional[bool]* | :heavy_minus_sign: | The credit note is a direct income if `True`. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | +| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of the goods or service for which credit has been issued. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of credit associated with the line item, including discounts but excluding tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax associated with the line item. | +| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the line item is linked. | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | +| `tracking` | [Optional[shared.AccountsReceivableTracking]](../../models/shared/accountsreceivabletracking.md) | :heavy_minus_sign: | N/A | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories to which the line item is linked. | +| `unit_amount` | *Decimal* | :heavy_check_mark: | Unit price of the goods or service. | \ No newline at end of file diff --git a/lending/docs/models/shared/creditnotestatus.md b/lending/docs/models/shared/creditnotestatus.md index d986cfb0f..102ba0f95 100644 --- a/lending/docs/models/shared/creditnotestatus.md +++ b/lending/docs/models/shared/creditnotestatus.md @@ -1,23 +1,23 @@ -# CreditNoteStatus - -Current state of the credit note. - -## Example Usage - -```python -from codat_lending.models.shared import CreditNoteStatus - -value = CreditNoteStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `DRAFT` | Draft | -| `SUBMITTED` | Submitted | -| `PAID` | Paid | -| `VOID` | Void | +# CreditNoteStatus + +Current state of the credit note. + +## Example Usage + +```python +from codat_lending.models.shared import CreditNoteStatus + +value = CreditNoteStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `DRAFT` | Draft | +| `SUBMITTED` | Submitted | +| `PAID` | Paid | +| `VOID` | Void | | `PARTIALLY_PAID` | PartiallyPaid | \ No newline at end of file diff --git a/lending/docs/models/shared/currentstatus.md b/lending/docs/models/shared/currentstatus.md new file mode 100644 index 000000000..d96ac6e98 --- /dev/null +++ b/lending/docs/models/shared/currentstatus.md @@ -0,0 +1,36 @@ +# CurrentStatus + +## Example Usage + +```python +from codat_lending.models.shared import CurrentStatus + +value = CurrentStatus.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/lending/docs/models/shared/customerstatus.md b/lending/docs/models/shared/customerstatus.md index aa7c68f60..20df4b60d 100644 --- a/lending/docs/models/shared/customerstatus.md +++ b/lending/docs/models/shared/customerstatus.md @@ -1,20 +1,18 @@ -# CustomerStatus - -Status of customer. - -## Example Usage - -```python -from codat_lending.models.shared import CustomerStatus - -value = CustomerStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | +# CustomerStatus + +## Example Usage + +```python +from codat_lending.models.shared import CustomerStatus + +value = CustomerStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | | `ARCHIVED` | Archived | \ No newline at end of file diff --git a/lending/docs/models/shared/dataconnectionerror.md b/lending/docs/models/shared/dataconnectionerror.md index 33b523477..96b4828fa 100644 --- a/lending/docs/models/shared/dataconnectionerror.md +++ b/lending/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/lending/docs/models/shared/dataconnectionstatus.md b/lending/docs/models/shared/dataconnectionstatus.md index 048c899ce..f415ab3bd 100644 --- a/lending/docs/models/shared/dataconnectionstatus.md +++ b/lending/docs/models/shared/dataconnectionstatus.md @@ -1,21 +1,21 @@ -# DataConnectionStatus - -The current authorization status of the data connection. - -## Example Usage - -```python -from codat_lending.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_lending.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/lending/docs/models/shared/dataintegrityamounts.md b/lending/docs/models/shared/dataintegrityamounts.md index f43f418b0..7291ec0b0 100644 --- a/lending/docs/models/shared/dataintegrityamounts.md +++ b/lending/docs/models/shared/dataintegrityamounts.md @@ -1,12 +1,10 @@ -# DataIntegrityAmounts - -Only returned for transactions. For accounts, there is nothing returned. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `max` | *Optional[Decimal]* | :heavy_minus_sign: | Highest value of transaction set. | | -| `min` | *Optional[Decimal]* | :heavy_minus_sign: | Lowest value of transaction set. | | \ No newline at end of file +# DataIntegrityAmounts + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | +| `max` | *Optional[Decimal]* | :heavy_minus_sign: | Highest value of transaction set. | +| `min` | *Optional[Decimal]* | :heavy_minus_sign: | Lowest value of transaction set. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritybyamount.md b/lending/docs/models/shared/dataintegritybyamount.md index 97baf442a..f9cb889a1 100644 --- a/lending/docs/models/shared/dataintegritybyamount.md +++ b/lending/docs/models/shared/dataintegritybyamount.md @@ -1,12 +1,12 @@ -# DataIntegrityByAmount - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `match_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | The percentage of the absolute value of transactions of the type specified in the route which have a match. | | -| `matched` | *Optional[Decimal]* | :heavy_minus_sign: | The sum of the absolute value of transactions of the type specified in the route which have a match. | | -| `total` | *Optional[Decimal]* | :heavy_minus_sign: | The total of unmatched and matched. | | +# DataIntegrityByAmount + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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 | +| `match_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | The percentage of the absolute value of transactions of the type specified in the route which have a match. | | +| `matched` | *Optional[Decimal]* | :heavy_minus_sign: | The sum of the absolute value of transactions of the type specified in the route which have a match. | | +| `total` | *Optional[Decimal]* | :heavy_minus_sign: | The total of unmatched and matched. | | | `unmatched` | *Optional[Decimal]* | :heavy_minus_sign: | The sum of the absolute value of transactions of the type specified in the route which don't have a match. | | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritybycount.md b/lending/docs/models/shared/dataintegritybycount.md index e1f5f33bf..39f068c7f 100644 --- a/lending/docs/models/shared/dataintegritybycount.md +++ b/lending/docs/models/shared/dataintegritybycount.md @@ -1,11 +1,11 @@ -# DataIntegrityByCount - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `match_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | The percentage of records of the type specified in the route which have a match. | -| `matched` | *Optional[Decimal]* | :heavy_minus_sign: | The number of records of the type specified in the route which do have a match. | -| `total` | *Optional[Decimal]* | :heavy_minus_sign: | The total of unmatched and matched. | +# DataIntegrityByCount + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `match_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | The percentage of records of the type specified in the route which have a match. | +| `matched` | *Optional[Decimal]* | :heavy_minus_sign: | The number of records of the type specified in the route which do have a match. | +| `total` | *Optional[Decimal]* | :heavy_minus_sign: | The total of unmatched and matched. | | `unmatched` | *Optional[Decimal]* | :heavy_minus_sign: | The number of records of the type specified in the route which don't have a match. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegrityconnectionid.md b/lending/docs/models/shared/dataintegrityconnectionid.md index cfa30c8ca..5f80304e0 100644 --- a/lending/docs/models/shared/dataintegrityconnectionid.md +++ b/lending/docs/models/shared/dataintegrityconnectionid.md @@ -1,9 +1,9 @@ -# DataIntegrityConnectionID - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `source` | List[*str*] | :heavy_minus_sign: | An array of strings. The connection IDs for the type specified in the url. | +# DataIntegrityConnectionId + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `source` | List[*str*] | :heavy_minus_sign: | An array of strings. The connection IDs for the type specified in the url. | | `target` | List[*str*] | :heavy_minus_sign: | An array of strings. The connection IDs for the type being matched to. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritydatatype.md b/lending/docs/models/shared/dataintegritydatatype.md index ea10fdea8..1e6862b40 100644 --- a/lending/docs/models/shared/dataintegritydatatype.md +++ b/lending/docs/models/shared/dataintegritydatatype.md @@ -1,19 +1,19 @@ -# DataIntegrityDataType - -## Example Usage - -```python -from codat_lending.models.shared import DataIntegrityDataType - -value = DataIntegrityDataType.BANKING_ACCOUNTS -``` - - -## Values - -| Name | Value | -| ---------------------- | ---------------------- | -| `BANKING_ACCOUNTS` | banking-accounts | -| `BANKING_TRANSACTIONS` | banking-transactions | -| `BANK_ACCOUNTS` | bankAccounts | +# DataIntegrityDataType + +## Example Usage + +```python +from codat_lending.models.shared import DataIntegrityDataType + +value = DataIntegrityDataType.BANKING_ACCOUNTS +``` + + +## Values + +| Name | Value | +| ---------------------- | ---------------------- | +| `BANKING_ACCOUNTS` | banking-accounts | +| `BANKING_TRANSACTIONS` | banking-transactions | +| `BANK_ACCOUNTS` | bankAccounts | | `ACCOUNT_TRANSACTIONS` | accountTransactions | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritydates.md b/lending/docs/models/shared/dataintegritydates.md index 26536edec..640615091 100644 --- a/lending/docs/models/shared/dataintegritydates.md +++ b/lending/docs/models/shared/dataintegritydates.md @@ -1,13 +1,11 @@ -# DataIntegrityDates - -Only returned for transactions. For accounts, there is nothing returned. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `max_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 | -| `max_overlapping_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 | -| `min_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 | -| `min_overlapping_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 | \ No newline at end of file +# DataIntegrityDates + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `max_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. | +| `max_overlapping_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. | +| `min_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. | +| `min_overlapping_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. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritydetail.md b/lending/docs/models/shared/dataintegritydetail.md index ed092088e..eef8a4ad9 100644 --- a/lending/docs/models/shared/dataintegritydetail.md +++ b/lending/docs/models/shared/dataintegritydetail.md @@ -1,15 +1,15 @@ -# DataIntegrityDetail - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The transaction value. | | -| `connection_id` | *Optional[str]* | :heavy_minus_sign: | ID GUID representing the connection of the accounting or banking platform. | | -| `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 | -| `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 | -| `description` | *Optional[str]* | :heavy_minus_sign: | The transaction description. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | ID GUID of the transaction. | | -| `matches` | List[[shared.DataIntegrityMatch](../../models/shared/dataintegritymatch.md)] | :heavy_minus_sign: | N/A | | +# DataIntegrityDetail + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The transaction value. | | +| `connection_id` | *Optional[str]* | :heavy_minus_sign: | ID GUID representing the connection of the accounting or banking platform. | | +| `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 | +| `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 | +| `description` | *Optional[str]* | :heavy_minus_sign: | The transaction description. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | ID GUID of the transaction. | | +| `matches` | List[[shared.DataIntegrityMatch](../../models/shared/dataintegritymatch.md)] | :heavy_minus_sign: | N/A | | | `type` | *Optional[str]* | :heavy_minus_sign: | The data type of the record. | | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritydetails.md b/lending/docs/models/shared/dataintegritydetails.md index 8c0d75f27..cb50dea80 100644 --- a/lending/docs/models/shared/dataintegritydetails.md +++ b/lending/docs/models/shared/dataintegritydetails.md @@ -1,12 +1,12 @@ -# DataIntegrityDetails - - -## 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.DataIntegrityDetail](../../models/shared/dataintegritydetail.md)] | :heavy_minus_sign: | N/A | | +# DataIntegrityDetails + + +## 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.DataIntegrityDetail](../../models/shared/dataintegritydetail.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/lending/docs/models/shared/dataintegritymatch.md b/lending/docs/models/shared/dataintegritymatch.md index 06d7251b7..fd8147df6 100644 --- a/lending/docs/models/shared/dataintegritymatch.md +++ b/lending/docs/models/shared/dataintegritymatch.md @@ -1,14 +1,14 @@ -# DataIntegrityMatch - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[str]* | :heavy_minus_sign: | The transaction value. | | -| `connection_id` | *Optional[str]* | :heavy_minus_sign: | ID GUID representing the connection of the accounting or banking platform. | | -| `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 | -| `date_` | *Optional[str]* | :heavy_minus_sign: | The date of the transaction. | | -| `description` | *Optional[str]* | :heavy_minus_sign: | The transaction description. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | ID GUID of the transaction. | | -| `type` | *Optional[str]* | :heavy_minus_sign: | The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions. | | \ No newline at end of file +# DataIntegrityMatch + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[str]* | :heavy_minus_sign: | The transaction value. | +| `connection_id` | *Optional[str]* | :heavy_minus_sign: | ID GUID representing the connection of the accounting or banking platform. | +| `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. | +| `date_` | *Optional[str]* | :heavy_minus_sign: | The date of the transaction. | +| `description` | *Optional[str]* | :heavy_minus_sign: | The transaction description. | +| `id` | *Optional[str]* | :heavy_minus_sign: | ID GUID of the transaction. | +| `type` | *Optional[str]* | :heavy_minus_sign: | The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritystatus.md b/lending/docs/models/shared/dataintegritystatus.md index 6ac4104dc..37096c3bd 100644 --- a/lending/docs/models/shared/dataintegritystatus.md +++ b/lending/docs/models/shared/dataintegritystatus.md @@ -1,12 +1,12 @@ -# DataIntegrityStatus - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amounts` | [Optional[shared.DataIntegrityAmounts]](../../models/shared/dataintegrityamounts.md) | :heavy_minus_sign: | Only returned for transactions. For accounts, there is nothing returned. | -| `connection_ids` | [Optional[shared.DataIntegrityConnectionID]](../../models/shared/dataintegrityconnectionid.md) | :heavy_minus_sign: | N/A | -| `dates` | [Optional[shared.DataIntegrityDates]](../../models/shared/dataintegritydates.md) | :heavy_minus_sign: | Only returned for transactions. For accounts, there is nothing returned. | -| `status_info` | [Optional[shared.DataIntegrityStatusInfo]](../../models/shared/dataintegritystatusinfo.md) | :heavy_minus_sign: | N/A | +# DataIntegrityStatus + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amounts` | [Optional[shared.DataIntegrityAmounts]](../../models/shared/dataintegrityamounts.md) | :heavy_minus_sign: | Only returned for transactions. For accounts, there is nothing returned. | +| `connection_ids` | [Optional[shared.DataIntegrityConnectionId]](../../models/shared/dataintegrityconnectionid.md) | :heavy_minus_sign: | N/A | +| `dates` | [Optional[shared.DataIntegrityDates]](../../models/shared/dataintegritydates.md) | :heavy_minus_sign: | Only returned for transactions. For accounts, there is nothing returned. | +| `status_info` | [Optional[shared.DataIntegrityStatusInfo]](../../models/shared/dataintegritystatusinfo.md) | :heavy_minus_sign: | N/A | | `type` | *Optional[str]* | :heavy_minus_sign: | The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritystatuses.md b/lending/docs/models/shared/dataintegritystatuses.md index 8a4b39a11..e1e2c8bd5 100644 --- a/lending/docs/models/shared/dataintegritystatuses.md +++ b/lending/docs/models/shared/dataintegritystatuses.md @@ -1,8 +1,8 @@ -# DataIntegrityStatuses - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +# DataIntegrityStatuses + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `metadata` | List[[shared.DataIntegrityStatus](../../models/shared/dataintegritystatus.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritystatusinfo.md b/lending/docs/models/shared/dataintegritystatusinfo.md index 4a1ac2057..636ce737b 100644 --- a/lending/docs/models/shared/dataintegritystatusinfo.md +++ b/lending/docs/models/shared/dataintegritystatusinfo.md @@ -1,10 +1,10 @@ -# DataIntegrityStatusInfo - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `current_status` | [Optional[shared.IntegrityStatus]](../../models/shared/integritystatus.md) | :heavy_minus_sign: | The current status of the most recently run matching algorithm. | | -| `last_matched` | *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_message` | *Optional[str]* | :heavy_minus_sign: | Detailed explanation supporting the status value. | | \ No newline at end of file +# DataIntegrityStatusInfo + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `current_status` | [Optional[shared.IntegrityStatus]](../../models/shared/integritystatus.md) | :heavy_minus_sign: | N/A | +| `last_matched` | *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. | +| `status_message` | *Optional[str]* | :heavy_minus_sign: | Detailed explanation supporting the status value. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritysummaries.md b/lending/docs/models/shared/dataintegritysummaries.md index 0588076cf..f4f93b9c3 100644 --- a/lending/docs/models/shared/dataintegritysummaries.md +++ b/lending/docs/models/shared/dataintegritysummaries.md @@ -1,8 +1,8 @@ -# DataIntegritySummaries - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +# DataIntegritySummaries + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `summaries` | List[[shared.DataIntegritySummary](../../models/shared/dataintegritysummary.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritysummary.md b/lending/docs/models/shared/dataintegritysummary.md index 6f8af88d8..0cdb1ee00 100644 --- a/lending/docs/models/shared/dataintegritysummary.md +++ b/lending/docs/models/shared/dataintegritysummary.md @@ -1,10 +1,10 @@ -# DataIntegritySummary - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `by_amount` | [Optional[shared.DataIntegrityByAmount]](../../models/shared/dataintegritybyamount.md) | :heavy_minus_sign: | N/A | -| `by_count` | [Optional[shared.DataIntegrityByCount]](../../models/shared/dataintegritybycount.md) | :heavy_minus_sign: | N/A | +# DataIntegritySummary + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `by_amount` | [Optional[shared.DataIntegrityByAmount]](../../models/shared/dataintegritybyamount.md) | :heavy_minus_sign: | N/A | +| `by_count` | [Optional[shared.DataIntegrityByCount]](../../models/shared/dataintegritybycount.md) | :heavy_minus_sign: | N/A | | `type` | *Optional[str]* | :heavy_minus_sign: | The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions. | \ No newline at end of file diff --git a/lending/docs/models/shared/dataintegritytype.md b/lending/docs/models/shared/dataintegritytype.md new file mode 100644 index 000000000..e6da01cfd --- /dev/null +++ b/lending/docs/models/shared/dataintegritytype.md @@ -0,0 +1,8 @@ +# DataIntegrityType + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | *Optional[str]* | :heavy_minus_sign: | The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions. | \ No newline at end of file diff --git a/lending/docs/models/shared/datasetstatus.md b/lending/docs/models/shared/datasetstatus.md index b64c6bb7e..3f8887945 100644 --- a/lending/docs/models/shared/datasetstatus.md +++ b/lending/docs/models/shared/datasetstatus.md @@ -1,38 +1,38 @@ -# DatasetStatus - -The current status of the dataset. - -## Example Usage - -```python -from codat_lending.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 | +# DatasetStatus + +The current status of the dataset. + +## Example Usage + +```python +from codat_lending.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/lending/docs/models/shared/datasource.md b/lending/docs/models/shared/datasource.md index 95ec7dc64..37a4a5de0 100644 --- a/lending/docs/models/shared/datasource.md +++ b/lending/docs/models/shared/datasource.md @@ -1,8 +1,8 @@ -# DataSource - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +# DataSource + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `accounts` | List[[shared.Accounts](../../models/shared/accounts.md)] | :heavy_minus_sign: | An array containing bank account data for each connected banking data source that have the following data types enabled: `banking-accounts`, `banking-transactions`. | \ No newline at end of file diff --git a/lending/docs/models/shared/datastatus.md b/lending/docs/models/shared/datastatus.md index c89b47244..d5b8102bb 100644 --- a/lending/docs/models/shared/datastatus.md +++ b/lending/docs/models/shared/datastatus.md @@ -1,14 +1,14 @@ -# DataStatus - -Describes the state of data in the Codat cache for a company and data type - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `current_status` | [shared.Status](../../models/shared/status.md) | :heavy_check_mark: | The current status of the dataset. | | -| `data_type` | [shared.DataTypes](../../models/shared/datatypes.md) | :heavy_check_mark: | Available data types | invoices | -| `last_successful_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 | -| `latest_successful_sync_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the most recent successful sync of data type. | 8220fc90-55b6-47bc-9417-48ac6ea93101 | +# DataStatus + +Describes the state of data in the Codat cache for a company and data type + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `current_status` | [shared.Status](../../models/shared/status.md) | :heavy_check_mark: | The current status of the dataset. | | +| `data_type` | [shared.DataTypes](../../models/shared/datatypes.md) | :heavy_check_mark: | Available data types | invoices | +| `last_successful_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 | +| `latest_successful_sync_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the most recent successful sync of data type. | 8220fc90-55b6-47bc-9417-48ac6ea93101 | | `latest_sync_id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for most recent sync of data type. | ad474a37-2003-478e-baee-9af9f1ec2fe3 | \ No newline at end of file diff --git a/lending/docs/models/shared/datastatuses.md b/lending/docs/models/shared/datastatuses.md new file mode 100644 index 000000000..9a8cf4cb8 --- /dev/null +++ b/lending/docs/models/shared/datastatuses.md @@ -0,0 +1,50 @@ +# DataStatuses + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `account_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `balance_sheet` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `bank_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `bank_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `banking_account_balances` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `banking_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `banking_transaction_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `banking_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `bill_credit_notes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `bill_payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `bills` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `cash_flow_statement` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `chart_of_accounts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_company_info` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_customers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_disputes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_locations` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_payment_methods` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_product_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_products` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_tax_components` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `commerce_transactions` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `company` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `credit_notes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `customers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `direct_costs` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `direct_incomes` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `invoices` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `item_receipts` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `items` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `journal_entries` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `journals` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `payment_methods` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `payments` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `profit_and_loss` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `purchase_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `sales_orders` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `suppliers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `tax_rates` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `tracking_categories` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | +| `transfers` | [Optional[shared.DataStatus]](../../models/shared/datastatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/datatype.md b/lending/docs/models/shared/datatype.md index c026bc205..a55d2d235 100644 --- a/lending/docs/models/shared/datatype.md +++ b/lending/docs/models/shared/datatype.md @@ -1,60 +1,75 @@ -# DataType - -Available data types - -## Example Usage - -```python -from codat_lending.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_lending.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/lending/docs/models/shared/datatypes.md b/lending/docs/models/shared/datatypes.md index 085f4dab6..d09fdbcda 100644 --- a/lending/docs/models/shared/datatypes.md +++ b/lending/docs/models/shared/datatypes.md @@ -1,60 +1,60 @@ -# DataTypes - -Available data types - -## Example Usage - -```python -from codat_lending.models.shared import DataTypes - -value = DataTypes.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 | +# DataTypes + +Available data types + +## Example Usage + +```python +from codat_lending.models.shared import DataTypes + +value = DataTypes.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 diff --git a/lending/docs/models/shared/directcostlineitem.md b/lending/docs/models/shared/directcostlineitem.md index bdbf7f8c3..19e9ca4e9 100644 --- a/lending/docs/models/shared/directcostlineitem.md +++ b/lending/docs/models/shared/directcostlineitem.md @@ -1,20 +1,20 @@ -# DirectCostLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount amount for the line before tax. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount percentage for the line before tax. | -| `item_ref` | [Optional[shared.PropertieItemRef]](../../models/shared/propertieitemref.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of goods or services received.

Note: If the platform does not provide this information, the quantity will be mapped as 1. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | -| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. | -| `tracking` | [Optional[shared.Tracking]](../../models/shared/tracking.md) | :heavy_minus_sign: | N/A | -| ~~`tracking_category_refs`~~ | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Collection of categories against which this direct cost is tracked. | -| `unit_amount` | *Decimal* | :heavy_check_mark: | Price of each unit of goods or services.
Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. | \ No newline at end of file +# DirectCostLineItem + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Reference to the account to which the line item is linked. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount amount for the line before tax. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount percentage for the line before tax. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the product, service type, or inventory item to which the direct cost is linked. | +| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of goods or services received. Note: If the platform does not provide this information, the quantity will be mapped as 1. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | +| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the the line item is linked. | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. | +| `tracking` | [Optional[shared.Tracking]](../../models/shared/tracking.md) | :heavy_minus_sign: | N/A | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Collection of categories against which this direct cost is tracked. | +| `unit_amount` | *Decimal* | :heavy_check_mark: | Price of each unit of goods or services. Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. | \ No newline at end of file diff --git a/lending/docs/models/shared/directcostprototype.md b/lending/docs/models/shared/directcostprototype.md index 2410ed6cd..d9aa95119 100644 --- a/lending/docs/models/shared/directcostprototype.md +++ b/lending/docs/models/shared/directcostprototype.md @@ -1,19 +1,19 @@ -# DirectCostPrototype - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `issue_date` | *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 | -| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | A note attached to the direct cost. | | -| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | | -| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | | -| `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. | | -| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | | -| `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct costs, inclusive of tax. | | \ No newline at end of file +# DirectCostPrototype + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `contact_ref` | [Optional[shared.ContactRef]](../../models/shared/contactref.md) | :heavy_minus_sign: | A customer or supplier associated with the direct cost. | +| `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. | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `issue_date` | *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. | +| `line_items` | List[[shared.DirectCostLineItem](../../models/shared/directcostlineitem.md)] | :heavy_check_mark: | An array of line items. | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | A note attached to the direct cost. | +| `payment_allocations` | List[[shared.AccountingPaymentAllocation](../../models/shared/accountingpaymentallocation.md)] | :heavy_check_mark: | An array of payment allocations. | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | User-friendly reference for the direct cost. | +| `sub_total` | *Decimal* | :heavy_check_mark: | The total amount of the direct costs, excluding any taxes. | +| `supplemental_data` | [Optional[shared.SupplementalData]](../../models/shared/supplementaldata.md) | :heavy_minus_sign: | N/A | +| `tax_amount` | *Decimal* | :heavy_check_mark: | The total amount of tax on the direct costs. | +| `total_amount` | *Decimal* | :heavy_check_mark: | The amount of the direct costs, inclusive of tax. | \ No newline at end of file diff --git a/lending/docs/models/shared/directincomelineitem.md b/lending/docs/models/shared/directincomelineitem.md index 96a1ffe2a..c33c05b95 100644 --- a/lending/docs/models/shared/directincomelineitem.md +++ b/lending/docs/models/shared/directincomelineitem.md @@ -1,19 +1,19 @@ -# DirectIncomeLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | A user-friendly name of the goods or services. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount amount for the line before tax. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount percentage for the line before tax. | -| `item_ref` | [Optional[shared.PropertieItemRef]](../../models/shared/propertieitemref.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `quantity` | *Decimal* | :heavy_check_mark: | The number of units of goods or services received.

Note: If the platform does not provide this information, the quantity will be mapped as 1. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The amount of the line, inclusive of discounts, but exclusive of tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The amount of tax for the line.
Note: If the platform does not provide this information, the quantity will be mapped as 0.00. | -| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The total amount of the line, including tax. | -| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | An array of categories against which this direct cost is tracked. | -| `unit_amount` | *Decimal* | :heavy_check_mark: | The price of each unit of goods or services.
Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. | \ No newline at end of file +# DirectIncomeLineItem + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Reference to the account to which the line item is linked. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | A user-friendly name of the goods or services. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount amount for the line before tax. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Discount percentage for the line before tax. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the product, service type, or inventory item to which the direct cost is linked. | +| `quantity` | *Decimal* | :heavy_check_mark: | The number of units of goods or services received. Note: If the platform does not provide this information, the quantity will be mapped as 1. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The amount of the line, inclusive of discounts, but exclusive of tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The amount of tax for the line. Note: If the platform does not provide this information, the quantity will be mapped as 0.00. | +| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the line item is linked. | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The total amount of the line, including tax. | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | An array of categories against which this direct cost is tracked. | +| `unit_amount` | *Decimal* | :heavy_check_mark: | The price of each unit of goods or services. Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. | \ No newline at end of file diff --git a/lending/docs/models/shared/disputestatus.md b/lending/docs/models/shared/disputestatus.md index e832041f3..e60c00abc 100644 --- a/lending/docs/models/shared/disputestatus.md +++ b/lending/docs/models/shared/disputestatus.md @@ -1,28 +1,26 @@ -# DisputeStatus - -Current status of the dispute - -## Example Usage - -```python -from codat_lending.models.shared import DisputeStatus - -value = DisputeStatus.WON -``` - - -## Values - -| Name | Value | -| --------------------------- | --------------------------- | -| `WON` | Won | -| `LOST` | Lost | -| `ACCEPTED` | Accepted | -| `PROCESSING` | Processing | -| `CHARGE_REFUNDED` | ChargeRefunded | -| `EVIDENCE_REQUIRED` | EvidenceRequired | -| `INQUIRY_EVIDENCE_REQUIRED` | InquiryEvidenceRequired | -| `INQUIRY_PROCESSING` | InquiryProcessing | -| `INQUIRY_CLOSED` | InquiryClosed | -| `WAITING_THIRD_PARTY` | WaitingThirdParty | +# DisputeStatus + +## Example Usage + +```python +from codat_lending.models.shared import DisputeStatus + +value = DisputeStatus.WON +``` + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `WON` | Won | +| `LOST` | Lost | +| `ACCEPTED` | Accepted | +| `PROCESSING` | Processing | +| `CHARGE_REFUNDED` | ChargeRefunded | +| `EVIDENCE_REQUIRED` | EvidenceRequired | +| `INQUIRY_EVIDENCE_REQUIRED` | InquiryEvidenceRequired | +| `INQUIRY_PROCESSING` | InquiryProcessing | +| `INQUIRY_CLOSED` | InquiryClosed | +| `WAITING_THIRD_PARTY` | WaitingThirdParty | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/enduploadsessionrequest.md b/lending/docs/models/shared/enduploadsessionrequest.md index 63a2f4eb0..49f665d19 100644 --- a/lending/docs/models/shared/enduploadsessionrequest.md +++ b/lending/docs/models/shared/enduploadsessionrequest.md @@ -1,8 +1,8 @@ -# EndUploadSessionRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +# EndUploadSessionRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | | `status` | [Optional[shared.EndUploadSessionRequestStatus]](../../models/shared/enduploadsessionrequeststatus.md) | :heavy_minus_sign: | An indicator to cancel the dataset processing or trigger ingestion and enrichment of data. | \ No newline at end of file diff --git a/lending/docs/models/shared/enduploadsessionrequeststatus.md b/lending/docs/models/shared/enduploadsessionrequeststatus.md index fd3bd0193..8e015f1b7 100644 --- a/lending/docs/models/shared/enduploadsessionrequeststatus.md +++ b/lending/docs/models/shared/enduploadsessionrequeststatus.md @@ -1,19 +1,17 @@ -# EndUploadSessionRequestStatus - -An indicator to cancel the dataset processing or trigger ingestion and enrichment of data. - -## Example Usage - -```python -from codat_lending.models.shared import EndUploadSessionRequestStatus - -value = EndUploadSessionRequestStatus.CANCEL -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `CANCEL` | Cancel | +# EndUploadSessionRequestStatus + +## Example Usage + +```python +from codat_lending.models.shared import EndUploadSessionRequestStatus + +value = EndUploadSessionRequestStatus.CANCEL +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `CANCEL` | Cancel | | `PROCESS` | Process | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedcashflowitem.md b/lending/docs/models/shared/enhancedcashflowitem.md index 95025a5c9..930bae326 100644 --- a/lending/docs/models/shared/enhancedcashflowitem.md +++ b/lending/docs/models/shared/enhancedcashflowitem.md @@ -1,8 +1,8 @@ -# EnhancedCashFlowItem - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +# EnhancedCashFlowItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `transactions` | List[[shared.CashFlowTransaction](../../models/shared/cashflowtransaction.md)] | :heavy_minus_sign: | An array of transaction data. | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedcashflowtransactions.md b/lending/docs/models/shared/enhancedcashflowtransactions.md index f225f2e65..d8f0bce17 100644 --- a/lending/docs/models/shared/enhancedcashflowtransactions.md +++ b/lending/docs/models/shared/enhancedcashflowtransactions.md @@ -1,16 +1,16 @@ -# EnhancedCashFlowTransactions - -> **Categorization engine** -> -> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. - -The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `data_sources` | List[[shared.DataSource](../../models/shared/datasource.md)] | :heavy_minus_sign: | N/A | | -| `report_info` | [Optional[shared.ReportInfo]](../../models/shared/reportinfo.md) | :heavy_minus_sign: | Report additional information, which is specific to Lending reports. | {
"Example 1": {
"value": {
"pageNumber": 0,
"pageSize": 0,
"totalResults": 0,
"reportName": "string",
"companyName": "string",
"generatedDate": "2023-01-26T07:36:40.487Z"
}
}
} | +# EnhancedCashFlowTransactions + +> **Categorization engine** +> +> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. + +The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data_sources` | List[[shared.DataSource](../../models/shared/datasource.md)] | :heavy_minus_sign: | N/A | | +| `report_info` | [Optional[shared.ReportInfo]](../../models/shared/reportinfo.md) | :heavy_minus_sign: | Report additional information, which is specific to Lending reports. | {
"Example 1": {
"value": {
"pageNumber": 0,
"pageSize": 0,
"totalResults": 0,
"reportName": "string",
"companyName": "string",
"generatedDate": "2023-01-26T07:36:40.487Z"
}
}
} | | `report_items` | List[[shared.EnhancedCashFlowItem](../../models/shared/enhancedcashflowitem.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedfinancialreport.md b/lending/docs/models/shared/enhancedfinancialreport.md index b421a3db8..5152b522b 100644 --- a/lending/docs/models/shared/enhancedfinancialreport.md +++ b/lending/docs/models/shared/enhancedfinancialreport.md @@ -1,9 +1,9 @@ -# EnhancedFinancialReport - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `report_info` | [Optional[shared.EnhancedReportInfo]](../../models/shared/enhancedreportinfo.md) | :heavy_minus_sign: | N/A | +# EnhancedFinancialReport + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `report_info` | [Optional[shared.EnhancedReportInfo]](../../models/shared/enhancedreportinfo.md) | :heavy_minus_sign: | N/A | | `report_items` | List[[shared.ReportItem](../../models/shared/reportitem.md)] | :heavy_minus_sign: | An array of report items. | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedinvoicereportitem.md b/lending/docs/models/shared/enhancedinvoicereportitem.md index e5c8e39ff..26c50eae3 100644 --- a/lending/docs/models/shared/enhancedinvoicereportitem.md +++ b/lending/docs/models/shared/enhancedinvoicereportitem.md @@ -1,20 +1,20 @@ -# EnhancedInvoiceReportItem - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount_due` | *Optional[Decimal]* | :heavy_minus_sign: | Invoice's total amount due. | | -| `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 | -| `customer_ref` | [Optional[shared.LendingCustomerRef]](../../models/shared/lendingcustomerref.md) | :heavy_minus_sign: | N/A | | -| `due_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: | ID of the invoice, which may be a GUID but it may be something else depending on the accounting software. | | -| `invoice_number` | *Optional[str]* | :heavy_minus_sign: | Invoice number. | | -| `issue_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 | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `paid_on_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 | -| `payments` | List[[shared.Payment](../../models/shared/payment.md)] | :heavy_minus_sign: | N/A | | -| `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.InvoiceStatus]](../../models/shared/invoicestatus.md) | :heavy_minus_sign: | Current state of the invoice:

- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email.
- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld).
- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`.
- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`.
- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Invoice's total amount. | | \ No newline at end of file +# EnhancedInvoiceReportItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `amount_due` | *Optional[Decimal]* | :heavy_minus_sign: | Invoice's total amount due. | +| `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. | +| `customer_ref` | [Optional[shared.LendingCustomerRef]](../../models/shared/lendingcustomerref.md) | :heavy_minus_sign: | N/A | +| `due_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` | *Optional[str]* | :heavy_minus_sign: | ID of the invoice, which may be a GUID but it may be something else depending on the accounting software. | +| `invoice_number` | *Optional[str]* | :heavy_minus_sign: | Invoice number. | +| `issue_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. | +| `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. | +| `paid_on_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. | +| `payments` | List[[shared.Payment](../../models/shared/payment.md)] | :heavy_minus_sign: | N/A | +| `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.InvoiceStatus]](../../models/shared/invoicestatus.md) | :heavy_minus_sign: | N/A | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Invoice's total amount. | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedinvoicesreport.md b/lending/docs/models/shared/enhancedinvoicesreport.md index 4e19b59fe..3fd7e11e4 100644 --- a/lending/docs/models/shared/enhancedinvoicesreport.md +++ b/lending/docs/models/shared/enhancedinvoicesreport.md @@ -1,11 +1,11 @@ -# EnhancedInvoicesReport - -The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting software have actually been paid by matching with the bank statement. - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `report_info` | [Optional[shared.ReportInfo]](../../models/shared/reportinfo.md) | :heavy_minus_sign: | Report additional information, which is specific to Lending reports. | {
"Example 1": {
"value": {
"pageNumber": 0,
"pageSize": 0,
"totalResults": 0,
"reportName": "string",
"companyName": "string",
"generatedDate": "2023-01-26T07:36:40.487Z"
}
}
} | +# EnhancedInvoicesReport + +The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting software have actually been paid by matching with the bank statement. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `report_info` | [Optional[shared.ReportInfo]](../../models/shared/reportinfo.md) | :heavy_minus_sign: | Report additional information, which is specific to Lending reports. | {
"Example 1": {
"value": {
"pageNumber": 0,
"pageSize": 0,
"totalResults": 0,
"reportName": "string",
"companyName": "string",
"generatedDate": "2023-01-26T07:36:40.487Z"
}
}
} | | `report_items` | List[[Nullable[shared.EnhancedInvoiceReportItem]](../../models/shared/enhancedinvoicereportitem.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedreportaccountcategory.md b/lending/docs/models/shared/enhancedreportaccountcategory.md index 270b6bfa5..526d72a84 100644 --- a/lending/docs/models/shared/enhancedreportaccountcategory.md +++ b/lending/docs/models/shared/enhancedreportaccountcategory.md @@ -1,9 +1,9 @@ -# EnhancedReportAccountCategory - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| `levels` | List[[shared.AccountCategoryLevel](../../models/shared/accountcategorylevel.md)] | :heavy_minus_sign: | N/A | +# EnhancedReportAccountCategory + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `levels` | List[[shared.AccountCategoryLevel](../../models/shared/accountcategorylevel.md)] | :heavy_minus_sign: | N/A | | `status` | *Optional[str]* | :heavy_minus_sign: | Returns a status of "Suggested" or "Confirmed". If an account has a confirmed category, it will replace any suggested category returned. | \ No newline at end of file diff --git a/lending/docs/models/shared/enhancedreportinfo.md b/lending/docs/models/shared/enhancedreportinfo.md index b672ee0dc..196001d9f 100644 --- a/lending/docs/models/shared/enhancedreportinfo.md +++ b/lending/docs/models/shared/enhancedreportinfo.md @@ -1,11 +1,11 @@ -# EnhancedReportInfo - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | | -| `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 | -| `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 | -| `report_name` | *Optional[str]* | :heavy_minus_sign: | The name of the report. | | \ No newline at end of file +# EnhancedReportInfo + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | +| `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. | +| `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. | +| `report_name` | *Optional[str]* | :heavy_minus_sign: | The name of the report. | \ No newline at end of file diff --git a/lending/docs/models/shared/errormessage.md b/lending/docs/models/shared/errormessage.md new file mode 100644 index 000000000..425e22bbf --- /dev/null +++ b/lending/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/lending/docs/models/shared/errorstatus.md b/lending/docs/models/shared/errorstatus.md index 073bbc2ad..b5e3b5a83 100644 --- a/lending/docs/models/shared/errorstatus.md +++ b/lending/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_lending.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_lending.models.shared import ErrorStatus + +value = ErrorStatus.ACTIVE +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ACTIVE` | Active | | `RESOLVED` | Resolved | \ No newline at end of file diff --git a/lending/docs/models/shared/errorvalidation.md b/lending/docs/models/shared/errorvalidation.md index 122badd9d..618d40ff2 100644 --- a/lending/docs/models/shared/errorvalidation.md +++ b/lending/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/lending/docs/models/shared/errorvalidationitem.md b/lending/docs/models/shared/errorvalidationitem.md index fca2ef14a..a2ea37332 100644 --- a/lending/docs/models/shared/errorvalidationitem.md +++ b/lending/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/lending/docs/models/shared/excelreporttypes.md b/lending/docs/models/shared/excelreporttypes.md index 0d0e54bcc..6eba76940 100644 --- a/lending/docs/models/shared/excelreporttypes.md +++ b/lending/docs/models/shared/excelreporttypes.md @@ -1,21 +1,19 @@ -# ExcelReportTypes - -The type of the report requested in the query string. - -## Example Usage - -```python -from codat_lending.models.shared import ExcelReportTypes - -value = ExcelReportTypes.AUDIT -``` - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `AUDIT` | audit | -| `ENHANCED_FINANCIALS` | enhancedFinancials | -| `ENHANCED_INVOICES` | enhancedInvoices | +# ExcelReportTypes + +## Example Usage + +```python +from codat_lending.models.shared import ExcelReportTypes + +value = ExcelReportTypes.AUDIT +``` + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `AUDIT` | audit | +| `ENHANCED_FINANCIALS` | enhancedFinancials | +| `ENHANCED_INVOICES` | enhancedInvoices | | `ENHANCED_CASH_FLOW` | enhancedCashFlow | \ No newline at end of file diff --git a/lending/docs/models/shared/excelstatus.md b/lending/docs/models/shared/excelstatus.md index 33e0372ea..653a02376 100644 --- a/lending/docs/models/shared/excelstatus.md +++ b/lending/docs/models/shared/excelstatus.md @@ -1,15 +1,15 @@ -# ExcelStatus - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `error_message` | *Optional[str]* | :heavy_minus_sign: | Error details in case the report generation request was unsuccessful. | | -| `file_size` | *OptionalNullable[int]* | :heavy_minus_sign: | The file size in Bytes is populated upon successful generation of the report. | | -| `in_progress` | *Optional[bool]* | :heavy_minus_sign: | When true, the request was successful and the report is being generated. If false, the request was unsuccessful and the report is not being generated. | | -| `last_generated` | *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 | -| `last_invocation_id` | *Optional[str]* | :heavy_minus_sign: | A unique ID generated for this request. | | -| `queued` | *Optional[str]* | :heavy_minus_sign: | The date and time of when a successful request was queued for the most recent report. | | -| `report_type` | [Optional[shared.ExcelReportTypes]](../../models/shared/excelreporttypes.md) | :heavy_minus_sign: | The type of the report requested in the query string. | | +# ExcelStatus + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `error_message` | *Optional[str]* | :heavy_minus_sign: | Error details in case the report generation request was unsuccessful. | | +| `file_size` | *OptionalNullable[int]* | :heavy_minus_sign: | The file size in Bytes is populated upon successful generation of the report. | | +| `in_progress` | *Optional[bool]* | :heavy_minus_sign: | When true, the request was successful and the report is being generated. If false, the request was unsuccessful and the report is not being generated. | | +| `last_generated` | *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 | +| `last_invocation_id` | *Optional[str]* | :heavy_minus_sign: | A unique ID generated for this request. | | +| `queued` | *Optional[str]* | :heavy_minus_sign: | The date and time of when a successful request was queued for the most recent report. | | +| `report_type` | [Optional[shared.ExcelReportTypes]](../../models/shared/excelreporttypes.md) | :heavy_minus_sign: | The type of the report requested in the query string. | | | `success` | *Optional[bool]* | :heavy_minus_sign: | True if the requested report was successfully queued and false if the requested report was not able to be queued. | | \ No newline at end of file diff --git a/lending/docs/models/shared/file.md b/lending/docs/models/shared/file.md index c17ec914b..6cc6f3b31 100644 --- a/lending/docs/models/shared/file.md +++ b/lending/docs/models/shared/file.md @@ -1,11 +1,12 @@ -# File - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `display_name` | *OptionalNullable[str]* | :heavy_minus_sign: | An optional display name for the file. | | -| `file_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The file's name. | | -| `source_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The source of the file uploaded. | | +# File + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | | +| `display_name` | *OptionalNullable[str]* | :heavy_minus_sign: | An optional display name for the file. | | +| `file_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The file's name. | | +| `source_type` | *OptionalNullable[str]* | :heavy_minus_sign: | The source of the file uploaded. | | | `uploaded` | *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 | \ No newline at end of file diff --git a/lending/docs/models/shared/fileupload.md b/lending/docs/models/shared/fileupload.md index b033035b5..3a6b8bf8d 100644 --- a/lending/docs/models/shared/fileupload.md +++ b/lending/docs/models/shared/fileupload.md @@ -1,8 +1,8 @@ -# FileUpload - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +# FileUpload + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | | `file` | [shared.CodatFile](../../models/shared/codatfile.md) | :heavy_check_mark: | The file to be uploaded as an attachment. | \ No newline at end of file diff --git a/lending/docs/models/shared/financialsummary.md b/lending/docs/models/shared/financialsummary.md new file mode 100644 index 000000000..f0015e369 --- /dev/null +++ b/lending/docs/models/shared/financialsummary.md @@ -0,0 +1,9 @@ +# FinancialSummary + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `accounting_score` | [Optional[shared.FinancialSummaryAccountingScore]](../../models/shared/financialsummaryaccountingscore.md) | :heavy_minus_sign: | A score based on data completeness, accuracy, consistency, and presentation of data and the reasons for the score. | +| `books_closed_date` | [Optional[shared.FinancialSummaryBooksClosedDate]](../../models/shared/financialsummarybookscloseddate.md) | :heavy_minus_sign: | The date time in UTC the books closed. | \ No newline at end of file diff --git a/lending/docs/models/shared/financialsummaryaccountingscore.md b/lending/docs/models/shared/financialsummaryaccountingscore.md new file mode 100644 index 000000000..a71a9220b --- /dev/null +++ b/lending/docs/models/shared/financialsummaryaccountingscore.md @@ -0,0 +1,11 @@ +# FinancialSummaryAccountingScore + +A score based on data completeness, accuracy, consistency, and presentation of data and the reasons for the score. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `reason` | List[*str*] | :heavy_minus_sign: | List of reasons explaining the accounting score. | [
"Balance sheet is unbalanced.",
"Negative Tangible Assets on Balance Sheet",
"Negative Accounts Receivable on Balance Sheet"
] | +| `score` | *Optional[Decimal]* | :heavy_minus_sign: | The accounting score value. | 90 | \ No newline at end of file diff --git a/lending/docs/models/shared/financialsummarybookscloseddate.md b/lending/docs/models/shared/financialsummarybookscloseddate.md new file mode 100644 index 000000000..6e18283eb --- /dev/null +++ b/lending/docs/models/shared/financialsummarybookscloseddate.md @@ -0,0 +1,11 @@ +# FinancialSummaryBooksClosedDate + +The date time in UTC the books closed. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `date_` | *Optional[str]* | :heavy_minus_sign: | The date time in UTC the books closed. | 2025-05-31T00:00:00Z | +| `reason` | List[*str*] | :heavy_minus_sign: | List of reasons explaining the books closed date. | [
"One or more accounts show a deviation from expected movements for March 2025",
"One of the marketing accounts haven't been booked for February 2025",
"One of the inventory accounts haven't been booked for March 2025"
] | \ No newline at end of file diff --git a/lending/docs/models/shared/halref.md b/lending/docs/models/shared/halref.md index 94c6476ff..75aa86923 100644 --- a/lending/docs/models/shared/halref.md +++ b/lending/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/lending/docs/models/shared/integritystatus.md b/lending/docs/models/shared/integritystatus.md index 23c2f0e00..97fd60f6c 100644 --- a/lending/docs/models/shared/integritystatus.md +++ b/lending/docs/models/shared/integritystatus.md @@ -1,21 +1,19 @@ -# IntegrityStatus - -The current status of the most recently run matching algorithm. - -## Example Usage - -```python -from codat_lending.models.shared import IntegrityStatus - -value = IntegrityStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `DOES_NOT_EXIST` | DoesNotExist | -| `ERROR` | Error | +# IntegrityStatus + +## Example Usage + +```python +from codat_lending.models.shared import IntegrityStatus + +value = IntegrityStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `DOES_NOT_EXIST` | DoesNotExist | +| `ERROR` | Error | | `COMPLETE` | Complete | \ No newline at end of file diff --git a/lending/docs/models/shared/invoicelineitem.md b/lending/docs/models/shared/invoicelineitem.md index ef9810b3e..c68b946a8 100644 --- a/lending/docs/models/shared/invoicelineitem.md +++ b/lending/docs/models/shared/invoicelineitem.md @@ -1,21 +1,21 @@ -# InvoiceLineItem - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services provided. | -| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of any discounts applied. | -| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any discounts applied to the unit amount. | -| `is_direct_income` | *Optional[bool]* | :heavy_minus_sign: | The invoice is a direct income if `True`. | -| `item_ref` | [Optional[shared.PropertieItemRef]](../../models/shared/propertieitemref.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | -| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of goods or services provided. | -| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | -| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | -| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate.

Found on:

- Bill line items
- Bill Credit Note line items
- Credit Note line items
- Direct incomes line items
- Invoice line items
- Items | -| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified. | -| `tracking` | [Optional[shared.AccountsReceivableTracking]](../../models/shared/accountsreceivabletracking.md) | :heavy_minus_sign: | Categories, and a project and customer, against which the item is tracked. | -| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories to which the line item is linked. | -| `unit_amount` | *Decimal* | :heavy_check_mark: | Price of each unit of goods or services. | \ No newline at end of file +# InvoiceLineItem + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Reference to the account to which the line item is linked. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly name of the goods or services provided. | +| `discount_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Numerical value of any discounts applied. | +| `discount_percentage` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any discounts applied to the unit amount. | +| `is_direct_income` | *Optional[bool]* | :heavy_minus_sign: | The invoice is a direct income if `True`. | +| `item_ref` | [Optional[shared.ItemReference]](../../models/shared/itemreference.md) | :heavy_minus_sign: | Reference to the item the line is linked to. | +| `quantity` | *Decimal* | :heavy_check_mark: | Number of units of goods or services provided. | +| `sub_total` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of the line, inclusive of discounts but exclusive of tax. | +| `tax_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount of tax for the line. | +| `tax_rate_ref` | [Optional[shared.TaxRateRef]](../../models/shared/taxrateref.md) | :heavy_minus_sign: | Reference to the tax rate to which the line item is linked. | +| `total_amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified. | +| `tracking` | [Optional[shared.AccountsReceivableTracking]](../../models/shared/accountsreceivabletracking.md) | :heavy_minus_sign: | N/A | +| `tracking_category_refs` | List[[shared.TrackingCategoryRef](../../models/shared/trackingcategoryref.md)] | :heavy_minus_sign: | Reference to the tracking categories to which the line item is linked. | +| `unit_amount` | *Decimal* | :heavy_check_mark: | Price of each unit of goods or services. | \ No newline at end of file diff --git a/lending/docs/models/shared/invoicestatus.md b/lending/docs/models/shared/invoicestatus.md index e8b134874..af4a03232 100644 --- a/lending/docs/models/shared/invoicestatus.md +++ b/lending/docs/models/shared/invoicestatus.md @@ -1,29 +1,21 @@ -# InvoiceStatus - -Current state of the invoice: - -- `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. -- `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). -- `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. -- `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. -- `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. - -## Example Usage - -```python -from codat_lending.models.shared import InvoiceStatus - -value = InvoiceStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `DRAFT` | Draft | -| `SUBMITTED` | Submitted | -| `PARTIALLY_PAID` | PartiallyPaid | -| `PAID` | Paid | +# InvoiceStatus + +## Example Usage + +```python +from codat_lending.models.shared import InvoiceStatus + +value = InvoiceStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `DRAFT` | Draft | +| `SUBMITTED` | Submitted | +| `PARTIALLY_PAID` | PartiallyPaid | +| `PAID` | Paid | | `VOID` | Void | \ No newline at end of file diff --git a/lending/docs/models/shared/itemref.md b/lending/docs/models/shared/itemref.md index 2166a1084..fedc9d8ba 100644 --- a/lending/docs/models/shared/itemref.md +++ b/lending/docs/models/shared/itemref.md @@ -1,10 +1,10 @@ -# ItemRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The data connection id being referenced. | -| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object, e.g. the Journal entry. | +# ItemRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The data connection id being referenced. | +| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object, e.g. the Journal entry. | | `type` | *Optional[str]* | :heavy_minus_sign: | The data type the loan transaction entry was extracted from. | \ No newline at end of file diff --git a/lending/docs/models/shared/itemreference.md b/lending/docs/models/shared/itemreference.md index e60fe984a..bdf9e9bc1 100644 --- a/lending/docs/models/shared/itemreference.md +++ b/lending/docs/models/shared/itemreference.md @@ -1,11 +1,11 @@ -# ItemReference - -Reference to the item the line is linked to. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the item in the accounting software. | +# ItemReference + +Reference to the item the line is linked to. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier for the item in the accounting software. | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the item in the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/items.md b/lending/docs/models/shared/items.md index ef943d1f5..fac7c90be 100644 --- a/lending/docs/models/shared/items.md +++ b/lending/docs/models/shared/items.md @@ -1,9 +1,9 @@ -# Items - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `amount` | *Decimal* | :heavy_check_mark: | Amount of tax withheld. | +# Items + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `amount` | *Decimal* | :heavy_check_mark: | Amount of tax withheld. | | `name` | *str* | :heavy_check_mark: | Name assigned to withheld tax. | \ No newline at end of file diff --git a/lending/docs/models/shared/journalentryrecordref.md b/lending/docs/models/shared/journalentryrecordref.md index 3e4a213a0..6f1eb256c 100644 --- a/lending/docs/models/shared/journalentryrecordref.md +++ b/lending/docs/models/shared/journalentryrecordref.md @@ -1,11 +1,9 @@ -# JournalEntryRecordRef - -Links a journal entry to the underlying record that created it. - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `data_type` | [Optional[shared.JournalEntryRecordRefDataType]](../../models/shared/journalentryrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | transfers | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file +# JournalEntryRecordRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `data_type` | [Optional[shared.JournalEntryRecordRefDataType]](../../models/shared/journalentryrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/journalentryrecordrefdatatype.md b/lending/docs/models/shared/journalentryrecordrefdatatype.md index b07b3000a..9d266235f 100644 --- a/lending/docs/models/shared/journalentryrecordrefdatatype.md +++ b/lending/docs/models/shared/journalentryrecordrefdatatype.md @@ -1,28 +1,26 @@ -# JournalEntryRecordRefDataType - -Name of underlying data type. - -## Example Usage - -```python -from codat_lending.models.shared import JournalEntryRecordRefDataType - -value = JournalEntryRecordRefDataType.BANK_TRANSACTIONS -``` - - -## Values - -| Name | Value | -| ------------------- | ------------------- | -| `BANK_TRANSACTIONS` | bankTransactions | -| `BILL_CREDIT_NOTES` | billCreditNotes | -| `BILL_PAYMENTS` | billPayments | -| `BILLS` | bills | -| `CREDIT_NOTES` | creditNotes | -| `DIRECT_COSTS` | directCosts | -| `DIRECT_INCOMES` | directIncomes | -| `INVOICES` | invoices | -| `JOURNAL_ENTRIES` | journalEntries | -| `PAYMENTS` | payments | +# JournalEntryRecordRefDataType + +## Example Usage + +```python +from codat_lending.models.shared import JournalEntryRecordRefDataType + +value = JournalEntryRecordRefDataType.BANK_TRANSACTIONS +``` + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `BANK_TRANSACTIONS` | bankTransactions | +| `BILL_CREDIT_NOTES` | billCreditNotes | +| `BILL_PAYMENTS` | billPayments | +| `BILLS` | bills | +| `CREDIT_NOTES` | creditNotes | +| `DIRECT_COSTS` | directCosts | +| `DIRECT_INCOMES` | directIncomes | +| `INVOICES` | invoices | +| `JOURNAL_ENTRIES` | journalEntries | +| `PAYMENTS` | payments | | `TRANSFERS` | transfers | \ No newline at end of file diff --git a/lending/docs/models/shared/journalline.md b/lending/docs/models/shared/journalline.md index e5ce725bb..afa8f636d 100644 --- a/lending/docs/models/shared/journalline.md +++ b/lending/docs/models/shared/journalline.md @@ -1,15 +1,15 @@ -# JournalLine - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `contact_ref` | [Optional[shared.ContactReference]](../../models/shared/contactreference.md) | :heavy_minus_sign: | N/A | -| `currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency for the journal line item. | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the journal line item. | -| `net_amount` | *Decimal* | :heavy_check_mark: | Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative. | -| `tracking` | [Optional[shared.JournalLineTracking]](../../models/shared/journallinetracking.md) | :heavy_minus_sign: | List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) | -| `transaction_amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount in the original transaction currency. | +# JournalLine + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | +| `contact_ref` | [Optional[shared.ContactReference]](../../models/shared/contactreference.md) | :heavy_minus_sign: | N/A | +| `currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency for the journal line item. | +| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the journal line item. | +| `net_amount` | *Decimal* | :heavy_check_mark: | Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative. | +| `tracking` | [Optional[shared.JournalLineTracking]](../../models/shared/journallinetracking.md) | :heavy_minus_sign: | List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) | +| `transaction_amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount in the original transaction currency. | | `transaction_currency` | *OptionalNullable[str]* | :heavy_minus_sign: | Currency of the original transaction. | \ No newline at end of file diff --git a/lending/docs/models/shared/journallinedatatype.md b/lending/docs/models/shared/journallinedatatype.md index e4c52e850..f74c93034 100644 --- a/lending/docs/models/shared/journallinedatatype.md +++ b/lending/docs/models/shared/journallinedatatype.md @@ -1,19 +1,19 @@ -# JournalLineDataType - -Allowed name of the 'dataType'. - -## Example Usage - -```python -from codat_lending.models.shared import JournalLineDataType - -value = JournalLineDataType.CUSTOMERS -``` - - -## Values - -| Name | Value | -| ----------- | ----------- | -| `CUSTOMERS` | customers | +# JournalLineDataType + +Allowed name of the 'dataType'. + +## Example Usage + +```python +from codat_lending.models.shared import JournalLineDataType + +value = JournalLineDataType.CUSTOMERS +``` + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `CUSTOMERS` | customers | | `SUPPLIERS` | suppliers | \ No newline at end of file diff --git a/lending/docs/models/shared/journallinetracking.md b/lending/docs/models/shared/journallinetracking.md index 0d8fea50c..5a8901c1b 100644 --- a/lending/docs/models/shared/journallinetracking.md +++ b/lending/docs/models/shared/journallinetracking.md @@ -1,10 +1,10 @@ -# JournalLineTracking - -List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +# JournalLineTracking + +List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | `record_refs` | List[[shared.TrackingRecordRef](../../models/shared/trackingrecordref.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/journallinetrackingdatatype.md b/lending/docs/models/shared/journallinetrackingdatatype.md new file mode 100644 index 000000000..59628646f --- /dev/null +++ b/lending/docs/models/shared/journallinetrackingdatatype.md @@ -0,0 +1,18 @@ +# JournalLineTrackingDataType + +## Example Usage + +```python +from codat_lending.models.shared import JournalLineTrackingDataType + +value = JournalLineTrackingDataType.CUSTOMERS +``` + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `CUSTOMERS` | customers | +| `SUPPLIERS` | suppliers | +| `TRACKING_CATEGORIES` | trackingCategories | \ No newline at end of file diff --git a/lending/docs/models/shared/accountingcreateaccountresponseaccountingaccount.md b/lending/docs/models/shared/journalprototype.md similarity index 61% rename from lending/docs/models/shared/accountingcreateaccountresponseaccountingaccount.md rename to lending/docs/models/shared/journalprototype.md index 16f42892b..cfd8d7b72 100644 --- a/lending/docs/models/shared/accountingcreateaccountresponseaccountingaccount.md +++ b/lending/docs/models/shared/journalprototype.md @@ -1,52 +1,14 @@ -# ~~AccountingCreateAccountResponseAccountingAccount~~ - -> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - -## Overview - -Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - -The categories for an account include: -* Asset -* Expense -* Income -* Liability -* Equity. - -The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - -At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - -To determine the list of allowed categories for a specific integration, you can: -- Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). -- Refer to the integration's own documentation. - -> **Accounts with no category** -> -> If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. -> -> This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - -> :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 | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `current_balance` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Current balance in the account. | 0 | -| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description for the account. | Invoices the business has issued but has not yet collected payment on. | -| `fully_qualified_category` | *OptionalNullable[str]* | :heavy_minus_sign: | Full category of the account.

For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. | Asset.Current | -| `fully_qualified_name` | *OptionalNullable[str]* | :heavy_minus_sign: | Full name of the account, for example:
- `Cash On Hand`
- `Rents Held In Trust`
- `Fixed Asset` | **Example 1:** Cash On Hand
**Example 2:** Fixed Asset | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company. | 1b6266d1-1e44-46c5-8eb5-a8f98e03124e | -| `is_bank_account` | *Optional[bool]* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | -| `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 | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | -| `nominal_code` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | -| `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.AccountStatus]](../../models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the 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. | | -| `type` | [Optional[shared.AccountType]](../../models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | -| `valid_datatype_links` | List[[shared.AccountingCreateAccountResponseValidDataTypeLinks](../../models/shared/accountingcreateaccountresponsevaliddatatypelinks.md)] | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file +# JournalPrototype + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `created_on` | *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 | +| `has_children` | *Optional[bool]* | :heavy_minus_sign: | If the journal has child journals, this value is true. If it doesn’t, it is false. | | +| `journal_code` | *Optional[str]* | :heavy_minus_sign: | Native journal number or code. | | +| `name` | *Optional[str]* | :heavy_minus_sign: | Journal name.
The maximum length for a journal name is 256 characters. All characters above that number will be truncated. | | +| `parent_id` | *Optional[str]* | :heavy_minus_sign: | Parent journal ID.
If the journal is a parent journal, this value is not present. | | +| `status` | [Optional[shared.JournalStatus]](../../models/shared/journalstatus.md) | :heavy_minus_sign: | Current journal status. | | +| `type` | *Optional[str]* | :heavy_minus_sign: | The type of the journal. | | \ No newline at end of file diff --git a/lending/docs/models/shared/journalref.md b/lending/docs/models/shared/journalref.md index 6be19166a..6955f48e3 100644 --- a/lending/docs/models/shared/journalref.md +++ b/lending/docs/models/shared/journalref.md @@ -1,11 +1,10 @@ -# JournalRef - -Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `id` | *str* | :heavy_check_mark: | GUID of the underlying journal. | +# JournalRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `id` | *str* | :heavy_check_mark: | GUID of the underlying journal. | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of journal | \ No newline at end of file diff --git a/lending/docs/models/shared/journalstatus.md b/lending/docs/models/shared/journalstatus.md index b188a4fa3..1fe564458 100644 --- a/lending/docs/models/shared/journalstatus.md +++ b/lending/docs/models/shared/journalstatus.md @@ -1,20 +1,18 @@ -# JournalStatus - -Current journal status. - -## Example Usage - -```python -from codat_lending.models.shared import JournalStatus - -value = JournalStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | +# JournalStatus + +## Example Usage + +```python +from codat_lending.models.shared import JournalStatus + +value = JournalStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | | `ARCHIVED` | Archived | \ No newline at end of file diff --git a/lending/docs/models/shared/lendingcustomerref.md b/lending/docs/models/shared/lendingcustomerref.md index 2f7a170d9..4d2161ec2 100644 --- a/lending/docs/models/shared/lendingcustomerref.md +++ b/lending/docs/models/shared/lendingcustomerref.md @@ -1,9 +1,9 @@ -# LendingCustomerRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `customer_name` | *OptionalNullable[str]* | :heavy_minus_sign: | `customerName` from the Customer data type. | +# LendingCustomerRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `customer_name` | *OptionalNullable[str]* | :heavy_minus_sign: | `customerName` from the Customer data type. | | `id` | *Optional[str]* | :heavy_minus_sign: | `id` from the Customers data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/links.md b/lending/docs/models/shared/links.md index 5f80d2652..b91889951 100644 --- a/lending/docs/models/shared/links.md +++ b/lending/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/lending/docs/models/shared/loanref.md b/lending/docs/models/shared/loanref.md index 241a79b0c..077551e3a 100644 --- a/lending/docs/models/shared/loanref.md +++ b/lending/docs/models/shared/loanref.md @@ -1,10 +1,10 @@ -# LoanRef - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The dataConnectionId the object being referred to is associated with. | -| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object being referred to. | +# LoanRef + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The dataConnectionId the object being referred to is associated with. | +| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object being referred to. | | `type` | *Optional[str]* | :heavy_minus_sign: | The object type data is referring to, e.g. Account. | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummary.md b/lending/docs/models/shared/loansummary.md index c3d0060af..9c2417cd7 100644 --- a/lending/docs/models/shared/loansummary.md +++ b/lending/docs/models/shared/loansummary.md @@ -1,9 +1,9 @@ -# LoanSummary - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `report_info` | [Optional[shared.LoanSummaryReportInfo]](../../models/shared/loansummaryreportinfo.md) | :heavy_minus_sign: | N/A | +# LoanSummary + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `report_info` | [Optional[shared.LoanSummaryReportInfo]](../../models/shared/loansummaryreportinfo.md) | :heavy_minus_sign: | N/A | | `report_items` | List[[shared.LoanSummaryReportItem](../../models/shared/loansummaryreportitem.md)] | :heavy_minus_sign: | Returns a summary of all loan activity for that integration type | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummaryintegrationtype.md b/lending/docs/models/shared/loansummaryintegrationtype.md index fc05694ac..70fe3a3c1 100644 --- a/lending/docs/models/shared/loansummaryintegrationtype.md +++ b/lending/docs/models/shared/loansummaryintegrationtype.md @@ -1,20 +1,18 @@ -# LoanSummaryIntegrationType - -The integration type begin referred to. - -## Example Usage - -```python -from codat_lending.models.shared import LoanSummaryIntegrationType - -value = LoanSummaryIntegrationType.ACCOUNTING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `ACCOUNTING` | Accounting | -| `BANKING` | Banking | +# LoanSummaryIntegrationType + +## Example Usage + +```python +from codat_lending.models.shared import LoanSummaryIntegrationType + +value = LoanSummaryIntegrationType.ACCOUNTING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `ACCOUNTING` | Accounting | +| `BANKING` | Banking | | `COMMERCE` | Commerce | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummaryrecordref.md b/lending/docs/models/shared/loansummaryrecordref.md index 7c201e554..46c10219a 100644 --- a/lending/docs/models/shared/loansummaryrecordref.md +++ b/lending/docs/models/shared/loansummaryrecordref.md @@ -1,11 +1,11 @@ -# LoanSummaryRecordRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The dataConnectionId the object being referred to is associated with. | -| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object being referred to. | -| `integration_type` | [Optional[shared.LoanSummaryIntegrationType]](../../models/shared/loansummaryintegrationtype.md) | :heavy_minus_sign: | The integration type begin referred to. | -| `record_ref_type` | [Optional[shared.LoanSummaryRecordRefType]](../../models/shared/loansummaryrecordreftype.md) | :heavy_minus_sign: | The datatype being referred to. | \ No newline at end of file +# LoanSummaryRecordRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `data_connection_id` | *Optional[str]* | :heavy_minus_sign: | The dataConnectionId the object being referred to is associated with. | +| `id` | *Optional[str]* | :heavy_minus_sign: | The id of the object being referred to. | +| `integration_type` | [Optional[shared.LoanSummaryIntegrationType]](../../models/shared/loansummaryintegrationtype.md) | :heavy_minus_sign: | N/A | +| `record_ref_type` | [Optional[shared.LoanSummaryRecordRefType]](../../models/shared/loansummaryrecordreftype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummaryrecordreftype.md b/lending/docs/models/shared/loansummaryrecordreftype.md index 4ac19253a..8687437c0 100644 --- a/lending/docs/models/shared/loansummaryrecordreftype.md +++ b/lending/docs/models/shared/loansummaryrecordreftype.md @@ -1,20 +1,20 @@ -# LoanSummaryRecordRefType - -The datatype being referred to. - -## Example Usage - -```python -from codat_lending.models.shared import LoanSummaryRecordRefType - -value = LoanSummaryRecordRefType.ACCOUNTS -``` - - -## Values - -| Name | Value | -| ----------------------- | ----------------------- | -| `ACCOUNTS` | accounts | -| `BANKING_ACCOUNTS` | banking-accounts | -| `COMMERCE_TRANSACTIONS` | commerce-transactions | \ No newline at end of file +# LoanSummaryRecordRefType + +## Example Usage + +```python +from codat_lending.models.shared import LoanSummaryRecordRefType + +value = LoanSummaryRecordRefType.ACCOUNTS +``` + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `ACCOUNTS` | accounts | +| `BANKING_MINUS_ACCOUNTS` | banking-accounts | +| `BANKING_ACCOUNTS` | banking-accounts | +| `COMMERCE_MINUS_TRANSACTIONS` | commerce-transactions | +| `COMMERCE_TRANSACTIONS` | commerce-transactions | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummaryreportinfo.md b/lending/docs/models/shared/loansummaryreportinfo.md index c0602abf0..2cb457799 100644 --- a/lending/docs/models/shared/loansummaryreportinfo.md +++ b/lending/docs/models/shared/loansummaryreportinfo.md @@ -1,10 +1,10 @@ -# LoanSummaryReportInfo - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | | -| `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 | +# LoanSummaryReportInfo + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | | +| `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 | | `report_name` | *Optional[str]* | :heavy_minus_sign: | The name of the report. | | \ No newline at end of file diff --git a/lending/docs/models/shared/loansummaryreportitem.md b/lending/docs/models/shared/loansummaryreportitem.md index ba5d51482..954be770f 100644 --- a/lending/docs/models/shared/loansummaryreportitem.md +++ b/lending/docs/models/shared/loansummaryreportitem.md @@ -1,14 +1,14 @@ -# LoanSummaryReportItem - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The loan outstanding balance. This may not equal totalDrawdowns - totalRepayments due to interest which has been accrued. | | -| `description` | *Optional[str]* | :heavy_minus_sign: | The description of the object being referred to. E.g. the account. | | -| `lender` | *Optional[str]* | :heavy_minus_sign: | The name of lender providing the loan. | | -| `record_ref` | [Optional[shared.LoanSummaryRecordRef]](../../models/shared/loansummaryrecordref.md) | :heavy_minus_sign: | N/A | | -| `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 | -| `total_drawdowns` | *Optional[Decimal]* | :heavy_minus_sign: | The total loan drawdowns. | | -| `total_repayments` | *Optional[Decimal]* | :heavy_minus_sign: | The total loan repayments which includes capital plus any interest. | | \ No newline at end of file +# LoanSummaryReportItem + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | The loan outstanding balance. This may not equal totalDrawdowns - totalRepayments due to interest which has been accrued. | +| `description` | *Optional[str]* | :heavy_minus_sign: | The description of the object being referred to. E.g. the account. | +| `lender` | *Optional[str]* | :heavy_minus_sign: | The name of lender providing the loan. | +| `record_ref` | [Optional[shared.LoanSummaryRecordRef]](../../models/shared/loansummaryrecordref.md) | :heavy_minus_sign: | Contains object that contains a summary of all loan transactions for that integration type. | +| `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. | +| `total_drawdowns` | *Optional[Decimal]* | :heavy_minus_sign: | The total loan drawdowns. | +| `total_repayments` | *Optional[Decimal]* | :heavy_minus_sign: | The total loan repayments which includes capital plus any interest. | \ No newline at end of file diff --git a/lending/docs/models/shared/loantransactions.md b/lending/docs/models/shared/loantransactions.md index 5af876b47..a7e2cd9b7 100644 --- a/lending/docs/models/shared/loantransactions.md +++ b/lending/docs/models/shared/loantransactions.md @@ -1,9 +1,9 @@ -# LoanTransactions - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `report_info` | [Optional[shared.LoanTransactionsReportInfo]](../../models/shared/loantransactionsreportinfo.md) | :heavy_minus_sign: | N/A | +# LoanTransactions + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `report_info` | [Optional[shared.LoanTransactionsReportInfo]](../../models/shared/loantransactionsreportinfo.md) | :heavy_minus_sign: | N/A | | `report_items` | List[[shared.ReportItems](../../models/shared/reportitems.md)] | :heavy_minus_sign: | Contains object of reporting properties. The loan ref will reference a different object depending on the integration type. | \ No newline at end of file diff --git a/lending/docs/models/shared/loantransactionsreportinfo.md b/lending/docs/models/shared/loantransactionsreportinfo.md index 35639784b..320510904 100644 --- a/lending/docs/models/shared/loantransactionsreportinfo.md +++ b/lending/docs/models/shared/loantransactionsreportinfo.md @@ -1,13 +1,13 @@ -# LoanTransactionsReportInfo - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | | -| `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 | -| `page_number` | *Optional[int]* | :heavy_minus_sign: | The page number. | | -| `page_size` | *Optional[int]* | :heavy_minus_sign: | Queried page size. | | -| `report_name` | *Optional[str]* | :heavy_minus_sign: | The name of the report. | | +# LoanTransactionsReportInfo + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | Name of the company queried. | | +| `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 | +| `page_number` | *Optional[int]* | :heavy_minus_sign: | The page number. | | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | Queried page size. | | +| `report_name` | *Optional[str]* | :heavy_minus_sign: | The name of the report. | | | `total_results` | *Optional[int]* | :heavy_minus_sign: | The total number of transactions returned. | | \ No newline at end of file diff --git a/lending/docs/models/shared/loantransactiontype.md b/lending/docs/models/shared/loantransactiontype.md index deaf80921..f6406471f 100644 --- a/lending/docs/models/shared/loantransactiontype.md +++ b/lending/docs/models/shared/loantransactiontype.md @@ -1,21 +1,19 @@ -# LoanTransactionType - -The type of loan transaction. - -## Example Usage - -```python -from codat_lending.models.shared import LoanTransactionType - -value = LoanTransactionType.INVESTMENT -``` - - -## Values - -| Name | Value | -| ------------------ | ------------------ | -| `INVESTMENT` | Investment | -| `REPAYMENT` | Repayment | -| `INTEREST` | Interest | +# LoanTransactionType + +## Example Usage + +```python +from codat_lending.models.shared import LoanTransactionType + +value = LoanTransactionType.INVESTMENT +``` + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `INVESTMENT` | Investment | +| `REPAYMENT` | Repayment | +| `INTEREST` | Interest | | `ACCURED_INTEREST` | AccuredInterest | \ No newline at end of file diff --git a/lending/docs/models/shared/locationref.md b/lending/docs/models/shared/locationref.md index d0a5b1671..5510c51b7 100644 --- a/lending/docs/models/shared/locationref.md +++ b/lending/docs/models/shared/locationref.md @@ -1,11 +1,9 @@ -# LocationRef - -Reference to the geographic location where the order was placed. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identitifer of the location being referenced. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the location being referenced. | | \ No newline at end of file +# LocationRef + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identitifer of the location being referenced. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the location being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/metadata.md b/lending/docs/models/shared/metadata.md index 8fb4a6e5c..0b4a50ce8 100644 --- a/lending/docs/models/shared/metadata.md +++ b/lending/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/lending/docs/models/shared/model0.md b/lending/docs/models/shared/model0.md new file mode 100644 index 000000000..1679fb1cc --- /dev/null +++ b/lending/docs/models/shared/model0.md @@ -0,0 +1,8 @@ +# Model0 + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | \ No newline at end of file diff --git a/lending/docs/models/shared/model3.md b/lending/docs/models/shared/model3.md new file mode 100644 index 000000000..444de48e8 --- /dev/null +++ b/lending/docs/models/shared/model3.md @@ -0,0 +1,9 @@ +# Model3 + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `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. | +| `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. | \ No newline at end of file diff --git a/lending/docs/models/shared/orderdiscountallocation.md b/lending/docs/models/shared/orderdiscountallocation.md index 84a454e20..214271c6c 100644 --- a/lending/docs/models/shared/orderdiscountallocation.md +++ b/lending/docs/models/shared/orderdiscountallocation.md @@ -1,9 +1,9 @@ -# OrderDiscountAllocation - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the discount in the commerce or point of sale platform. | Promotional Discount | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line). | 15.25 | \ No newline at end of file +# OrderDiscountAllocation + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the discount in the commerce or point of sale platform. | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line). | \ No newline at end of file diff --git a/lending/docs/models/shared/orderlineitem.md b/lending/docs/models/shared/orderlineitem.md index 02de399a0..cdafe22ac 100644 --- a/lending/docs/models/shared/orderlineitem.md +++ b/lending/docs/models/shared/orderlineitem.md @@ -1,17 +1,17 @@ -# OrderLineItem - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `discount_allocations` | List[[shared.OrderDiscountAllocation](../../models/shared/orderdiscountallocation.md)] | :heavy_minus_sign: | N/A | | -| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `product_ref` | [Optional[shared.ProductRef]](../../models/shared/productref.md) | :heavy_minus_sign: | Reference that links the line item to the correct product details. | | -| `product_variant_ref` | [Optional[shared.ProductVariantRef]](../../models/shared/productvariantref.md) | :heavy_minus_sign: | Reference that links the line item to the specific version of product that has been ordered. | | -| `quantity` | *Optional[Decimal]* | :heavy_minus_sign: | Number of units of the product sold.
For refunds, quantity is negative.
| | -| `tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any sales tax applied to the unit price. | **Example 1:** 0
**Example 2:** 12.5
**Example 3:** 45.00 | -| `taxes` | List[[shared.TaxComponentAllocation](../../models/shared/taxcomponentallocation.md)] | :heavy_minus_sign: | Taxes breakdown as applied to order lines. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | | -| `total_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of tax applied to the line item, factoring in any discounts. | | -| `unit_price` | *Optional[Decimal]* | :heavy_minus_sign: | Price per unit of goods or services, excluding discounts and tax. | | \ No newline at end of file +# OrderLineItem + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `discount_allocations` | List[[shared.OrderDiscountAllocation](../../models/shared/orderdiscountallocation.md)] | :heavy_minus_sign: | N/A | +| `id` | *str* | :heavy_check_mark: | A unique, persistent identifier for this record | +| `product_ref` | [Optional[shared.ProductRef]](../../models/shared/productref.md) | :heavy_minus_sign: | N/A | +| `product_variant_ref` | [Optional[shared.ProductVariantRef]](../../models/shared/productvariantref.md) | :heavy_minus_sign: | N/A | +| `quantity` | *Optional[Decimal]* | :heavy_minus_sign: | Number of units of the product sold. For refunds, quantity is negative. | +| `tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any sales tax applied to the unit price. | +| `taxes` | List[[shared.TaxComponentAllocation](../../models/shared/taxcomponentallocation.md)] | :heavy_minus_sign: | Taxes breakdown as applied to order lines. | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the line item, including discounts and tax. | +| `total_tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of tax applied to the line item, factoring in any discounts. | +| `unit_price` | *Optional[Decimal]* | :heavy_minus_sign: | Price per unit of goods or services, excluding discounts and tax. | \ No newline at end of file diff --git a/lending/docs/models/shared/paginginfo.md b/lending/docs/models/shared/paginginfo.md new file mode 100644 index 000000000..b72226e79 --- /dev/null +++ b/lending/docs/models/shared/paginginfo.md @@ -0,0 +1,11 @@ +# PagingInfo + + +## 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/lending/docs/models/shared/path.md b/lending/docs/models/shared/path.md index 100598850..f771a7084 100644 --- a/lending/docs/models/shared/path.md +++ b/lending/docs/models/shared/path.md @@ -1,16 +1,16 @@ -# Path - -## Example Usage - -```python -from codat_lending.models.shared import Path - -value = Path.AUTH_GET -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | +# Path + +## Example Usage + +```python +from codat_lending.models.shared import Path + +value = Path.AUTH_GET +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | | `AUTH_GET` | auth/get | \ No newline at end of file diff --git a/lending/docs/models/shared/payment.md b/lending/docs/models/shared/payment.md index d8202e7ef..002ab9ae8 100644 --- a/lending/docs/models/shared/payment.md +++ b/lending/docs/models/shared/payment.md @@ -1,14 +1,14 @@ -# Payment - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Payment amount. | | -| `banking_transaction_refs` | List[[shared.BankingTransactionRef](../../models/shared/bankingtransactionref.md)] | :heavy_minus_sign: | N/A | | -| `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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `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: | ID of the invoice, which may be a GUID but it may be something else depending on the accounting software. | | -| `payment_type` | *Optional[str]* | :heavy_minus_sign: | The type of payment. | | \ No newline at end of file +# Payment + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | Payment amount. | +| `banking_transaction_refs` | List[[shared.BankingTransactionRef](../../models/shared/bankingtransactionref.md)] | :heavy_minus_sign: | N/A | +| `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. | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `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` | *Optional[str]* | :heavy_minus_sign: | ID of the invoice, which may be a GUID but it may be something else depending on the accounting software. | +| `payment_type` | *Optional[str]* | :heavy_minus_sign: | The type of payment. | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentallocationpayment.md b/lending/docs/models/shared/paymentallocationpayment.md index 981a4e806..affe95a30 100644 --- a/lending/docs/models/shared/paymentallocationpayment.md +++ b/lending/docs/models/shared/paymentallocationpayment.md @@ -1,15 +1,15 @@ -# PaymentAllocationPayment - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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 | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the allocated payment. | | -| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Notes attached to the allocated payment. | | -| `paid_on_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 | -| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference to the allocated payment. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount that was paid. | | \ No newline at end of file +# PaymentAllocationPayment + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountRef]](../../models/shared/accountref.md) | :heavy_minus_sign: | The account that the allocated payment is made from or to. | +| `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. | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (GBP) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **USD** \| $20 \| 0.781 \| £15.62 \| \| **EUR** \| €20 \| 0.885 \| £17.70 \| \| **RUB** \| ₽20 \| 0.011 \| £0.22 \| ## Examples with base currency of USD \| Foreign Currency \| Foreign Amount \| Currency Rate \| Base Currency Amount (USD) \| \| :--------------- \| :------------- \| :------------ \| :------------------------- \| \| **GBP** \| £20 \| 1.277 \| $25.54 \| \| **EUR** \| €20 \| 1.134 \| $22.68 \| \| **RUB** \| ₽20 \| 0.015 \| $0.30 \| ### Integration-specific details \| Integration \| Scenario \| System behavior \| \|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier of the allocated payment. | +| `note` | *OptionalNullable[str]* | :heavy_minus_sign: | Notes attached to the allocated payment. | +| `paid_on_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. | +| `reference` | *OptionalNullable[str]* | :heavy_minus_sign: | Reference to the allocated payment. | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount that was paid. | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentline.md b/lending/docs/models/shared/paymentline.md index 3a67b495c..74f1d198b 100644 --- a/lending/docs/models/shared/paymentline.md +++ b/lending/docs/models/shared/paymentline.md @@ -1,10 +1,10 @@ -# PaymentLine - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allocated_on_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 | -| `amount` | *Decimal* | :heavy_check_mark: | Amount in the payment currency. | | +# PaymentLine + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allocated_on_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 | +| `amount` | *Decimal* | :heavy_check_mark: | Amount in the payment currency. | | | `links` | List[[shared.PaymentLineLink](../../models/shared/paymentlinelink.md)] | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentlinelink.md b/lending/docs/models/shared/paymentlinelink.md index 9816a522c..d5fac4ce6 100644 --- a/lending/docs/models/shared/paymentlinelink.md +++ b/lending/docs/models/shared/paymentlinelink.md @@ -1,11 +1,12 @@ -# PaymentLineLink - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity.
A negative link amount _reduces_ the outstanding amount on the accounts receivable account.
A positive link amount _increases_ the outstanding amount on the accounts receivable account. | -| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the transaction represented by the link. | +# PaymentLineLink + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Amount by which the balance of the linked entity is altered, in the currency of the linked entity.
A negative link amount _reduces_ the outstanding amount on the accounts receivable account.
A positive link amount _increases_ the outstanding amount on the accounts receivable account. | +| `currency_rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the transaction represented by the link. | | `type` | [shared.PaymentLinkType](../../models/shared/paymentlinktype.md) | :heavy_check_mark: | Types of payment line links, either:
`Unknown`
`Unlinked` - Not used
`Invoice` - ID refers to the invoice
`CreditNote` - ID refers to the credit note
`Refund` - ID refers to the sibling payment
`Payment` - ID refers to the sibling payment
`PaymentOnAccount` - ID refers to the customer
`Other` - ID refers to the customer
`Manual Journal`
`Discount` - ID refers to the payment | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentlinktype.md b/lending/docs/models/shared/paymentlinktype.md index 6f5136fc6..cc48fd4c4 100644 --- a/lending/docs/models/shared/paymentlinktype.md +++ b/lending/docs/models/shared/paymentlinktype.md @@ -1,37 +1,37 @@ -# PaymentLinkType - -Types of payment line links, either: -`Unknown` -`Unlinked` - Not used -`Invoice` - ID refers to the invoice -`CreditNote` - ID refers to the credit note -`Refund` - ID refers to the sibling payment -`Payment` - ID refers to the sibling payment -`PaymentOnAccount` - ID refers to the customer -`Other` - ID refers to the customer -`Manual Journal` -`Discount` - ID refers to the payment - -## Example Usage - -```python -from codat_lending.models.shared import PaymentLinkType - -value = PaymentLinkType.UNKNOWN -``` - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `UNKNOWN` | Unknown | -| `UNLINKED` | Unlinked | -| `INVOICE` | Invoice | -| `CREDIT_NOTE` | CreditNote | -| `OTHER` | Other | -| `REFUND` | Refund | -| `PAYMENT` | Payment | -| `PAYMENT_ON_ACCOUNT` | PaymentOnAccount | -| `MANUAL_JOURNAL` | ManualJournal | +# PaymentLinkType + +Types of payment line links, either: +`Unknown` +`Unlinked` - Not used +`Invoice` - ID refers to the invoice +`CreditNote` - ID refers to the credit note +`Refund` - ID refers to the sibling payment +`Payment` - ID refers to the sibling payment +`PaymentOnAccount` - ID refers to the customer +`Other` - ID refers to the customer +`Manual Journal` +`Discount` - ID refers to the payment + +## Example Usage + +```python +from codat_lending.models.shared import PaymentLinkType + +value = PaymentLinkType.UNKNOWN +``` + + +## Values + +| Name | Value | +| -------------------- | -------------------- | +| `UNKNOWN` | Unknown | +| `UNLINKED` | Unlinked | +| `INVOICE` | Invoice | +| `CREDIT_NOTE` | CreditNote | +| `OTHER` | Other | +| `REFUND` | Refund | +| `PAYMENT` | Payment | +| `PAYMENT_ON_ACCOUNT` | PaymentOnAccount | +| `MANUAL_JOURNAL` | ManualJournal | | `DISCOUNT` | Discount | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentmethodref.md b/lending/docs/models/shared/paymentmethodref.md index 42548fc56..71ba171a8 100644 --- a/lending/docs/models/shared/paymentmethodref.md +++ b/lending/docs/models/shared/paymentmethodref.md @@ -1,11 +1,11 @@ -# PaymentMethodRef - -The payment method the record is linked to in the accounting or commerce software. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the location being referenced. | +# PaymentMethodRef + +The payment method the record is linked to in the accounting or commerce software. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the location being referenced. | | `name` | *Optional[str]* | :heavy_minus_sign: | Name of the location being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentmethodtype.md b/lending/docs/models/shared/paymentmethodtype.md new file mode 100644 index 000000000..9d944e2b1 --- /dev/null +++ b/lending/docs/models/shared/paymentmethodtype.md @@ -0,0 +1,22 @@ +# PaymentMethodType + +## Example Usage + +```python +from codat_lending.models.shared import PaymentMethodType + +value = PaymentMethodType.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `UNKNOWN` | Unknown | +| `CASH` | Cash | +| `CHECK` | Check | +| `CREDIT_CARD` | CreditCard | +| `DEBIT_CARD` | DebitCard | +| `BANK_TRANSFER` | BankTransfer | +| `OTHER` | Other | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentref.md b/lending/docs/models/shared/paymentref.md index e4a1f6011..857de0d08 100644 --- a/lending/docs/models/shared/paymentref.md +++ b/lending/docs/models/shared/paymentref.md @@ -1,17 +1,17 @@ -# PaymentRef - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Payment Amount (including gratuity). | **Example 1:** 194.12
**Example 2:** -283.56
**Example 3:** 0 | -| `created_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 | -| `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 | -| `due_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `payment_provider` | *Optional[str]* | :heavy_minus_sign: | Service provider of the payment, if applicable. | **Example 1:** Amazon Pay
**Example 2:** Checkout.com
**Example 3:** SagePay | -| `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.PaymentStatus]](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | Status of the payment. | | -| `type` | [OptionalNullable[shared.PaymentType]](../../models/shared/paymenttype.md) | :heavy_minus_sign: | Type of payment. | Cash | \ No newline at end of file +# PaymentRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `amount` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Payment Amount (including gratuity). | +| `created_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. | +| `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. | +| `due_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: | A unique, persistent identifier for this record | +| `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. | +| `payment_provider` | *Optional[str]* | :heavy_minus_sign: | Service provider of the payment, if applicable. | +| `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.PaymentStatus]](../../models/shared/paymentstatus.md) | :heavy_minus_sign: | N/A | +| `type` | [OptionalNullable[shared.PaymentType]](../../models/shared/paymenttype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/paymentstatus.md b/lending/docs/models/shared/paymentstatus.md index da84b5acf..8f7f2a9cd 100644 --- a/lending/docs/models/shared/paymentstatus.md +++ b/lending/docs/models/shared/paymentstatus.md @@ -1,23 +1,21 @@ -# PaymentStatus - -Status of the payment. - -## Example Usage - -```python -from codat_lending.models.shared import PaymentStatus - -value = PaymentStatus.PENDING -``` - - -## Values - -| Name | Value | -| ------------ | ------------ | -| `PENDING` | Pending | -| `AUTHORIZED` | Authorized | -| `PAID` | Paid | -| `FAILED` | Failed | -| `CANCELLED` | Cancelled | +# PaymentStatus + +## Example Usage + +```python +from codat_lending.models.shared import PaymentStatus + +value = PaymentStatus.PENDING +``` + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PENDING` | Pending | +| `AUTHORIZED` | Authorized | +| `PAID` | Paid | +| `FAILED` | Failed | +| `CANCELLED` | Cancelled | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/paymenttype.md b/lending/docs/models/shared/paymenttype.md index 5b006493d..5d54e3d62 100644 --- a/lending/docs/models/shared/paymenttype.md +++ b/lending/docs/models/shared/paymenttype.md @@ -1,29 +1,27 @@ -# PaymentType - -Type of payment. - -## Example Usage - -```python -from codat_lending.models.shared import PaymentType - -value = PaymentType.CASH -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `CASH` | Cash | -| `CARD` | Card | -| `INVOICE` | Invoice | -| `ONLINE_CARD` | OnlineCard | -| `SWISH` | Swish | -| `VIPPS` | Vipps | -| `MOBILE` | Mobile | -| `STORE_CREDIT` | StoreCredit | -| `PAYPAL` | Paypal | -| `CUSTOM` | Custom | -| `PREPAID` | Prepaid | +# PaymentType + +## Example Usage + +```python +from codat_lending.models.shared import PaymentType + +value = PaymentType.CASH +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `CASH` | Cash | +| `CARD` | Card | +| `INVOICE` | Invoice | +| `ONLINE_CARD` | OnlineCard | +| `SWISH` | Swish | +| `VIPPS` | Vipps | +| `MOBILE` | Mobile | +| `STORE_CREDIT` | StoreCredit | +| `PAYPAL` | Paypal | +| `CUSTOM` | Custom | +| `PREPAID` | Prepaid | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/periodunit.md b/lending/docs/models/shared/periodunit.md index 592ba0e48..ce569012e 100644 --- a/lending/docs/models/shared/periodunit.md +++ b/lending/docs/models/shared/periodunit.md @@ -1,19 +1,19 @@ -# PeriodUnit - -## Example Usage - -```python -from codat_lending.models.shared import PeriodUnit - -value = PeriodUnit.DAY -``` - - -## Values - -| Name | Value | -| ------- | ------- | -| `DAY` | Day | -| `WEEK` | Week | -| `MONTH` | Month | +# PeriodUnit + +## Example Usage + +```python +from codat_lending.models.shared import PeriodUnit + +value = PeriodUnit.DAY +``` + + +## Values + +| Name | Value | +| ------- | ------- | +| `DAY` | Day | +| `WEEK` | Week | +| `MONTH` | Month | | `YEAR` | Year | \ No newline at end of file diff --git a/lending/docs/models/shared/phonenumber.md b/lending/docs/models/shared/phonenumber.md index 09a89aefa..8680042f3 100644 --- a/lending/docs/models/shared/phonenumber.md +++ b/lending/docs/models/shared/phonenumber.md @@ -1,9 +1,9 @@ -# PhoneNumber - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `number` | *OptionalNullable[str]* | :heavy_minus_sign: | A phone number. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | +# PhoneNumber + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `number` | *OptionalNullable[str]* | :heavy_minus_sign: | A phone number. | **Example 1:** +44 25691 154789
**Example 2:** (877) 492-8687
**Example 3:** 01224 658 999 | | `type` | [shared.PhoneNumberType](../../models/shared/phonenumbertype.md) | :heavy_check_mark: | The type of phone number | | \ No newline at end of file diff --git a/lending/docs/models/shared/phonenumbertype.md b/lending/docs/models/shared/phonenumbertype.md index a31fbf49d..de4f7b40c 100644 --- a/lending/docs/models/shared/phonenumbertype.md +++ b/lending/docs/models/shared/phonenumbertype.md @@ -1,22 +1,22 @@ -# PhoneNumberType - -The type of phone number - -## Example Usage - -```python -from codat_lending.models.shared import PhoneNumberType - -value = PhoneNumberType.PRIMARY -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `PRIMARY` | Primary | -| `LANDLINE` | Landline | -| `MOBILE` | Mobile | -| `FAX` | Fax | +# PhoneNumberType + +The type of phone number + +## Example Usage + +```python +from codat_lending.models.shared import PhoneNumberType + +value = PhoneNumberType.PRIMARY +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `PRIMARY` | Primary | +| `LANDLINE` | Landline | +| `MOBILE` | Mobile | +| `FAX` | Fax | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/productinventory.md b/lending/docs/models/shared/productinventory.md index 92d1b17df..57b23ad40 100644 --- a/lending/docs/models/shared/productinventory.md +++ b/lending/docs/models/shared/productinventory.md @@ -1,11 +1,11 @@ -# ProductInventory - -Information about the total inventory as well as the locations inventory is in. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `locations` | List[[shared.ProductInventoryLocation](../../models/shared/productinventorylocation.md)] | :heavy_minus_sign: | N/A | +# ProductInventory + +Information about the total inventory as well as the locations inventory is in. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `locations` | List[[shared.ProductInventoryLocation](../../models/shared/productinventorylocation.md)] | :heavy_minus_sign: | N/A | | `total_quantity` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | The total quantity of stock remaining across locations. | \ No newline at end of file diff --git a/lending/docs/models/shared/productinventorylocation.md b/lending/docs/models/shared/productinventorylocation.md index 64389948a..eeb5efdd0 100644 --- a/lending/docs/models/shared/productinventorylocation.md +++ b/lending/docs/models/shared/productinventorylocation.md @@ -1,9 +1,9 @@ -# ProductInventoryLocation - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `location_ref` | [Optional[shared.LocationRef]](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | +# ProductInventoryLocation + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `location_ref` | [Optional[shared.LocationRef]](../../models/shared/locationref.md) | :heavy_minus_sign: | Reference to the geographic location where the order was placed. | | `quantity` | *Optional[Decimal]* | :heavy_minus_sign: | The quantity of stock remaining at location. | \ No newline at end of file diff --git a/lending/docs/models/shared/productprice.md b/lending/docs/models/shared/productprice.md index 59affbe89..017336636 100644 --- a/lending/docs/models/shared/productprice.md +++ b/lending/docs/models/shared/productprice.md @@ -1,9 +1,9 @@ -# ProductPrice - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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 | -| `unit_price` | *Optional[Decimal]* | :heavy_minus_sign: | The product variant's unit price. | | \ No newline at end of file +# ProductPrice + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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. | +| `unit_price` | *Optional[Decimal]* | :heavy_minus_sign: | The product variant's unit price. | \ No newline at end of file diff --git a/lending/docs/models/shared/productref.md b/lending/docs/models/shared/productref.md index 57aa2ee2e..398f77062 100644 --- a/lending/docs/models/shared/productref.md +++ b/lending/docs/models/shared/productref.md @@ -1,11 +1,9 @@ -# ProductRef - -Reference that links the line item to the correct product details. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the product being referenced. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product being referenced. | | \ No newline at end of file +# ProductRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the product being referenced. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/productvariant.md b/lending/docs/models/shared/productvariant.md index f1bb5d985..f8ab903ed 100644 --- a/lending/docs/models/shared/productvariant.md +++ b/lending/docs/models/shared/productvariant.md @@ -1,24 +1,21 @@ -# ProductVariant - -Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors. - - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `barcode` | *Optional[str]* | :heavy_minus_sign: | Unique product number of the variant. This might be a barcode, UPC, ISBN, etc. | **Example 1:** 564158468416486458646886484
**Example 2:** CSE370 | -| `created_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: | A unique, persistent identifier for this record | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `inventory` | [Optional[shared.ProductInventory]](../../models/shared/productinventory.md) | :heavy_minus_sign: | Information about the total inventory as well as the locations inventory is in. | | -| `is_tax_enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether sales taxes are enabled for this product variant. | | -| `modified_date` | *Optional[str]* | :heavy_minus_sign: | N/A | **Example 1:** 2022-10-23T00:00:00Z
**Example 2:** 2022-10-23 | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product recorded in the commerce or point of sale platform. | **Example 1:** Red Coat
**Example 2:** Black Coat
**Example 3:** Large Brown Hat | -| `prices` | List[[shared.ProductPrice](../../models/shared/productprice.md)] | :heavy_minus_sign: | Prices for the product variants in different currencies. | | -| `shipping_required` | *Optional[bool]* | :heavy_minus_sign: | Indicates whether or not the product requires physical delivery. | | -| `sku` | *Optional[str]* | :heavy_minus_sign: | SKU (stock keeping unit) of the variant, as defined by the merchant. | **Example 1:** Coat-Red-Lrg
**Example 2:** Coat-Black-Md
**Example 3:** LargeBrownHat
**Example 4:** A725BA2 | -| `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.ProductVariantStatus]](../../models/shared/productvariantstatus.md) | :heavy_minus_sign: | The status of the product variant. | | -| `unit_of_measure` | *Optional[str]* | :heavy_minus_sign: | Unit of measure for the variant, such as `kg` or `meters`. | **Example 1:** kg
**Example 2:** m
**Example 3:** meters | -| `vat_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | VAT rate for the product variant if sales taxes are enabled. | **Example 1:** 12.5
**Example 2:** 0
**Example 3:** 20 | \ No newline at end of file +# ProductVariant + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `barcode` | *Optional[str]* | :heavy_minus_sign: | Unique product number of the variant. This might be a barcode, UPC, ISBN, etc. | +| `created_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: | A unique, persistent identifier for this record | +| `inventory` | [Optional[shared.ProductInventory]](../../models/shared/productinventory.md) | :heavy_minus_sign: | N/A | +| `is_tax_enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether sales taxes are enabled for this product variant. | +| `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. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product recorded in the commerce or point of sale platform. | +| `prices` | List[[shared.ProductPrice](../../models/shared/productprice.md)] | :heavy_minus_sign: | Prices for the product variants in different currencies. | +| `shipping_required` | *Optional[bool]* | :heavy_minus_sign: | Indicates whether or not the product requires physical delivery. | +| `sku` | *Optional[str]* | :heavy_minus_sign: | SKU (stock keeping unit) of the variant, as defined by the merchant. | +| `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.ProductVariantStatus]](../../models/shared/productvariantstatus.md) | :heavy_minus_sign: | N/A | +| `unit_of_measure` | *Optional[str]* | :heavy_minus_sign: | Unit of measure for the variant, such as `kg` or `meters`. | +| `vat_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | VAT rate for the product variant if sales taxes are enabled. | \ No newline at end of file diff --git a/lending/docs/models/shared/productvariantref.md b/lending/docs/models/shared/productvariantref.md index 610ed755d..d2b6e6da9 100644 --- a/lending/docs/models/shared/productvariantref.md +++ b/lending/docs/models/shared/productvariantref.md @@ -1,11 +1,9 @@ -# ProductVariantRef - -Reference that links the line item to the specific version of product that has been ordered. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identifier of the product variant being referenced. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product variant being referenced. | | \ No newline at end of file +# ProductVariantRef + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier of the product variant being referenced. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the product variant being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/productvariantstatus.md b/lending/docs/models/shared/productvariantstatus.md index 431fe88a3..24586fd1c 100644 --- a/lending/docs/models/shared/productvariantstatus.md +++ b/lending/docs/models/shared/productvariantstatus.md @@ -1,20 +1,18 @@ -# ProductVariantStatus - -The status of the product variant. - -## Example Usage - -```python -from codat_lending.models.shared import ProductVariantStatus - -value = ProductVariantStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `UNKNOWN` | Unknown | -| `PUBLISHED` | Published | +# ProductVariantStatus + +## Example Usage + +```python +from codat_lending.models.shared import ProductVariantStatus + +value = ProductVariantStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `UNKNOWN` | Unknown | +| `PUBLISHED` | Published | | `UNPUBLISHED` | Unpublished | \ No newline at end of file diff --git a/lending/docs/models/shared/profitandlossreport.md b/lending/docs/models/shared/profitandlossreport.md index 2dd29e786..369808369 100644 --- a/lending/docs/models/shared/profitandlossreport.md +++ b/lending/docs/models/shared/profitandlossreport.md @@ -1,18 +1,19 @@ -# ProfitAndLossReport - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `cost_of_sales` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `expenses` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `from_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 | -| `gross_profit` | *Decimal* | :heavy_check_mark: | Gross profit of the company in the given date range. | | -| `income` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `net_operating_profit` | *Decimal* | :heavy_check_mark: | Net operating profit of the company in the given date range. | | -| `net_other_income` | *Decimal* | :heavy_check_mark: | Net other income of the company in the given date range. | | -| `net_profit` | *Decimal* | :heavy_check_mark: | Net profit of the company in the given date range. | | -| `other_expenses` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `other_income` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | N/A | | -| `to_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 | \ No newline at end of file +# ProfitAndLossReport + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `cost_of_sales` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLine items for cost of sales in the given date range. | +| `expenses` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLine items for expenses in the given date range. | +| `from_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. | +| `gross_profit` | *Decimal* | :heavy_check_mark: | Gross profit of the company in the given date range. | +| `income` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLine items for income in the given date range. | +| `net_operating_profit` | *Decimal* | :heavy_check_mark: | Net operating profit of the company in the given date range. | +| `net_other_income` | *Decimal* | :heavy_check_mark: | Net other income of the company in the given date range. | +| `net_profit` | *Decimal* | :heavy_check_mark: | Net profit of the company in the given date range. | +| `other_expenses` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLine items for other expenses in the given date range. | +| `other_income` | [Optional[shared.ReportLine]](../../models/shared/reportline.md) | :heavy_minus_sign: | ReportLine items for other income in the given date range. | +| `to_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. | \ No newline at end of file diff --git a/lending/docs/models/shared/projectref.md b/lending/docs/models/shared/projectref.md index d7547d248..311e2662b 100644 --- a/lending/docs/models/shared/projectref.md +++ b/lending/docs/models/shared/projectref.md @@ -1,9 +1,9 @@ -# ProjectRef - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier to the project reference. | +# ProjectRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier to the project reference. | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The project's name. | \ No newline at end of file diff --git a/lending/docs/models/shared/propertieaccounttype.md b/lending/docs/models/shared/propertieaccounttype.md index e64fc1148..303f6bd81 100644 --- a/lending/docs/models/shared/propertieaccounttype.md +++ b/lending/docs/models/shared/propertieaccounttype.md @@ -1,22 +1,22 @@ -# PropertieAccountType - -The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. - -## Example Usage - -```python -from codat_lending.models.shared import PropertieAccountType - -value = PropertieAccountType.CHECKING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `CHECKING` | checking | -| `SAVINGS` | savings | -| `LOAN` | loan | -| `CREDIT_CARD` | creditCard | +# PropertieAccountType + +The type of bank account e.g. checking, savings, loan, creditCard, prepaidCard. + +## Example Usage + +```python +from codat_lending.models.shared import PropertieAccountType + +value = PropertieAccountType.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/lending/docs/models/shared/propertieitemref.md b/lending/docs/models/shared/propertieitemref.md deleted file mode 100644 index c07c99323..000000000 --- a/lending/docs/models/shared/propertieitemref.md +++ /dev/null @@ -1,11 +0,0 @@ -# PropertieItemRef - -Reference to the item the line is linked to. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier for the item in the accounting software. | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the item in the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/pulloperation.md b/lending/docs/models/shared/pulloperation.md index bea7bb1d5..4f38463eb 100644 --- a/lending/docs/models/shared/pulloperation.md +++ b/lending/docs/models/shared/pulloperation.md @@ -1,22 +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` | *OptionalNullable[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. | | +# 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` | *OptionalNullable[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` | *OptionalNullable[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/lending/docs/models/shared/pulloperations.md b/lending/docs/models/shared/pulloperations.md index a5761e0aa..1c994a999 100644 --- a/lending/docs/models/shared/pulloperations.md +++ b/lending/docs/models/shared/pulloperations.md @@ -1,12 +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 | | +# 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/lending/docs/models/shared/purchaseorderreference.md b/lending/docs/models/shared/purchaseorderreference.md index 6b00e0a49..7659370bb 100644 --- a/lending/docs/models/shared/purchaseorderreference.md +++ b/lending/docs/models/shared/purchaseorderreference.md @@ -1,9 +1,10 @@ -# PurchaseOrderReference - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the purchase order, unique for the company in the accounting software. | +# PurchaseOrderReference + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `id` | *Optional[str]* | :heavy_minus_sign: | Identifier for the purchase order, unique for the company in the accounting software. | | `purchase_order_number` | *OptionalNullable[str]* | :heavy_minus_sign: | Friendly reference for the purchase order, commonly generated by the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/pushchangetype.md b/lending/docs/models/shared/pushchangetype.md index 81d0d783f..e7c3df56e 100644 --- a/lending/docs/models/shared/pushchangetype.md +++ b/lending/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_lending.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_lending.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/lending/docs/models/shared/pushfieldvalidation.md b/lending/docs/models/shared/pushfieldvalidation.md index d3558cfad..b10ead92d 100644 --- a/lending/docs/models/shared/pushfieldvalidation.md +++ b/lending/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/lending/docs/models/shared/pushoperation.md b/lending/docs/models/shared/pushoperation.md index d01e17840..415430ac6 100644 --- a/lending/docs/models/shared/pushoperation.md +++ b/lending/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/lending/docs/models/shared/pushoperationchange.md b/lending/docs/models/shared/pushoperationchange.md index d5516b5c7..ef8fa0986 100644 --- a/lending/docs/models/shared/pushoperationchange.md +++ b/lending/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/lending/docs/models/shared/pushoperationref.md b/lending/docs/models/shared/pushoperationref.md index 7c26e1c4f..f7efa342a 100644 --- a/lending/docs/models/shared/pushoperationref.md +++ b/lending/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: | Available data types | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for a push operation. | \ No newline at end of file diff --git a/lending/docs/models/shared/pushoperations.md b/lending/docs/models/shared/pushoperations.md index 6a06b9c2b..776ac813c 100644 --- a/lending/docs/models/shared/pushoperations.md +++ b/lending/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/lending/docs/models/shared/pushoperationstatus.md b/lending/docs/models/shared/pushoperationstatus.md index 63a4ac785..b6b0c6e90 100644 --- a/lending/docs/models/shared/pushoperationstatus.md +++ b/lending/docs/models/shared/pushoperationstatus.md @@ -1,21 +1,21 @@ -# PushOperationStatus - -The current status of the push operation. - -## Example Usage - -```python -from codat_lending.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_lending.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/lending/docs/models/shared/pushoption.md b/lending/docs/models/shared/pushoption.md index e908d0b28..9bff99cd3 100644 --- a/lending/docs/models/shared/pushoption.md +++ b/lending/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/lending/docs/models/shared/pushoptionchoice.md b/lending/docs/models/shared/pushoptionchoice.md index 44e988b26..8c993a020 100644 --- a/lending/docs/models/shared/pushoptionchoice.md +++ b/lending/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/lending/docs/models/shared/pushoptionproperty.md b/lending/docs/models/shared/pushoptionproperty.md index 2bedd19d3..02801135b 100644 --- a/lending/docs/models/shared/pushoptionproperty.md +++ b/lending/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/lending/docs/models/shared/pushoptiontype.md b/lending/docs/models/shared/pushoptiontype.md index 7ac2caf0e..5b024a52c 100644 --- a/lending/docs/models/shared/pushoptiontype.md +++ b/lending/docs/models/shared/pushoptiontype.md @@ -1,25 +1,23 @@ -# PushOptionType - -The option type. - -## Example Usage - -```python -from codat_lending.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_lending.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/lending/docs/models/shared/pushvalidationinfo.md b/lending/docs/models/shared/pushvalidationinfo.md index 110eb3f76..ad9013935 100644 --- a/lending/docs/models/shared/pushvalidationinfo.md +++ b/lending/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/lending/docs/models/shared/recordlinereference.md b/lending/docs/models/shared/recordlinereference.md index 17e83d195..78912f4b2 100644 --- a/lending/docs/models/shared/recordlinereference.md +++ b/lending/docs/models/shared/recordlinereference.md @@ -1,12 +1,14 @@ -# RecordLineReference - -Reference to the purchase order line this line was generated from. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `data_type` | [Optional[shared.BillLineItemDataType]](../../models/shared/billlineitemdatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record. | +# RecordLineReference + +Links the current record line to the underlying record line that created it. + +For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `data_type` | [Optional[shared.BillLineItemDataType]](../../models/shared/billlineitemdatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record. | | `line_number` | *Optional[str]* | :heavy_minus_sign: | Line number of the underlying record. | \ No newline at end of file diff --git a/lending/docs/models/shared/recordlinereferencedatatype.md b/lending/docs/models/shared/recordlinereferencedatatype.md new file mode 100644 index 000000000..01c8b7c6e --- /dev/null +++ b/lending/docs/models/shared/recordlinereferencedatatype.md @@ -0,0 +1,17 @@ +# RecordLineReferenceDataType + +## Example Usage + +```python +from codat_lending.models.shared import RecordLineReferenceDataType + +value = RecordLineReferenceDataType.PURCHASE_ORDERS +``` + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `PURCHASE_ORDERS` | purchaseOrders | +| `BILLS` | bills | \ No newline at end of file diff --git a/lending/docs/models/shared/reportbasis.md b/lending/docs/models/shared/reportbasis.md index d560fc398..05f77bd78 100644 --- a/lending/docs/models/shared/reportbasis.md +++ b/lending/docs/models/shared/reportbasis.md @@ -1,20 +1,20 @@ -# ReportBasis - -Accounting method used when aggregating the report data. In this case, `Cash`. - -## Example Usage - -```python -from codat_lending.models.shared import ReportBasis - -value = ReportBasis.UNKNOWN -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `UNKNOWN` | Unknown | -| `ACCRUAL` | Accrual | +# ReportBasis + +Accounting method used when aggregating the report data. In this case, `Cash`. + +## Example Usage + +```python +from codat_lending.models.shared import ReportBasis + +value = ReportBasis.UNKNOWN +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `UNKNOWN` | Unknown | +| `ACCRUAL` | Accrual | | `CASH` | Cash | \ No newline at end of file diff --git a/lending/docs/models/shared/reportcomponentmeasure.md b/lending/docs/models/shared/reportcomponentmeasure.md index 327497d75..3d7dd3a64 100644 --- a/lending/docs/models/shared/reportcomponentmeasure.md +++ b/lending/docs/models/shared/reportcomponentmeasure.md @@ -1,10 +1,10 @@ -# ReportComponentMeasure - - -## Fields - -| Field | Type | Required | Description | -| --------------------------- | --------------------------- | --------------------------- | --------------------------- | -| `index` | *Optional[int]* | :heavy_minus_sign: | The measure's index. | -| `measure_display_name` | *Optional[str]* | :heavy_minus_sign: | The measure's display name. | +# ReportComponentMeasure + + +## Fields + +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `index` | *Optional[int]* | :heavy_minus_sign: | The measure's index. | +| `measure_display_name` | *Optional[str]* | :heavy_minus_sign: | The measure's display name. | | `value` | *Optional[Decimal]* | :heavy_minus_sign: | The measure's value. | \ No newline at end of file diff --git a/lending/docs/models/shared/reportgenerationpayload.md b/lending/docs/models/shared/reportgenerationpayload.md index f4cadc474..0dcec2b7b 100644 --- a/lending/docs/models/shared/reportgenerationpayload.md +++ b/lending/docs/models/shared/reportgenerationpayload.md @@ -1,9 +1,9 @@ -# ReportGenerationPayload - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the report. | a78e2625-7190-4d94-ae3b-071320451026 | -| `reference_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +# ReportGenerationPayload + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `reference_company` | [Optional[shared.CompanyReference]](../../models/shared/companyreference.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/reportinfo.md b/lending/docs/models/shared/reportinfo.md index a1de26d2e..da341820f 100644 --- a/lending/docs/models/shared/reportinfo.md +++ b/lending/docs/models/shared/reportinfo.md @@ -1,15 +1,13 @@ -# ReportInfo - -Report additional information, which is specific to Lending reports. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `company_name` | *Optional[str]* | :heavy_minus_sign: | The name of the company being queried. | -| `generated_date` | *Optional[str]* | :heavy_minus_sign: | Date the report was generated. | -| `page_number` | *Optional[int]* | :heavy_minus_sign: | The number of the page queried. | -| `page_size` | *Optional[int]* | :heavy_minus_sign: | The number of transactions returned per page. | -| `report_name` | *Optional[str]* | :heavy_minus_sign: | Name of the report. | +# ReportInfo + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `company_name` | *Optional[str]* | :heavy_minus_sign: | The name of the company being queried. | +| `generated_date` | *Optional[str]* | :heavy_minus_sign: | Date the report was generated. | +| `page_number` | *Optional[int]* | :heavy_minus_sign: | The number of the page queried. | +| `page_size` | *Optional[int]* | :heavy_minus_sign: | The number of transactions returned per page. | +| `report_name` | *Optional[str]* | :heavy_minus_sign: | Name of the report. | | `total_results` | *Optional[int]* | :heavy_minus_sign: | The total number of transactions available for a company for the period specified in the query string. | \ No newline at end of file diff --git a/lending/docs/models/shared/reportinput.md b/lending/docs/models/shared/reportinput.md index c5ad47bfe..4e1bea1f9 100644 --- a/lending/docs/models/shared/reportinput.md +++ b/lending/docs/models/shared/reportinput.md @@ -1,20 +1,18 @@ -# ReportInput - -Accounting method used to prepare the cash flow statement. - -## Example Usage - -```python -from codat_lending.models.shared import ReportInput - -value = ReportInput.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `INDIRECT` | Indirect | +# ReportInput + +## Example Usage + +```python +from codat_lending.models.shared import ReportInput + +value = ReportInput.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `INDIRECT` | Indirect | | `DIRECT` | Direct | \ No newline at end of file diff --git a/lending/docs/models/shared/reportitem.md b/lending/docs/models/shared/reportitem.md index 4c2697180..91302097f 100644 --- a/lending/docs/models/shared/reportitem.md +++ b/lending/docs/models/shared/reportitem.md @@ -1,12 +1,12 @@ -# ReportItem - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_category` | [Optional[shared.EnhancedReportAccountCategory]](../../models/shared/enhancedreportaccountcategory.md) | :heavy_minus_sign: | N/A | | -| `account_id` | *Optional[str]* | :heavy_minus_sign: | The unique account ID. | | -| `account_name` | *Optional[str]* | :heavy_minus_sign: | Name of the account. | | -| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | Balance of the account as reported on the profit and loss or Balance sheet. | | +# ReportItem + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_category` | [Optional[shared.EnhancedReportAccountCategory]](../../models/shared/enhancedreportaccountcategory.md) | :heavy_minus_sign: | N/A | | +| `account_id` | *Optional[str]* | :heavy_minus_sign: | The unique account ID. | | +| `account_name` | *Optional[str]* | :heavy_minus_sign: | Name of the account. | | +| `balance` | *Optional[Decimal]* | :heavy_minus_sign: | Balance of the account as reported on the profit and loss or Balance sheet. | | | `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 | \ No newline at end of file diff --git a/lending/docs/models/shared/reportitems.md b/lending/docs/models/shared/reportitems.md index fb4872d16..5cfa59c13 100644 --- a/lending/docs/models/shared/reportitems.md +++ b/lending/docs/models/shared/reportitems.md @@ -1,13 +1,13 @@ -# ReportItems - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The loan transaction amount. | | -| `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 | -| `item_ref` | [Optional[shared.ItemRef]](../../models/shared/itemref.md) | :heavy_minus_sign: | N/A | | -| `lender` | *Optional[str]* | :heavy_minus_sign: | The name of lender providing the loan. | | -| `loan_ref` | [Optional[shared.LoanRef]](../../models/shared/loanref.md) | :heavy_minus_sign: | N/A | | -| `loan_transaction_type` | [Optional[shared.LoanTransactionType]](../../models/shared/loantransactiontype.md) | :heavy_minus_sign: | The type of loan transaction. | | \ No newline at end of file +# ReportItems + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The loan transaction amount. | +| `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. | +| `item_ref` | [Optional[shared.ItemRef]](../../models/shared/itemref.md) | :heavy_minus_sign: | Contains object of reporting properties. The loan ref will reference a different object depending on the integration type. | +| `lender` | *Optional[str]* | :heavy_minus_sign: | The name of lender providing the loan. | +| `loan_ref` | [Optional[shared.LoanRef]](../../models/shared/loanref.md) | :heavy_minus_sign: | Contains object that contains all the Loan transactions for that integration type. | +| `loan_transaction_type` | [Optional[shared.LoanTransactionType]](../../models/shared/loantransactiontype.md) | :heavy_minus_sign: | The type of loan transaction. | \ No newline at end of file diff --git a/lending/docs/models/shared/reportline.md b/lending/docs/models/shared/reportline.md index cec356977..5a0ef8765 100644 --- a/lending/docs/models/shared/reportline.md +++ b/lending/docs/models/shared/reportline.md @@ -1,11 +1,11 @@ -# ReportLine - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | -| `items` | List[[shared.ReportLine](../../models/shared/reportline.md)] | :heavy_minus_sign: | An array of ReportLine items. | -| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the report line item. | +# ReportLine + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `account_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | +| `items` | List[[shared.ReportLine](../../models/shared/reportline.md)] | :heavy_minus_sign: | An array of ReportLine items. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of the report line item. | | `value` | *Decimal* | :heavy_check_mark: | Numerical value of the line item. | \ No newline at end of file diff --git a/lending/docs/models/shared/reportoperation.md b/lending/docs/models/shared/reportoperation.md index fcf5669d9..f1362bff0 100644 --- a/lending/docs/models/shared/reportoperation.md +++ b/lending/docs/models/shared/reportoperation.md @@ -1,15 +1,15 @@ -# ReportOperation - -Information about report generation. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A short message describing any errors that occurred while generating the report. | | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the report | 52c0f26b-051a-43ff-b02a-258eec67f5ef | -| `requested_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 | -| `status` | [Optional[shared.ReportOperationStatus]](../../models/shared/reportoperationstatus.md) | :heavy_minus_sign: | The status of the report generation. | | -| `type` | [Optional[shared.ReportOperationType]](../../models/shared/reportoperationtype.md) | :heavy_minus_sign: | The name of the generated report. | | +# ReportOperation + +Information about report generation. + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `error_message` | *OptionalNullable[str]* | :heavy_minus_sign: | A short message describing any errors that occurred while generating the report. | | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier of the report | 52c0f26b-051a-43ff-b02a-258eec67f5ef | +| `requested_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 | +| `status` | [Optional[shared.ReportOperationStatus]](../../models/shared/reportoperationstatus.md) | :heavy_minus_sign: | The status of the report generation. | | +| `type` | [Optional[shared.ReportOperationType]](../../models/shared/reportoperationtype.md) | :heavy_minus_sign: | The name of the generated report. | | | `updated_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 | \ No newline at end of file diff --git a/lending/docs/models/shared/reportoperationstatus.md b/lending/docs/models/shared/reportoperationstatus.md index 3645351b3..b1a966807 100644 --- a/lending/docs/models/shared/reportoperationstatus.md +++ b/lending/docs/models/shared/reportoperationstatus.md @@ -1,20 +1,18 @@ -# ReportOperationStatus - -The status of the report generation. - -## Example Usage - -```python -from codat_lending.models.shared import ReportOperationStatus - -value = ReportOperationStatus.IN_PROGRESS -``` - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `IN_PROGRESS` | InProgress | -| `COMPLETE` | Complete | +# ReportOperationStatus + +## Example Usage + +```python +from codat_lending.models.shared import ReportOperationStatus + +value = ReportOperationStatus.IN_PROGRESS +``` + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `IN_PROGRESS` | InProgress | +| `COMPLETE` | Complete | | `ERROR` | Error | \ No newline at end of file diff --git a/lending/docs/models/shared/reportoperationtype.md b/lending/docs/models/shared/reportoperationtype.md index 2788f0957..acb4dc236 100644 --- a/lending/docs/models/shared/reportoperationtype.md +++ b/lending/docs/models/shared/reportoperationtype.md @@ -1,20 +1,18 @@ -# ReportOperationType - -The name of the generated report. - -## Example Usage - -```python -from codat_lending.models.shared import ReportOperationType - -value = ReportOperationType.CATEGORIZED_BANK_STATEMENT -``` - - -## Values - -| Name | Value | -| ---------------------------- | ---------------------------- | -| `CATEGORIZED_BANK_STATEMENT` | categorizedBankStatement | -| `CREDIT_MODEL` | creditModel | +# ReportOperationType + +## Example Usage + +```python +from codat_lending.models.shared import ReportOperationType + +value = ReportOperationType.CATEGORIZED_BANK_STATEMENT +``` + + +## Values + +| Name | Value | +| ---------------------------- | ---------------------------- | +| `CATEGORIZED_BANK_STATEMENT` | categorizedBankStatement | +| `CREDIT_MODEL` | creditModel | | `SPEND_ANALYSIS` | spendAnalysis | \ No newline at end of file diff --git a/lending/docs/models/shared/reports.md b/lending/docs/models/shared/reports.md index 848e73f12..79d07eeef 100644 --- a/lending/docs/models/shared/reports.md +++ b/lending/docs/models/shared/reports.md @@ -1,12 +1,12 @@ -# Reports - - -## 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.ReportOperation](../../models/shared/reportoperation.md)] | :heavy_minus_sign: | N/A | | -| `total_results` | *int* | :heavy_check_mark: | Total number of items. | | \ No newline at end of file +# Reports + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `links` | [shared.Links](../../models/shared/links.md) | :heavy_check_mark: | N/A | +| `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.ReportOperation](../../models/shared/reportoperation.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/lending/docs/models/shared/reportsourcereference.md b/lending/docs/models/shared/reportsourcereference.md index 74068bb04..5c81fae12 100644 --- a/lending/docs/models/shared/reportsourcereference.md +++ b/lending/docs/models/shared/reportsourcereference.md @@ -1,10 +1,10 @@ -# ReportSourceReference - -A source reference containing the `sourceType` object "Banking". - - -## Fields - -| Field | Type | Required | Description | -| --------------------- | --------------------- | --------------------- | --------------------- | +# ReportSourceReference + +A source reference containing the `sourceType` object "Banking". + + +## Fields + +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | | `source_type` | *Optional[str]* | :heavy_minus_sign: | The data source type. | \ No newline at end of file diff --git a/lending/docs/models/shared/reporttype.md b/lending/docs/models/shared/reporttype.md index 431ae338d..434a8fe28 100644 --- a/lending/docs/models/shared/reporttype.md +++ b/lending/docs/models/shared/reporttype.md @@ -1,17 +1,17 @@ -# ReportType - -## Example Usage - -```python -from codat_lending.models.shared import ReportType - -value = ReportType.CATEGORIZED_BANK_STATEMENT -``` - - -## Values - -| Name | Value | -| ---------------------------- | ---------------------------- | -| `CATEGORIZED_BANK_STATEMENT` | categorizedBankStatement | +# ReportType + +## Example Usage + +```python +from codat_lending.models.shared import ReportType + +value = ReportType.CATEGORIZED_BANK_STATEMENT +``` + + +## Values + +| Name | Value | +| ---------------------------- | ---------------------------- | +| `CATEGORIZED_BANK_STATEMENT` | categorizedBankStatement | | `CREDIT_MODEL` | creditModel | \ No newline at end of file diff --git a/lending/docs/models/shared/routinginfo.md b/lending/docs/models/shared/routinginfo.md index 284bf18fb..30454e7c2 100644 --- a/lending/docs/models/shared/routinginfo.md +++ b/lending/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/lending/docs/models/shared/salesorderreference.md b/lending/docs/models/shared/salesorderreference.md index a6b2764c4..8be5a568f 100644 --- a/lending/docs/models/shared/salesorderreference.md +++ b/lending/docs/models/shared/salesorderreference.md @@ -1,9 +1,9 @@ -# SalesOrderReference - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `data_type` | [Optional[shared.AccountingInvoiceDataType]](../../models/shared/accountinginvoicedatatype.md) | :heavy_minus_sign: | The underlying data type associated to the reference `id`. | +# SalesOrderReference + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `data_type` | [Optional[shared.AccountingInvoiceDataType]](../../models/shared/accountinginvoicedatatype.md) | :heavy_minus_sign: | The underlying data type associated to the reference `id`. | | `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier to a record in `dataType`. | \ No newline at end of file diff --git a/lending/docs/models/shared/schema.md b/lending/docs/models/shared/schema.md index e35fa909c..376193711 100644 --- a/lending/docs/models/shared/schema.md +++ b/lending/docs/models/shared/schema.md @@ -1,11 +1,11 @@ -# Schema - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** reports.categorizedBankStatement.generate.successful
**Example 2:** reports.creditModel.generate.successful | -| `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.ReportGenerationPayload]](../../models/shared/reportgenerationpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +# Schema + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `generated_date` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `payload` | [Optional[shared.ReportGenerationPayload]](../../models/shared/reportgenerationpayload.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/schemadatatype.md b/lending/docs/models/shared/schemadatatype.md index 511e6376b..b4f86b6bd 100644 --- a/lending/docs/models/shared/schemadatatype.md +++ b/lending/docs/models/shared/schemadatatype.md @@ -1,60 +1,60 @@ -# SchemaDataType - -Available data types - -## Example Usage - -```python -from codat_lending.models.shared import SchemaDataType - -value = SchemaDataType.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 | +# SchemaDataType + +Available data types + +## Example Usage + +```python +from codat_lending.models.shared import SchemaDataType + +value = SchemaDataType.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 diff --git a/lending/docs/models/shared/security.md b/lending/docs/models/shared/security.md index 2b68bd0e7..e7a8e4384 100644 --- a/lending/docs/models/shared/security.md +++ b/lending/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/lending/docs/models/shared/servicecharge.md b/lending/docs/models/shared/servicecharge.md index eca56d603..76c02e61e 100644 --- a/lending/docs/models/shared/servicecharge.md +++ b/lending/docs/models/shared/servicecharge.md @@ -1,14 +1,14 @@ -# ServiceCharge - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `description` | *Optional[str]* | :heavy_minus_sign: | Service charges for this order. | A service charge | -| `quantity` | *Optional[int]* | :heavy_minus_sign: | The number of times the charge is charged. | **Example 1:** 1
**Example 2:** 12
**Example 3:** 45 | -| `tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the service charge that is tax. | **Example 1:** 0
**Example 2:** 12.5
**Example 3:** 45 | -| `tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any tax applied to the service charge. | **Example 1:** 0
**Example 2:** 12.5
**Example 3:** 45 | -| `taxes` | List[[shared.TaxComponentAllocation](../../models/shared/taxcomponentallocation.md)] | :heavy_minus_sign: | Taxes breakdown as applied to service charges. | | -| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the service charge, including tax. | **Example 1:** 0
**Example 2:** 12.5
**Example 3:** 45 | -| `type` | [Optional[shared.ServiceChargeType]](../../models/shared/servicechargetype.md) | :heavy_minus_sign: | The type of the service charge. | Overpayment | \ No newline at end of file +# ServiceCharge + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `description` | *Optional[str]* | :heavy_minus_sign: | Service charges for this order. | +| `quantity` | *Optional[int]* | :heavy_minus_sign: | The number of times the charge is charged. | +| `tax_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Amount of the service charge that is tax. | +| `tax_percentage` | *Optional[Decimal]* | :heavy_minus_sign: | Percentage rate (from 0 to 100) of any tax applied to the service charge. | +| `taxes` | List[[shared.TaxComponentAllocation](../../models/shared/taxcomponentallocation.md)] | :heavy_minus_sign: | Taxes breakdown as applied to service charges. | +| `total_amount` | *Optional[Decimal]* | :heavy_minus_sign: | Total amount of the service charge, including tax. | +| `type` | [Optional[shared.ServiceChargeType]](../../models/shared/servicechargetype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/servicechargetype.md b/lending/docs/models/shared/servicechargetype.md index 20944ddd4..fccda11be 100644 --- a/lending/docs/models/shared/servicechargetype.md +++ b/lending/docs/models/shared/servicechargetype.md @@ -1,21 +1,19 @@ -# ServiceChargeType - -The type of the service charge. - -## Example Usage - -```python -from codat_lending.models.shared import ServiceChargeType - -value = ServiceChargeType.GENERIC -``` - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `GENERIC` | Generic | -| `SHIPPING` | Shipping | -| `OVERPAYMENT` | Overpayment | +# ServiceChargeType + +## Example Usage + +```python +from codat_lending.models.shared import ServiceChargeType + +value = ServiceChargeType.GENERIC +``` + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `GENERIC` | Generic | +| `SHIPPING` | Shipping | +| `OVERPAYMENT` | Overpayment | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/source.md b/lending/docs/models/shared/source.md index fa1247e4b..e94111b3c 100644 --- a/lending/docs/models/shared/source.md +++ b/lending/docs/models/shared/source.md @@ -1,18 +1,16 @@ -# Source - -The source of the banking data that determines its format - -## Example Usage - -```python -from codat_lending.models.shared import Source - -value = Source.CODAT -``` - - -## Values - -| Name | Value | -| ------- | ------- | +# Source + +## Example Usage + +```python +from codat_lending.models.shared import Source + +value = Source.CODAT +``` + + +## Values + +| Name | Value | +| ------- | ------- | | `CODAT` | codat | \ No newline at end of file diff --git a/lending/docs/models/shared/sourceaccount.md b/lending/docs/models/shared/sourceaccount.md index c0d7412ed..73966c520 100644 --- a/lending/docs/models/shared/sourceaccount.md +++ b/lending/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.SourceAccountStatus]](../../models/shared/sourceaccountstatus.md) | :heavy_minus_sign: | Status of the source account. | | \ No newline at end of file diff --git a/lending/docs/models/shared/sourceaccountprototype.md b/lending/docs/models/shared/sourceaccountprototype.md index 8cbd8fa63..e4552c370 100644 --- a/lending/docs/models/shared/sourceaccountprototype.md +++ b/lending/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/lending/docs/models/shared/sourceaccountstatus.md b/lending/docs/models/shared/sourceaccountstatus.md index 939db3bcf..976562f62 100644 --- a/lending/docs/models/shared/sourceaccountstatus.md +++ b/lending/docs/models/shared/sourceaccountstatus.md @@ -1,22 +1,20 @@ -# SourceAccountStatus - -Status of the source account. - -## Example Usage - -```python -from codat_lending.models.shared import SourceAccountStatus - -value = SourceAccountStatus.PENDING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `PENDING` | pending | -| `CONNECTED` | connected | -| `CONNECTING` | connecting | -| `DISCONNECTED` | disconnected | +# SourceAccountStatus + +## Example Usage + +```python +from codat_lending.models.shared import SourceAccountStatus + +value = SourceAccountStatus.PENDING +``` + + +## Values + +| Name | Value | +| -------------- | -------------- | +| `PENDING` | pending | +| `CONNECTED` | connected | +| `CONNECTING` | connecting | +| `DISCONNECTED` | disconnected | | `UNKNOWN` | unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/sourceaccountv2.md b/lending/docs/models/shared/sourceaccountv2.md index bf8b0f1ca..b81132823 100644 --- a/lending/docs/models/shared/sourceaccountv2.md +++ b/lending/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/lending/docs/models/shared/sourceaccountv2accounttype.md b/lending/docs/models/shared/sourceaccountv2accounttype.md index ad0074c23..1713dbac9 100644 --- a/lending/docs/models/shared/sourceaccountv2accounttype.md +++ b/lending/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_lending.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_lending.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/lending/docs/models/shared/sourceaccountv2prototype.md b/lending/docs/models/shared/sourceaccountv2prototype.md index 4f74f1a41..fb0127dd3 100644 --- a/lending/docs/models/shared/sourceaccountv2prototype.md +++ b/lending/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.PropertieAccountType](../../models/shared/propertieaccounttype.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.PropertieAccountType](../../models/shared/propertieaccounttype.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/lending/docs/models/shared/sourceaccountv2status.md b/lending/docs/models/shared/sourceaccountv2status.md index 39f9c0ff5..655c69986 100644 --- a/lending/docs/models/shared/sourceaccountv2status.md +++ b/lending/docs/models/shared/sourceaccountv2status.md @@ -1,22 +1,20 @@ -# SourceAccountV2Status - -Status of the source account. - -## Example Usage - -```python -from codat_lending.models.shared import SourceAccountV2Status - -value = SourceAccountV2Status.PENDING -``` - - -## Values - -| Name | Value | -| -------------- | -------------- | -| `PENDING` | pending | -| `CONNECTED` | connected | -| `CONNECTING` | connecting | -| `DISCONNECTED` | disconnected | +# SourceAccountV2Status + +## Example Usage + +```python +from codat_lending.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/lending/docs/models/shared/sourceaccountv2type.md b/lending/docs/models/shared/sourceaccountv2type.md new file mode 100644 index 000000000..86086763a --- /dev/null +++ b/lending/docs/models/shared/sourceaccountv2type.md @@ -0,0 +1,28 @@ +# SourceAccountV2Type + +## Example Usage + +```python +from codat_lending.models.shared import SourceAccountV2Type + +value = SourceAccountV2Type.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/lending/docs/models/shared/sourceref.md b/lending/docs/models/shared/sourceref.md index c5af2a430..6ec4b66c1 100644 --- a/lending/docs/models/shared/sourceref.md +++ b/lending/docs/models/shared/sourceref.md @@ -1,10 +1,8 @@ -# SourceRef - -A source reference containing the `sourceType` object "Banking". - - -## Fields - -| Field | Type | Required | Description | -| --------------------- | --------------------- | --------------------- | --------------------- | +# SourceRef + + +## Fields + +| Field | Type | Required | Description | +| --------------------- | --------------------- | --------------------- | --------------------- | | `source_type` | *Optional[str]* | :heavy_minus_sign: | The data source type. | \ No newline at end of file diff --git a/lending/docs/models/shared/sourcetype.md b/lending/docs/models/shared/sourcetype.md index 778c4dfc5..0cc840ef1 100644 --- a/lending/docs/models/shared/sourcetype.md +++ b/lending/docs/models/shared/sourcetype.md @@ -1,24 +1,24 @@ -# SourceType - -The type of platform of the connection. - -## Example Usage - -```python -from codat_lending.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_lending.models.operations 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/lending/docs/models/shared/startuploadsessionrequest.md b/lending/docs/models/shared/startuploadsessionrequest.md index b40fa8c73..513e36d81 100644 --- a/lending/docs/models/shared/startuploadsessionrequest.md +++ b/lending/docs/models/shared/startuploadsessionrequest.md @@ -1,8 +1,8 @@ -# StartUploadSessionRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +# StartUploadSessionRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | | `data_type` | [Optional[shared.StartUploadSessionRequestDataType]](../../models/shared/startuploadsessionrequestdatatype.md) | :heavy_minus_sign: | A key for a Codat data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/startuploadsessionrequestdatatype.md b/lending/docs/models/shared/startuploadsessionrequestdatatype.md index a6f547fef..48dcfafdb 100644 --- a/lending/docs/models/shared/startuploadsessionrequestdatatype.md +++ b/lending/docs/models/shared/startuploadsessionrequestdatatype.md @@ -1,19 +1,17 @@ -# StartUploadSessionRequestDataType - -A key for a Codat data type. - -## Example Usage - -```python -from codat_lending.models.shared import StartUploadSessionRequestDataType - -value = StartUploadSessionRequestDataType.BANKING_ACCOUNTS -``` - - -## Values - -| Name | Value | -| ---------------------- | ---------------------- | -| `BANKING_ACCOUNTS` | banking-accounts | +# StartUploadSessionRequestDataType + +## Example Usage + +```python +from codat_lending.models.shared import StartUploadSessionRequestDataType + +value = StartUploadSessionRequestDataType.BANKING_ACCOUNTS +``` + + +## Values + +| Name | Value | +| ---------------------- | ---------------------- | +| `BANKING_ACCOUNTS` | banking-accounts | | `BANKING_TRANSACTIONS` | banking-transactions | \ No newline at end of file diff --git a/lending/docs/models/shared/status.md b/lending/docs/models/shared/status.md index 236ca0ca1..c2e3ad9a4 100644 --- a/lending/docs/models/shared/status.md +++ b/lending/docs/models/shared/status.md @@ -1,38 +1,36 @@ -# Status - -The current status of the dataset. - -## Example Usage - -```python -from codat_lending.models.shared import Status - -value = Status.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 | +# Status + +## Example Usage + +```python +from codat_lending.models.shared import Status + +value = Status.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/lending/docs/models/shared/supplementaldata.md b/lending/docs/models/shared/supplementaldata.md index 7415a8519..b0c0c829e 100644 --- a/lending/docs/models/shared/supplementaldata.md +++ b/lending/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/lending/docs/models/shared/supplierref.md b/lending/docs/models/shared/supplierref.md index 9ac54781a..4b61cbf8a 100644 --- a/lending/docs/models/shared/supplierref.md +++ b/lending/docs/models/shared/supplierref.md @@ -1,11 +1,9 @@ -# SupplierRef - -Reference to the supplier the record relates to. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `id` | *str* | :heavy_check_mark: | The supplier's unique ID | +# SupplierRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------ | ------------------------ | ------------------------ | ------------------------ | +| `id` | *str* | :heavy_check_mark: | The supplier's unique ID | | `supplier_name` | *OptionalNullable[str]* | :heavy_minus_sign: | The supplier's name | \ No newline at end of file diff --git a/lending/docs/models/shared/supplierstatus.md b/lending/docs/models/shared/supplierstatus.md index 0e3e1e187..58010ae93 100644 --- a/lending/docs/models/shared/supplierstatus.md +++ b/lending/docs/models/shared/supplierstatus.md @@ -1,20 +1,18 @@ -# SupplierStatus - -Status of the supplier. - -## Example Usage - -```python -from codat_lending.models.shared import SupplierStatus - -value = SupplierStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | +# SupplierStatus + +## Example Usage + +```python +from codat_lending.models.shared import SupplierStatus + +value = SupplierStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | | `ARCHIVED` | Archived | \ No newline at end of file diff --git a/lending/docs/models/shared/targetaccountoption.md b/lending/docs/models/shared/targetaccountoption.md index 651d5c279..00f6d2d26 100644 --- a/lending/docs/models/shared/targetaccountoption.md +++ b/lending/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/lending/docs/models/shared/taxcomponentallocation.md b/lending/docs/models/shared/taxcomponentallocation.md index ef8e8f682..ab2dc386b 100644 --- a/lending/docs/models/shared/taxcomponentallocation.md +++ b/lending/docs/models/shared/taxcomponentallocation.md @@ -1,9 +1,9 @@ -# TaxComponentAllocation - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce software. | +# TaxComponentAllocation + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `rate` | *OptionalNullable[Decimal]* | :heavy_minus_sign: | Tax amount on order line sale as available from source commerce software. | | `tax_component_ref` | [Optional[shared.TaxComponentRef]](../../models/shared/taxcomponentref.md) | :heavy_minus_sign: | Taxes rates reference object depending on the rates being available on source commerce software. | \ No newline at end of file diff --git a/lending/docs/models/shared/taxcomponentref.md b/lending/docs/models/shared/taxcomponentref.md index 74a826c74..cb28d3d9b 100644 --- a/lending/docs/models/shared/taxcomponentref.md +++ b/lending/docs/models/shared/taxcomponentref.md @@ -1,11 +1,9 @@ -# TaxComponentRef - -Taxes rates reference object depending on the rates being available on source commerce software. - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identitifer of the tax component being referenced. | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `name` | *str* | :heavy_check_mark: | Name of the tax component being referenced. | | \ No newline at end of file +# TaxComponentRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identitifer of the tax component being referenced. | +| `name` | *str* | :heavy_check_mark: | Name of the tax component being referenced. | \ No newline at end of file diff --git a/lending/docs/models/shared/taxrateref.md b/lending/docs/models/shared/taxrateref.md index eb85c3b40..4a3d80e57 100644 --- a/lending/docs/models/shared/taxrateref.md +++ b/lending/docs/models/shared/taxrateref.md @@ -1,21 +1,10 @@ -# TaxRateRef - -Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - -Found on: - -- Bill line items -- Bill Credit Note line items -- Credit Note line items -- Direct incomes line items -- Invoice line items -- Items - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `effective_tax_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Applicable tax rate. | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | +# TaxRateRef + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `effective_tax_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Applicable tax rate. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | | `name` | *Optional[str]* | :heavy_minus_sign: | Name of the tax rate in the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/taxratereference.md b/lending/docs/models/shared/taxratereference.md index a7130b2ef..db388baa2 100644 --- a/lending/docs/models/shared/taxratereference.md +++ b/lending/docs/models/shared/taxratereference.md @@ -1,21 +1,21 @@ -# TaxRateReference - -Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - -Found on: - -- Bill line items -- Bill Credit Note line items -- Credit Note line items -- Direct incomes line items -- Invoice line items -- Items - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `effective_tax_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Applicable tax rate. | -| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | +# TaxRateReference + +Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. + +Found on: + +- Bill line items +- Bill Credit Note line items +- Credit Note line items +- Direct incomes line items +- Invoice line items +- Items + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `effective_tax_rate` | *Optional[Decimal]* | :heavy_minus_sign: | Applicable tax rate. | +| `id` | *Optional[str]* | :heavy_minus_sign: | Unique identifier for the tax rate in the accounting software. | | `name` | *Optional[str]* | :heavy_minus_sign: | Name of the tax rate in the accounting software. | \ No newline at end of file diff --git a/lending/docs/models/shared/tracking.md b/lending/docs/models/shared/tracking.md index 6f863a728..428f60608 100644 --- a/lending/docs/models/shared/tracking.md +++ b/lending/docs/models/shared/tracking.md @@ -1,9 +1,12 @@ -# Tracking - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `invoice_to` | [Optional[shared.AccountingRecordRef]](../../models/shared/accountingrecordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | -| `record_refs` | List[[shared.TrackingRecordRef](../../models/shared/trackingrecordref.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +# Tracking + +Categories, and a project and customer, against which the item is tracked. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `additional_properties` | Dict[str, *Any*] | :heavy_check_mark: | N/A | +| `invoice_to` | [Optional[shared.AccountingRecordRef]](../../models/shared/accountingrecordref.md) | :heavy_minus_sign: | N/A | +| `record_refs` | List[[shared.TrackingRecordRef](../../models/shared/trackingrecordref.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/trackingcategoryref.md b/lending/docs/models/shared/trackingcategoryref.md index 71a56ed35..949dffd2e 100644 --- a/lending/docs/models/shared/trackingcategoryref.md +++ b/lending/docs/models/shared/trackingcategoryref.md @@ -1,13 +1,9 @@ -# ~~TrackingCategoryRef~~ - -References a category against which the item is tracked. - -> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | Unique identifier to the tracking category. | +# TrackingCategoryRef + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique identifier to the tracking category. | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Name of tracking category. | \ No newline at end of file diff --git a/lending/docs/models/shared/trackingrecordref.md b/lending/docs/models/shared/trackingrecordref.md index cb54c2c2d..f82f18545 100644 --- a/lending/docs/models/shared/trackingrecordref.md +++ b/lending/docs/models/shared/trackingrecordref.md @@ -1,11 +1,9 @@ -# TrackingRecordRef - -Links to the customer or tracking category. - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `data_type` | [Optional[shared.TrackingRecordRefDataType]](../../models/shared/trackingrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | trackingCategories | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | | \ No newline at end of file +# TrackingRecordRef + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `data_type` | [Optional[shared.TrackingRecordRefDataType]](../../models/shared/trackingrecordrefdatatype.md) | :heavy_minus_sign: | Name of underlying data type. | +| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record or data type. | \ No newline at end of file diff --git a/lending/docs/models/shared/trackingrecordrefdatatype.md b/lending/docs/models/shared/trackingrecordrefdatatype.md index c9d47c2e9..049cb689c 100644 --- a/lending/docs/models/shared/trackingrecordrefdatatype.md +++ b/lending/docs/models/shared/trackingrecordrefdatatype.md @@ -1,20 +1,20 @@ -# TrackingRecordRefDataType - -Name of underlying data type. - -## Example Usage - -```python -from codat_lending.models.shared import TrackingRecordRefDataType - -value = TrackingRecordRefDataType.CUSTOMERS -``` - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `CUSTOMERS` | customers | -| `SUPPLIERS` | suppliers | +# TrackingRecordRefDataType + +Name of underlying data type. + +## Example Usage + +```python +from codat_lending.models.shared import TrackingRecordRefDataType + +value = TrackingRecordRefDataType.CUSTOMERS +``` + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `CUSTOMERS` | customers | +| `SUPPLIERS` | suppliers | | `TRACKING_CATEGORIES` | trackingCategories | \ No newline at end of file diff --git a/lending/docs/models/shared/transactioncategory.md b/lending/docs/models/shared/transactioncategory.md index 753b011fb..7a9b26a2a 100644 --- a/lending/docs/models/shared/transactioncategory.md +++ b/lending/docs/models/shared/transactioncategory.md @@ -1,10 +1,10 @@ -# TransactionCategory - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| `confidence` | *Optional[Decimal]* | :heavy_minus_sign: | Returns the aggregate confidence of the suggested category for the transaction. The value is between 0 and 100. | -| `confidences` | List[*Decimal*] | :heavy_minus_sign: | An ordered array of category level confidences where each element is the confidence of the corresponding item in the `levels` array. | +# TransactionCategory + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *Optional[Decimal]* | :heavy_minus_sign: | Returns the aggregate confidence of the suggested category for the transaction. The value is between 0 and 100. | +| `confidences` | List[*Decimal*] | :heavy_minus_sign: | An ordered array of category level confidences where each element is the confidence of the corresponding item in the `levels` array. | | `levels` | List[*str*] | :heavy_minus_sign: | The suggested category is an ordered array of category levels where each element (or level) is a subcategory of the previous element (or level). | \ No newline at end of file diff --git a/lending/docs/models/shared/transactioncategoryref.md b/lending/docs/models/shared/transactioncategoryref.md index a3e0a381d..190a09cb0 100644 --- a/lending/docs/models/shared/transactioncategoryref.md +++ b/lending/docs/models/shared/transactioncategoryref.md @@ -1,11 +1,9 @@ -# TransactionCategoryRef - -An object of bank transaction category reference data. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique category reference id for the bank transaction. | +# TransactionCategoryRef + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique category reference id for the bank transaction. | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The category name reference for the bank transaction. | \ No newline at end of file diff --git a/lending/docs/models/shared/transactioncategorystatus.md b/lending/docs/models/shared/transactioncategorystatus.md index 202a1245d..cee4194a9 100644 --- a/lending/docs/models/shared/transactioncategorystatus.md +++ b/lending/docs/models/shared/transactioncategorystatus.md @@ -1,20 +1,18 @@ -# TransactionCategoryStatus - -The status of the transaction category. - -## Example Usage - -```python -from codat_lending.models.shared import TransactionCategoryStatus - -value = TransactionCategoryStatus.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------- | ---------- | -| `UNKNOWN` | Unknown | -| `ACTIVE` | Active | +# TransactionCategoryStatus + +## Example Usage + +```python +from codat_lending.models.shared import TransactionCategoryStatus + +value = TransactionCategoryStatus.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `UNKNOWN` | Unknown | +| `ACTIVE` | Active | | `ARCHIVED` | Archived | \ No newline at end of file diff --git a/lending/docs/models/shared/transactioncode.md b/lending/docs/models/shared/transactioncode.md index e013d5176..3426229e9 100644 --- a/lending/docs/models/shared/transactioncode.md +++ b/lending/docs/models/shared/transactioncode.md @@ -1,32 +1,30 @@ -# TransactionCode - -Code to identify the underlying transaction. - -## Example Usage - -```python -from codat_lending.models.shared import TransactionCode - -value = TransactionCode.UNKNOWN -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `UNKNOWN` | Unknown | -| `FEE` | Fee | -| `PAYMENT` | Payment | -| `CASH` | Cash | -| `TRANSFER` | Transfer | -| `INTEREST` | Interest | -| `CASHBACK` | Cashback | -| `CHEQUE` | Cheque | -| `DIRECT_DEBIT` | DirectDebit | -| `PURCHASE` | Purchase | -| `STANDING_ORDER` | StandingOrder | -| `ADJUSTMENT` | Adjustment | -| `CREDIT` | Credit | -| `OTHER` | Other | +# TransactionCode + +## Example Usage + +```python +from codat_lending.models.shared import TransactionCode + +value = TransactionCode.UNKNOWN +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `UNKNOWN` | Unknown | +| `FEE` | Fee | +| `PAYMENT` | Payment | +| `CASH` | Cash | +| `TRANSFER` | Transfer | +| `INTEREST` | Interest | +| `CASHBACK` | Cashback | +| `CHEQUE` | Cheque | +| `DIRECT_DEBIT` | DirectDebit | +| `PURCHASE` | Purchase | +| `STANDING_ORDER` | StandingOrder | +| `ADJUSTMENT` | Adjustment | +| `CREDIT` | Credit | +| `OTHER` | Other | | `NOT_SUPPORTED` | NotSupported | \ No newline at end of file diff --git a/lending/docs/models/shared/transactionsourceref.md b/lending/docs/models/shared/transactionsourceref.md index 090d7d781..4d6c3c5aa 100644 --- a/lending/docs/models/shared/transactionsourceref.md +++ b/lending/docs/models/shared/transactionsourceref.md @@ -1,9 +1,9 @@ -# TransactionSourceRef - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The unique identitifer of the record being referenced | **Example 1:** 13d946f0-c5d5-42bc-b092-97ece17923ab
**Example 2:** 9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2
**Example 3:** 7110701885
**Example 4:** EILBDVJVNUAGVKRQ | -| `type` | [shared.TransactionSourceType](../../models/shared/transactionsourcetype.md) | :heavy_check_mark: | The type of source the transaction arose. | | \ No newline at end of file +# TransactionSourceRef + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identitifer of the record being referenced | +| `type` | [shared.TransactionSourceType](../../models/shared/transactionsourcetype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/lending/docs/models/shared/transactionsourcetype.md b/lending/docs/models/shared/transactionsourcetype.md index 806ec0707..084cb67de 100644 --- a/lending/docs/models/shared/transactionsourcetype.md +++ b/lending/docs/models/shared/transactionsourcetype.md @@ -1,22 +1,20 @@ -# TransactionSourceType - -The type of source the transaction arose. - -## Example Usage - -```python -from codat_lending.models.shared import TransactionSourceType - -value = TransactionSourceType.FEE -``` - - -## Values - -| Name | Value | -| ---------------- | ---------------- | -| `FEE` | Fee | -| `ORDER` | Order | -| `PAYMENT` | Payment | -| `SERVICE_CHARGE` | ServiceCharge | +# TransactionSourceType + +## Example Usage + +```python +from codat_lending.models.shared import TransactionSourceType + +value = TransactionSourceType.FEE +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `FEE` | Fee | +| `ORDER` | Order | +| `PAYMENT` | Payment | +| `SERVICE_CHARGE` | ServiceCharge | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/transactiontype.md b/lending/docs/models/shared/transactiontype.md index 32be670a2..8a760a752 100644 --- a/lending/docs/models/shared/transactiontype.md +++ b/lending/docs/models/shared/transactiontype.md @@ -1,33 +1,23 @@ -# TransactionType - -The type of the platform transaction: -- `Unknown` -- `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account. -- `Payment` — Credit and debit card payments. -- `PaymentFee` — Payment provider's fee on each card payment. -- `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller. -- `Payout` — Transfer of funds from the seller's merchant account to their bank account. -- `Refund` — Refunds to a customer's credit or debit card. -- `Transfer` — Secure transfer of funds to the seller's bank account. - -## Example Usage - -```python -from codat_lending.models.shared import TransactionType - -value = TransactionType.PAYMENT -``` - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `PAYMENT` | Payment | -| `REFUND` | Refund | -| `PAYOUT` | Payout | -| `FAILED_PAYOUT` | FailedPayout | -| `TRANSFER` | Transfer | -| `PAYMENT_FEE` | PaymentFee | -| `PAYMENT_FEE_REFUND` | PaymentFeeRefund | +# TransactionType + +## Example Usage + +```python +from codat_lending.models.shared import TransactionType + +value = TransactionType.PAYMENT +``` + + +## Values + +| Name | Value | +| -------------------- | -------------------- | +| `PAYMENT` | Payment | +| `REFUND` | Refund | +| `PAYOUT` | Payout | +| `FAILED_PAYOUT` | FailedPayout | +| `TRANSFER` | Transfer | +| `PAYMENT_FEE` | PaymentFee | +| `PAYMENT_FEE_REFUND` | PaymentFeeRefund | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/transferaccount.md b/lending/docs/models/shared/transferaccount.md index dc4b92ef9..1fea62794 100644 --- a/lending/docs/models/shared/transferaccount.md +++ b/lending/docs/models/shared/transferaccount.md @@ -1,12 +1,12 @@ -# TransferAccount - -Account details of the account sending or receiving the transfer. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `account_ref` | [Optional[shared.AccountingRecordRef]](../../models/shared/accountingrecordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | | -| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transferred between accounts. | | +# TransferAccount + +Account details of the account sending or receiving the transfer. + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `account_ref` | [Optional[shared.AccountingRecordRef]](../../models/shared/accountingrecordref.md) | :heavy_minus_sign: | Links the current record to the underlying record or data type that created it.

For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. | | +| `amount` | *Optional[Decimal]* | :heavy_minus_sign: | The amount transferred between accounts. | | | `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 | \ No newline at end of file diff --git a/lending/docs/models/shared/type.md b/lending/docs/models/shared/type.md index 8f6cf7366..21b325053 100644 --- a/lending/docs/models/shared/type.md +++ b/lending/docs/models/shared/type.md @@ -1,30 +1,28 @@ -# Type - -The type of routing number. - -## Example Usage - -```python -from codat_lending.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 +# Type + +## Example Usage + +```python +from codat_lending.models.shared import Type + +value = Type.ABA +``` + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `ABA` | aba | +| `APCA` | apca | +| `BANKCODE` | bankcode | +| `BLZ` | blz | +| `BSB` | bsb | +| `CLABE` | clabe | +| `IBAN` | iban | +| `IFSC` | ifsc | +| `NZ2` | nz2 | +| `RTN` | rtn | +| `SORTCODE` | sortcode | +| `SWIFT` | swift | +| `TRNO` | trno | \ No newline at end of file diff --git a/lending/docs/models/shared/updateconnection.md b/lending/docs/models/shared/updateconnection.md new file mode 100644 index 000000000..439e3fee3 --- /dev/null +++ b/lending/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/lending/docs/models/shared/uploadbankstatementdatarequest.md b/lending/docs/models/shared/uploadbankstatementdatarequest.md new file mode 100644 index 000000000..9c45376e6 --- /dev/null +++ b/lending/docs/models/shared/uploadbankstatementdatarequest.md @@ -0,0 +1,12 @@ +# UploadBankStatementDataRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `actual_instance` | *Optional[Union[BankingAccount, BankingTransactions, object]]* | :heavy_minus_sign: | N/A | +| `one_of_schemas` | *Set[str]* | :heavy_check_mark: | N/A | +| `oneof_schema_1_validator` | [Optional[shared.BankingAccount]](../../models/shared/bankingaccount.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_2_validator` | [Optional[shared.BankingTransactions]](../../models/shared/bankingtransactions.md) | :heavy_minus_sign: | N/A | +| `oneof_schema_3_validator` | *Optional[Any]* | :heavy_minus_sign: | The format should be identical to the file format receieved from the third-party banking source (e.g. Plaid or TrueLayer). | \ No newline at end of file diff --git a/lending/docs/models/shared/validation.md b/lending/docs/models/shared/validation.md index 4cfc544dc..b208342e2 100644 --- a/lending/docs/models/shared/validation.md +++ b/lending/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/lending/docs/models/shared/validationitem.md b/lending/docs/models/shared/validationitem.md index 1aaf084c9..791ee2076 100644 --- a/lending/docs/models/shared/validationitem.md +++ b/lending/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/lending/docs/models/shared/validdatatypelinks.md b/lending/docs/models/shared/validdatatypelinks.md index 809a80db0..7715cebea 100644 --- a/lending/docs/models/shared/validdatatypelinks.md +++ b/lending/docs/models/shared/validdatatypelinks.md @@ -1,50 +1,50 @@ -# ValidDataTypeLinks - -When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - -For example, `validDatatypeLinks` might indicate the following references: - -- Which tax rates are valid to use on the line item of a bill. -- Which items can be used when creating an invoice. - -You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - -## `validDatatypeLinks` example - -The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - -```json validDatatypeLinks for an account -{ - "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", - "nominalCode": "090", - "name": "Business Bank Account", - #... - "validDatatypeLinks": [ - { - "property": "Id", - "links": [ - "Payment.AccountRef.Id", - "BillPayment.AccountRef.Id", - "DirectIncome.LineItems.AccountRef.Id", - "DirectCost.LineItems.AccountRef.Id" - ] - } - ] - } -``` - - - -## Support for `validDatatypeLinks` - -Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - -If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `links` | List[*str*] | :heavy_minus_sign: | Supported `dataTypes` that the record can be linked to. | +# ValidDataTypeLinks + +When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. + +For example, `validDatatypeLinks` might indicate the following references: + +- Which tax rates are valid to use on the line item of a bill. +- Which items can be used when creating an invoice. + +You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. + +## `validDatatypeLinks` example + +The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. + +```json validDatatypeLinks for an account +{ + "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", + "nominalCode": "090", + "name": "Business Bank Account", + #... + "validDatatypeLinks": [ + { + "property": "Id", + "links": [ + "Payment.AccountRef.Id", + "BillPayment.AccountRef.Id", + "DirectIncome.LineItems.AccountRef.Id", + "DirectCost.LineItems.AccountRef.Id" + ] + } + ] + } +``` + + + +## Support for `validDatatypeLinks` + +Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. + +If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `links` | List[*str*] | :heavy_minus_sign: | Supported `dataTypes` that the record can be linked to. | | `property` | *OptionalNullable[str]* | :heavy_minus_sign: | The property from the account that can be linked. | \ No newline at end of file diff --git a/lending/docs/models/shared/weblink.md b/lending/docs/models/shared/weblink.md index 62e13f56d..294667abf 100644 --- a/lending/docs/models/shared/weblink.md +++ b/lending/docs/models/shared/weblink.md @@ -1,11 +1,11 @@ -# WebLink - -Weblink associated with the company. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `type` | [Optional[shared.WebLinkType]](../../models/shared/weblinktype.md) | :heavy_minus_sign: | The type of the weblink. | +# WebLink + +Weblink associated with the company. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `type` | [Optional[shared.WebLinkType]](../../models/shared/weblinktype.md) | :heavy_minus_sign: | The type of the weblink. | | `url` | *Optional[str]* | :heavy_minus_sign: | The full URL for the weblink. | \ No newline at end of file diff --git a/lending/docs/models/shared/weblinktype.md b/lending/docs/models/shared/weblinktype.md index 06cbce0ef..f56288b89 100644 --- a/lending/docs/models/shared/weblinktype.md +++ b/lending/docs/models/shared/weblinktype.md @@ -1,20 +1,18 @@ -# WebLinkType - -The type of the weblink. - -## Example Usage - -```python -from codat_lending.models.shared import WebLinkType - -value = WebLinkType.WEBSITE -``` - - -## Values - -| Name | Value | -| --------- | --------- | -| `WEBSITE` | Website | -| `SOCIAL` | Social | +# WebLinkType + +## Example Usage + +```python +from codat_lending.models.shared import WebLinkType + +value = WebLinkType.WEBSITE +``` + + +## Values + +| Name | Value | +| --------- | --------- | +| `WEBSITE` | Website | +| `SOCIAL` | Social | | `UNKNOWN` | Unknown | \ No newline at end of file diff --git a/lending/docs/models/shared/withholdingtax.md b/lending/docs/models/shared/withholdingtax.md index 277b9561e..33cea0e3c 100644 --- a/lending/docs/models/shared/withholdingtax.md +++ b/lending/docs/models/shared/withholdingtax.md @@ -1,9 +1,9 @@ -# WithholdingTax - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `amount` | *Decimal* | :heavy_check_mark: | Amount of tax withheld. | +# WithholdingTax + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `amount` | *Decimal* | :heavy_check_mark: | Amount of tax withheld. | | `name` | *str* | :heavy_check_mark: | Name assigned to withheld tax. | \ No newline at end of file diff --git a/lending/docs/models/shared/zero.md b/lending/docs/models/shared/zero.md deleted file mode 100644 index 6c2faac45..000000000 --- a/lending/docs/models/shared/zero.md +++ /dev/null @@ -1,14 +0,0 @@ -# Zero - -Links the current record line to the underlying record line that created it. - -For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `data_type` | [Optional[shared.ZeroDataType]](../../models/shared/zerodatatype.md) | :heavy_minus_sign: | Allowed name of the 'dataType'. | -| `id` | *Optional[str]* | :heavy_minus_sign: | 'id' of the underlying record. | -| `line_number` | *Optional[str]* | :heavy_minus_sign: | Line number of the underlying record. | \ No newline at end of file diff --git a/lending/docs/models/shared/zerodatatype.md b/lending/docs/models/shared/zerodatatype.md index 2225860e6..d97cbef03 100644 --- a/lending/docs/models/shared/zerodatatype.md +++ b/lending/docs/models/shared/zerodatatype.md @@ -1,19 +1,17 @@ -# ZeroDataType - -Allowed name of the 'dataType'. - -## Example Usage - -```python -from codat_lending.models.shared import ZeroDataType - -value = ZeroDataType.PURCHASE_ORDERS -``` - - -## Values - -| Name | Value | -| ----------------- | ----------------- | -| `PURCHASE_ORDERS` | purchaseOrders | +# ZeroDataType + +## Example Usage + +```python +from codat_lending.models.shared import ZeroDataType + +value = ZeroDataType.PURCHASE_ORDERS +``` + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `PURCHASE_ORDERS` | purchaseOrders | | `BILLS` | bills | \ No newline at end of file diff --git a/lending/docs/models/utils/retryconfig.md b/lending/docs/models/utils/retryconfig.md index 69dd549ec..0977111b8 100644 --- a/lending/docs/models/utils/retryconfig.md +++ b/lending/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/lending/docs/models/webhooks/reportscreditmodelgeneratesuccessfulreportgenerationwebhook.md b/lending/docs/models/webhooks/reportscreditmodelgeneratesuccessfulreportgenerationwebhook.md index b4fc1f151..1f3ec5c75 100644 --- a/lending/docs/models/webhooks/reportscreditmodelgeneratesuccessfulreportgenerationwebhook.md +++ b/lending/docs/models/webhooks/reportscreditmodelgeneratesuccessfulreportgenerationwebhook.md @@ -1,11 +1,11 @@ -# ReportsCreditModelGenerateSuccessfulReportGenerationWebhook - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** reports.categorizedBankStatement.generate.successful
**Example 2:** reports.creditModel.generate.successful | -| `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 | +# ReportsCreditModelGenerateSuccessfulReportGenerationWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `event_type` | *Optional[str]* | :heavy_minus_sign: | The type of event. | **Example 1:** reports.categorizedBankStatement.generate.successful
**Example 2:** reports.creditModel.generate.successful | +| `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.ReportGenerationPayload]](../../models/shared/reportgenerationpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/lending/docs/sdks/accountbalances/README.md b/lending/docs/sdks/accountbalances/README.md deleted file mode 100644 index 22a48e71f..000000000 --- a/lending/docs/sdks/accountbalances/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# Banking.AccountBalances - -## Overview - -### Available Operations - -* [list](#list) - List account balances - -## list - -The *List account balances* endpoint returns a list of [account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) for a given company's connection. - -[Account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) are balances for a bank account, including end-of-day batch balance or running balances per transaction. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.account_balances.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: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.account_balances.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.ListBankingAccountBalancesRequest](../../models/operations/listbankingaccountbalancesrequest.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.BankingAccountBalances](../../models/shared/bankingaccountbalances.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/lending/docs/sdks/codatlendingaccountingbankdata/README.md b/lending/docs/sdks/accountingbankdata/README.md similarity index 97% rename from lending/docs/sdks/codatlendingaccountingbankdata/README.md rename to lending/docs/sdks/accountingbankdata/README.md index 984d19e3b..884225838 100644 --- a/lending/docs/sdks/codatlendingaccountingbankdata/README.md +++ b/lending/docs/sdks/accountingbankdata/README.md @@ -1,246 +1,246 @@ -# AccountingBankData - -## Overview - -Access bank transactions from an accounting software. - -### Available Operations - -* [list_transactions](#list_transactions) - List bank account transactions - -## list_transactions - -The *List account bank transactions* endpoint returns a list of [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - -[Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.list_transactions(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "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.ListAccountingBankAccountTransactionsRequest](../../models/operations/listaccountingbankaccounttransactionsrequest.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.AccountingBankTransactions](../../models/shared/accountingbanktransactions.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 | +# AccountingBankData + +## Overview + +Access bank transactions from an accounting software. + +### Available Operations + +* [list_transactions](#list_transactions) - List bank account transactions + +## list_transactions + +The *List account bank transactions* endpoint returns a list of [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. + +[Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. + +Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). + + +### Example Usage: Dynamics 365 Business Central + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.accounting_bank_data.list_transactions(request={ + "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", + "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.ListAccountingBankAccountTransactionsRequest](../../models/operations/listaccountingbankaccounttransactionsrequest.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.AccountingBankTransactions](../../models/shared/accountingbanktransactions.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/lending/docs/sdks/accounts/README.md b/lending/docs/sdks/accounts/README.md deleted file mode 100644 index 2bdd627bb..000000000 --- a/lending/docs/sdks/accounts/README.md +++ /dev/null @@ -1,654 +0,0 @@ -# AccountingBankData.Accounts - -## Overview - -### Available Operations - -* [get](#get) - Get bank account -* [list](#list) - List bank accounts - -## get - -The *Get bank account* endpoint returns a single account for a given accountId. - -[Bank accounts](https://docs.codat.io/lending-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/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.accounts.get(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.GetAccountingBankAccountRequest](../../models/operations/getaccountingbankaccountrequest.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.AccountingBankAccount](../../models/shared/accountingbankaccount.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 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/lending-api#/schemas/BankAccount) for a given company's connection. - -[Bank accounts](https://docs.codat.io/lending-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/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounting_bank_data.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.ListAccountingBankAccountsRequest](../../models/operations/listaccountingbankaccountsrequest.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.AccountingBankAccounts](../../models/shared/accountingbankaccounts.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/lending/docs/sdks/accountspayable/README.md b/lending/docs/sdks/accountspayable/README.md new file mode 100644 index 000000000..937e3d925 --- /dev/null +++ b/lending/docs/sdks/accountspayable/README.md @@ -0,0 +1,5 @@ +# AccountsPayable + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/accountsreceivable/README.md b/lending/docs/sdks/accountsreceivable/README.md new file mode 100644 index 000000000..17ec65442 --- /dev/null +++ b/lending/docs/sdks/accountsreceivable/README.md @@ -0,0 +1,5 @@ +# AccountsReceivable + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/accounttransactions/README.md b/lending/docs/sdks/accounttransactions/README.md deleted file mode 100644 index 81d778b66..000000000 --- a/lending/docs/sdks/accounttransactions/README.md +++ /dev/null @@ -1,311 +0,0 @@ -# Transactions.AccountTransactions - -## Overview - -### Available Operations - -* [get](#get) - Get account transaction -* [list](#list) - List account transactions - -## get - -The *Get account transaction* endpoint returns a single account transaction for a given accountTransactionId. - -[Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.get(request={ - "account_transaction_id": "", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.get(request={ - "account_transaction_id": "", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.get(request={ - "account_transaction_id": "", - "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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.get(request={ - "account_transaction_id": "", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.get(request={ - "account_transaction_id": "", - "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.GetAccountingAccountTransactionRequest](../../models/operations/getaccountingaccounttransactionrequest.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.AccountingAccountTransaction](../../models/shared/accountingaccounttransaction.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List account transactions* endpoint returns a list of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) for a given company's connection. - -[Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.account_transactions.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.ListAccountingAccountTransactionsRequest](../../models/operations/listaccountingaccounttransactionsrequest.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.AccountingAccountTransactions](../../models/shared/accountingaccounttransactions.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/lending/docs/sdks/balancesheet/README.md b/lending/docs/sdks/balancesheet/README.md deleted file mode 100644 index 69d73d82a..000000000 --- a/lending/docs/sdks/balancesheet/README.md +++ /dev/null @@ -1,481 +0,0 @@ -# FinancialStatements.BalanceSheet - -## Overview - -### Available Operations - -* [get](#get) - Get balance sheet -* [get_categorized_accounts](#get_categorized_accounts) - Get categorized balance sheet statement - -## get - -Gets the latest balance sheet for a company. - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingBalanceSheetRequest](../../models/operations/getaccountingbalancesheetrequest.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.AccountingBalanceSheet](../../models/shared/accountingbalancesheet.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_categorized_accounts - -The *Get categorized balance sheet statement* endpoint returns a list of categorized accounts that appear on a company’s Balance Sheet along with a balance per financial statement date. - -Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.balance_sheet.get_categorized_accounts(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetCategorizedBalanceSheetStatementRequest](../../models/operations/getcategorizedbalancesheetstatementrequest.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.EnhancedFinancialReport](../../models/shared/enhancedfinancialreport.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/lending/docs/sdks/bankaccounts/README.md b/lending/docs/sdks/bankaccounts/README.md deleted file mode 100644 index 6bbe7c8e4..000000000 --- a/lending/docs/sdks/bankaccounts/README.md +++ /dev/null @@ -1,305 +0,0 @@ -# LoanWriteback.BankAccounts - -## Overview - -### Available Operations - -* [create](#create) - Create bank account -* [get_create_update_model](#get_create_update_model) - Get create/update bank account model - -## create - -The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/lending-api#/schemas/BankAccount) for a given company's connection. - -[Bank accounts](https://docs.codat.io/lending-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/lending-api#/operations/get-create-update-bankAccounts-model). - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.create(request={ - "accounting_bank_account": { - "currency": "GBP", - "modified_date": "2022-10-23T00:00:00Z", - "source_modified_date": "2022-10-23T00:00:00Z", - "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.AccountingCreateBankAccountResponse](../../models/shared/accountingcreatebankaccountresponse.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_update_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/lending-api#/schemas/BankAccount) for a given company and integration. - -[Bank accounts](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_accounts.get_create_update_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.GetCreateUpdateBankAccountsModelRequest](../../models/operations/getcreateupdatebankaccountsmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/banking/README.md b/lending/docs/sdks/banking/README.md new file mode 100644 index 000000000..3b93edb8e --- /dev/null +++ b/lending/docs/sdks/banking/README.md @@ -0,0 +1,5 @@ +# Banking + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/bankstatements/README.md b/lending/docs/sdks/bankstatements/README.md index 458f978ae..ef7c17ab4 100644 --- a/lending/docs/sdks/bankstatements/README.md +++ b/lending/docs/sdks/bankstatements/README.md @@ -1,292 +1,412 @@ -# BankStatements - -## Overview - -Retrieve banking data from linked bank accounts. - -### Available Operations - -* [end_upload_session](#end_upload_session) - End upload session -* [get_upload_configuration](#get_upload_configuration) - Get upload configuration -* [set_upload_configuration](#set_upload_configuration) - Set upload configuration -* [start_upload_session](#start_upload_session) - Start upload session -* [upload_bank_statement_data](#upload_bank_statement_data) - Upload data - -## end_upload_session - -Use the *End upload session* endpoint to finalize a bank statement upload session. Include a `status` in the request body to indicate if you want to cancel the processing of the dataset or trigger the ingestion and enrichment of the data. - -A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.bank_statements.end_upload_session(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "dataset_id": "79c714cf-8643-4bc6-9b4e-8d1a971222b7", - }) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.EndBankStatementUploadSessionRequest](../../models/operations/endbankstatementuploadsessionrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_upload_configuration - -Use the *Get upload configuration* endpoint to view the existing bank statement upload configuration for the specified data connection. - -With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - -When you use the [*Upload data*](https://docs.codat.io/lending-api#/operations/upload-bank-statement-data) endpoint next, you must upload the data for the account you configured. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.bank_statements.get_upload_configuration(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.GetBankStatementUploadConfigurationRequest](../../models/operations/getbankstatementuploadconfigurationrequest.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.BankStatementUploadConfiguration](../../models/shared/bankstatementuploadconfiguration.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 | \*/\* | - -## set_upload_configuration - -Use the *Set upload configuration* endpoint to create bank statement upload configuration for the specified data connection. - -With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - -Each data connection can only have one configuration for each company and external account ID combination. You will receive a Bad Request response if you try to set it again. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.bank_statements.set_upload_configuration(request={ - "bank_statement_upload_configuration": { - "account_id": "abc123-ABC", - "source": shared.Source.CODAT, - }, - "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.SetBankStatementUploadConfigurationRequest](../../models/operations/setbankstatementuploadconfigurationrequest.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.BankStatementUploadConfiguration](../../models/shared/bankstatementuploadconfiguration.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 | \*/\* | - -## start_upload_session - -Use the *Start upload session* endpoint to initiate a bank statement upload session for a given company. - -A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - -You can only have one active session per data type at a time. You can complete or cancel a session using the [*End upload session*](https://docs.codat.io/lending-api#/operations/end-bank-statement-upload-session) endpoint. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.bank_statements.start_upload_session(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.StartBankStatementUploadSessionRequest](../../models/operations/startbankstatementuploadsessionrequest.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.PullOperation](../../models/shared/pulloperation.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 | \*/\* | - -## upload_bank_statement_data - -During an active session, use the **Upload data* endpoint to uploads a page of bank accounts or bank transactions data to the session. - -Make sure you created configuration for the account using the [*Set upload configuration*](https://docs.codat.io/lending-api#/operations/set-bank-statement-upload-configuration) endpoint before attempting an upload. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.bank_statements.upload_bank_statement_data(request=operations.UploadBankStatementDataRequest( - request_body={ - "results": [ - { - "id": "1703194f-7805-4da8-bac0-2ba5da4a4216", - "name": "Business Current Account", - "informalName": "Codat", - "holder": "Codat Ltd", - "type": "Debit", - "balance": { - "available": -459987.97, - "current": -459964.9, - "limit": 5000, - }, - "identifiers": { - "type": "Depository", - "subtype": "checking", - "number": "46762629", - "bankCode": 9911, - "iban": "GB29 LOYD 4773 2346 7626 29", - "bic": "LOYDGB21006", - "maskedAccountNumber": "LOYDGB21006", - }, - "currency": "GBP", - "institution": { - "id": "lloyds-bank", - "name": "Lloyds Bank", - }, - "modifiedDate": "2022-05-23T16:32:50Z", - "sourceModifiedDate": "2021-08-14T05:04:12", - }, - ], - }, - company_id="8a210b68-6988-11ed-a1eb-0242ac120002", - connection_id="2e9d2c44-f675-40ba-8049-353bfcb5e171", - dataset_id="f0095e43-88a7-4395-9f2c-1d5226e1c9e5", - )) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `request` | [operations.UploadBankStatementDataRequest](../../models/operations/uploadbankstatementdatarequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# BankStatements + +## Overview + +Retrieve banking data from linked bank accounts. + +### Available Operations + +* [download_categorized_bank_statement_excel](#download_categorized_bank_statement_excel) - Download categorized bank statement Excel +* [end_upload_session](#end_upload_session) - End upload session +* [get_categorized_bank_statement_transactions](#get_categorized_bank_statement_transactions) - Get categorized bank statement transactions +* [get_upload_configuration](#get_upload_configuration) - Get upload configuration +* [list_categorized_bank_statement_accounts](#list_categorized_bank_statement_accounts) - List categorized bank statement accounts +* [set_upload_configuration](#set_upload_configuration) - Set upload configuration +* [start_upload_session](#start_upload_session) - Start upload session +* [upload_bank_statement_data](#upload_bank_statement_data) - Upload data + +## download_categorized_bank_statement_excel + +Use the *Download categorized bank statement Excel* endpoint to download the categorized bank statement Excel file. + +Before using it, you must call the [Generate report](https://docs.codat.io/lending-api#/operations/generate-report) endpoint of type `categorizedBankStatement`. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.download_categorized_bank_statement_excel(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "max_age": "2022-10-23T00:00:00Z", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.DownloadCategorizedBankStatementExcelRequest](../../models/operations/downloadcategorizedbankstatementexcelrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[httpx.Response](../../models/data.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 | \*/\* | + +## end_upload_session + +Use the *End upload session* endpoint to finalize a bank statement upload session. Include a `status` in the request body to indicate if you want to cancel the processing of the dataset or trigger the ingestion and enrichment of the data. + +A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.bank_statements.end_upload_session(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.EndBankStatementUploadSessionRequest](../../models/operations/endbankstatementuploadsessionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_categorized_bank_statement_transactions + +The *Get categorized bank statement transactions* endpoint returns fully categorized bank transactions for a company. Transaction data is obtained from the company's connected bank accounts. + +Before using it, you must call the [Generate report](https://docs.codat.io/lending-api#/operations/generate-report) endpoint of type `categorizedBankStatement`. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.get_categorized_bank_statement_transactions(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "max_age": "2022-10-23T00:00:00Z", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetCategorizedBankStatementTransactionsRequest](../../models/operations/getcategorizedbankstatementtransactionsrequest.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.CategorizedBankStatementTransactions](../../models/shared/categorizedbankstatementtransactions.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_upload_configuration + +Use the *Get upload configuration* endpoint to view the existing bank statement upload configuration for the specified data connection. + +With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. + +When you use the [*Upload data*](https://docs.codat.io/lending-api#/operations/upload-bank-statement-data) endpoint next, you must upload the data for the account you configured. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.get_upload_configuration(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.GetBankStatementUploadConfigurationRequest](../../models/operations/getbankstatementuploadconfigurationrequest.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.BankStatementUploadConfiguration](../../models/shared/bankstatementuploadconfiguration.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_categorized_bank_statement_accounts + +The *Get categorized bank statement accounts* endpoint returns a list of bank accounts associated with categorized transactions for a company. + +Before using it, you must call the [Generate report](https://docs.codat.io/lending-api#/operations/generate-report) endpoint of type `categorizedBankStatement`. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.list_categorized_bank_statement_accounts(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "max_age": "2022-10-23T00:00:00Z", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.ListCategorizedBankStatementAccountsRequest](../../models/operations/listcategorizedbankstatementaccountsrequest.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.CategorizedBankStatementAccounts](../../models/shared/categorizedbankstatementaccounts.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 | \*/\* | + +## set_upload_configuration + +Use the *Set upload configuration* endpoint to create bank statement upload configuration for the specified data connection. + +With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. + +Each data connection can only have one configuration for each company and external account ID combination. You will receive a Bad Request response if you try to set it again. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.set_upload_configuration(request={ + "bank_statement_upload_configuration": { + "account_id": "abc123-ABC", + "source": shared.Source.CODAT, + }, + "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.SetBankStatementUploadConfigurationRequest](../../models/operations/setbankstatementuploadconfigurationrequest.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.BankStatementUploadConfiguration](../../models/shared/bankstatementuploadconfiguration.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 | \*/\* | + +## start_upload_session + +Use the *Start upload session* endpoint to initiate a bank statement upload session for a given company. + +A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. + +You can only have one active session per data type at a time. You can complete or cancel a session using the [*End upload session*](https://docs.codat.io/lending-api#/operations/end-bank-statement-upload-session) endpoint. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.bank_statements.start_upload_session(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.StartBankStatementUploadSessionRequest](../../models/operations/startbankstatementuploadsessionrequest.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.PullOperation](../../models/shared/pulloperation.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 | \*/\* | + +## upload_bank_statement_data + +During an active session, use the **Upload data* endpoint to uploads a page of bank accounts or bank transactions data to the session. + +Make sure you created configuration for the account using the [*Set upload configuration*](https://docs.codat.io/lending-api#/operations/set-bank-statement-upload-configuration) endpoint before attempting an upload. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.bank_statements.upload_bank_statement_data(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.UploadBankStatementDataRequest](../../models/operations/uploadbankstatementdatarequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/banktransactions/README.md b/lending/docs/sdks/banktransactions/README.md deleted file mode 100644 index 6710ca7fc..000000000 --- a/lending/docs/sdks/banktransactions/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# LoanWriteback.BankTransactions - -## Overview - -### Available Operations - -* [create](#create) - Create bank account transactions -* [get_create_model](#get_create_model) - Get create bank account transactions model - -## create - -The *Create bank account transactions* endpoint creates new [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - -[Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create bank transaction model](https://docs.codat.io/lending-api#/operations/get-create-bankTransactions-model). - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_transactions.create(request={ - "accounting_create_bank_transactions": { - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "transactions": [ - { - "date_": "2022-10-23T00:00:00Z", - }, - ], - }, - "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.AccountingCreateBankTransactionsResponse](../../models/shared/accountingcreatebanktransactionsresponse.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/lending-api#/schemas/BankTransactions) for a given company and integration. - -[Bank account transactions](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.bank_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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/billcreditnotes/README.md b/lending/docs/sdks/billcreditnotes/README.md deleted file mode 100644 index 941f9ad7c..000000000 --- a/lending/docs/sdks/billcreditnotes/README.md +++ /dev/null @@ -1,724 +0,0 @@ -# AccountsPayable.BillCreditNotes - -## Overview - -### Available Operations - -* [get](#get) - Get bill credit note -* [list](#list) - List bill credit notes - -## get - -The *Get bill credit note* endpoint returns a single bill credit note for a given billCreditNoteId. - -[Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.get(request={ - "bill_credit_note_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingBillCreditNoteRequest](../../models/operations/getaccountingbillcreditnoterequest.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.AccountingBillCreditNote](../../models/shared/accountingbillcreditnote.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List bill credit notes* endpoint returns a list of [bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) for a given company's connection. - -[Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_credit_notes.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.ListAccountingBillCreditNotesRequest](../../models/operations/listaccountingbillcreditnotesrequest.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.AccountingBillCreditNotes](../../models/shared/accountingbillcreditnotes.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/lending/docs/sdks/billpayments/README.md b/lending/docs/sdks/billpayments/README.md deleted file mode 100644 index 40fda0978..000000000 --- a/lending/docs/sdks/billpayments/README.md +++ /dev/null @@ -1,771 +0,0 @@ -# AccountsPayable.BillPayments - -## Overview - -### Available Operations - -* [get](#get) - Get bill payment -* [list](#list) - List bill payments - -## get - -The *Get bill payment* endpoint returns a single bill payment for a given billPaymentId. - -[Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.get(request={ - "bill_payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingBillPaymentRequest](../../models/operations/getaccountingbillpaymentrequest.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.AccountingBillPayment](../../models/shared/accountingbillpayment.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List bill payments* endpoint returns a list of [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) for a given company's connection. - -[Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bill_payments.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.ListAccountingBillPaymentsRequest](../../models/operations/listaccountingbillpaymentsrequest.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.AccountingBillPayments](../../models/shared/accountingbillpayments.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/lending/docs/sdks/bills/README.md b/lending/docs/sdks/bills/README.md deleted file mode 100644 index 70049a630..000000000 --- a/lending/docs/sdks/bills/README.md +++ /dev/null @@ -1,1029 +0,0 @@ -# AccountsPayable.Bills - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download bill attachment -* [get](#get) - Get bill -* [get_attachment](#get_attachment) - Get bill attachment -* [list](#list) - List bills -* [list_attachments](#list_attachments) - List bill attachments - -## download_attachment - -The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. - -[Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "bill_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.DownloadAccountingBillAttachmentRequest](../../models/operations/downloadaccountingbillattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 - -The *Get bill* endpoint returns a single bill for a given billId. - -[Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - -### Tips and traps - -To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get(request={ - "bill_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingBillRequest](../../models/operations/getaccountingbillrequest.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.AccountingBill](../../models/shared/accountingbill.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`. - -[Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "bill_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.GetAccountingBillAttachmentRequest](../../models/operations/getaccountingbillattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 bills* endpoint returns a list of [bills](https://docs.codat.io/lending-api#/schemas/Bill) for a given company's connection. - -[Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - -### Tips and traps - -To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.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.ListAccountingBillsRequest](../../models/operations/listaccountingbillsrequest.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.AccountingBills](../../models/shared/accountingbills.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 | \*/\* | - -## list_attachments - -The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. - -[Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.bills.list_attachments(request={ - "bill_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.ListAccountingBillAttachmentsRequest](../../models/operations/listaccountingbillattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/cashflow/README.md b/lending/docs/sdks/cashflow/README.md deleted file mode 100644 index 09268825a..000000000 --- a/lending/docs/sdks/cashflow/README.md +++ /dev/null @@ -1,181 +0,0 @@ -# FinancialStatements.CashFlow - -## Overview - -### Available Operations - -* [get](#get) - Get cash flow statement - -## get - -Gets the latest cash flow statement for a company. - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.cash_flow.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingCashFlowStatementRequest](../../models/operations/getaccountingcashflowstatementrequest.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.AccountingCashFlowStatement](../../models/shared/accountingcashflowstatement.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/categorizedstatement/README.md b/lending/docs/sdks/categorizedstatement/README.md deleted file mode 100644 index 0614ac596..000000000 --- a/lending/docs/sdks/categorizedstatement/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# Banking.CategorizedStatement - -## Overview - -### Available Operations - -* [get](#get) - Get categorized bank statement - -## get - -> **Categorization engine** -> -> The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. - -The _Get categorized bank statement_ endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.categorized_statement.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCategorizedBankStatementRequest](../../models/operations/getcategorizedbankstatementrequest.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.EnhancedCashFlowTransactions](../../models/shared/enhancedcashflowtransactions.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/lending/docs/sdks/codatlendingaccounts/README.md b/lending/docs/sdks/codatlendingaccounts/README.md deleted file mode 100644 index 9eeedb80c..000000000 --- a/lending/docs/sdks/codatlendingaccounts/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# Banking.Accounts - -## Overview - -### Available Operations - -* [get](#get) - Get account -* [list](#list) - List accounts - -## get - -The *Get account* endpoint returns a single account for a given accountId. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-api#/operations/refresh-company-data). - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.accounts.get(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) - -``` -### Example Usage: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.accounts.get(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.GetBankingAccountRequest](../../models/operations/getbankingaccountrequest.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.BankingAccount](../../models/shared/bankingaccount.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.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: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.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.ListBankingAccountsRequest](../../models/operations/listbankingaccountsrequest.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.BankingAccounts](../../models/shared/bankingaccounts.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/lending/docs/sdks/codatlendingbankingtransactions/README.md b/lending/docs/sdks/codatlendingbankingtransactions/README.md deleted file mode 100644 index 3f89282f7..000000000 --- a/lending/docs/sdks/codatlendingbankingtransactions/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Banking.Transactions - -## Overview - -### Available Operations - -* [get](#get) - Get bank transaction -* [list](#list) - List transactions - -## get - -The *Get transaction* endpoint returns a single transaction for a given transactionId. - -[Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetBankingTransactionRequest](../../models/operations/getbankingtransactionrequest.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.BankingTransaction](../../models/shared/bankingtransaction.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - -[Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transactions.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: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transactions.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.ListBankingTransactionsRequest](../../models/operations/listbankingtransactionsrequest.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.BankingTransactions](../../models/shared/bankingtransactions.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/lending/docs/sdks/codatlendingcustomers/README.md b/lending/docs/sdks/codatlendingcustomers/README.md deleted file mode 100644 index f639a7e09..000000000 --- a/lending/docs/sdks/codatlendingcustomers/README.md +++ /dev/null @@ -1,556 +0,0 @@ -# Sales.Customers - -## Overview - -### Available Operations - -* [get](#get) - Get customer -* [list](#list) - List customers - -## get - -The *Get customer* endpoint returns a single customer for a given customerId. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and receive goods and/or services from the SMB. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceCustomerRequest](../../models/operations/getcommercecustomerrequest.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.CommerceCustomer](../../models/shared/commercecustomer.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and recieve goods and/or services from the SMB. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.customers.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.ListCommerceCustomersRequest](../../models/operations/listcommercecustomersrequest.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.CommerceCustomers](../../models/shared/commercecustomers.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/lending/docs/sdks/codatlendingdirectcosts/README.md b/lending/docs/sdks/codatlendingdirectcosts/README.md deleted file mode 100644 index 8c1bf9a94..000000000 --- a/lending/docs/sdks/codatlendingdirectcosts/README.md +++ /dev/null @@ -1,713 +0,0 @@ -# Transactions.DirectCosts - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download direct cost attachment -* [get](#get) - Get direct cost -* [get_attachment](#get_attachment) - Get direct cost attachment -* [list](#list) - List direct costs -* [list_attachments](#list_attachments) - List direct cost attachments - -## download_attachment - -The *Download direct cost attachment* endpoint downloads a specific attachment for a given `directCostId` and `attachmentId`. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.DownloadAccountingDirectCostAttachmentRequest](../../models/operations/downloadaccountingdirectcostattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 - -The *Get direct cost* endpoint returns a single direct cost for a given directCostId. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingDirectCostRequest](../../models/operations/getaccountingdirectcostrequest.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.AccountingDirectCost](../../models/shared/accountingdirectcost.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get direct cost attachment* endpoint returns a specific attachment for a given `directCostId` and `attachmentId`. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingDirectCostAttachmentRequest](../../models/operations/getaccountingdirectcostattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 direct costs* endpoint returns a list of [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.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.ListAccountingDirectCostsRequest](../../models/operations/listaccountingdirectcostsrequest.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.AccountingDirectCosts](../../models/shared/accountingdirectcosts.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 | \*/\* | - -## list_attachments - -The *List direct cost attachments* endpoint returns a list of attachments available to download for given `directCostId`. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.direct_costs.list_attachments(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.ListAccountingDirectCostAttachmentsRequest](../../models/operations/listaccountingdirectcostattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/codatlendingfinancialstatementsaccounts/README.md b/lending/docs/sdks/codatlendingfinancialstatementsaccounts/README.md deleted file mode 100644 index f5ee65d00..000000000 --- a/lending/docs/sdks/codatlendingfinancialstatementsaccounts/README.md +++ /dev/null @@ -1,911 +0,0 @@ -# FinancialStatements.Accounts - -## Overview - -### Available Operations - -* [get](#get) - Get account -* [list](#list) - List accounts - -## get - -The *Get account* endpoint returns a single account for a given accountId. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.get(request={ - "account_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingAccountRequest](../../models/operations/getaccountingaccountrequest.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.AccountingAccount](../../models/shared/accountingaccount.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.accounts.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.ListAccountingAccountsRequest](../../models/operations/listaccountingaccountsrequest.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.AccountingAccounts](../../models/shared/accountingaccounts.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/lending/docs/sdks/codatlendingloanwritebackaccounts/README.md b/lending/docs/sdks/codatlendingloanwritebackaccounts/README.md deleted file mode 100644 index 18636d09c..000000000 --- a/lending/docs/sdks/codatlendingloanwritebackaccounts/README.md +++ /dev/null @@ -1,333 +0,0 @@ -# LoanWriteback.Accounts - -## Overview - -### Available Operations - -* [create](#create) - Create account -* [get_create_model](#get_create_model) - Get create account model - -## create - -The *Create account* endpoint creates a new [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.accounts.create(request={ - "account_prototype": { - "currency": "GBP", - "current_balance": Decimal("0"), - "description": "Invoices the business has issued but has not yet collected payment on.", - "fully_qualified_category": "Asset.Current", - "fully_qualified_name": "Cash On Hand", - "name": "Accounts Receivable", - "nominal_code": "610", - "status": shared.AccountStatus.ACTIVE, - "type": shared.AccountType.ASSET, - }, - "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.CreateAccountRequest](../../models/operations/createaccountrequest.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.AccountingCreateAccountResponse](../../models/shared/accountingcreateaccountresponse.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 account model* endpoint returns the expected data for the request payload when creating an [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company and integration. - -[Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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 - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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 Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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.GetCreateChartOfAccountsModelRequest](../../models/operations/getcreatechartofaccountsmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/codatlendingpayments/README.md b/lending/docs/sdks/codatlendingpayments/README.md deleted file mode 100644 index a99b3ad46..000000000 --- a/lending/docs/sdks/codatlendingpayments/README.md +++ /dev/null @@ -1,626 +0,0 @@ -# LoanWriteback.Payments - -## Overview - -### Available Operations - -* [create](#create) - Create payment -* [get_create_model](#get_create_model) - Get create payment model - -## create - -The *Create payment* endpoint creates a new [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create payment model](https://docs.codat.io/lending-api#/operations/get-create-payments-model). - -### Example Usage: Malformed query - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.create(request={ - "accounting_payment": { - "currency": "GBP", - "date_": "2022-10-23T00:00:00Z", - "lines": [ - { - "allocated_on_date": "2022-10-23T00:00:00Z", - "amount": Decimal("8277.93"), - }, - ], - "modified_date": "2022-10-23T00:00:00Z", - "payment_method_ref": { - "id": "EILBDVJVNUAGVKRQ", - "name": "AliPay", - }, - "source_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: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.create(request={ - "accounting_payment": { - "account_ref": { - "id": "8000002E-1675267199", - "name": "Undeposited Funds", - }, - "currency": "USD", - "currency_rate": Decimal("1"), - "customer_ref": { - "company_name": "string", - "id": "80000002-1674552702", - }, - "date_": "2023-02-10T11:47:04.792Z", - "lines": [ - { - "allocated_on_date": "2023-02-11T11:47:04.792Z", - "amount": Decimal("28"), - "links": [ - { - "amount": Decimal("-28"), - "currency_rate": Decimal("1"), - "id": "181-1676374586", - "type": shared.PaymentLinkType.INVOICE, - }, - ], - }, - ], - "note": "note 14/02 1147", - "payment_method_ref": { - "id": "string", - "name": "string", - }, - "reference": "ref 14/02 1147", - "total_amount": Decimal("28"), - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.create(request={ - "accounting_payment": { - "account_ref": { - "id": "1200", - "name": "Bank Current Account", - }, - "currency": "GBP", - "currency_rate": Decimal("1"), - "customer_ref": { - "id": "CUST1", - }, - "date_": "2023-03-17T11:47:04.792Z", - "lines": [ - { - "allocated_on_date": "2023-02-11T11:47:04.792Z", - "amount": Decimal("4"), - "links": [ - { - "amount": Decimal("-4"), - "currency_rate": Decimal("1"), - "id": "INV-31", - "type": shared.PaymentLinkType.INVOICE, - }, - ], - }, - ], - "note": "note 07/03 14.31", - "payment_method_ref": { - "id": "4405", - }, - "reference": "ref", - "total_amount": Decimal("4"), - }, - "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_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.create(request={ - "accounting_payment": { - "account_ref": { - "id": "9a25937b267a11e797950a57719b2edb", - "name": "Current", - }, - "currency": "GBP", - "currency_rate": Decimal("1"), - "customer_ref": { - "company_name": "Stanley test customer", - "id": "30444c5bd4964fd787c7f8e2e5301ce1", - }, - "date_": "2023-03-20T11:47:04.792Z", - "lines": [ - { - "allocated_on_date": "2023-02-11T11:47:04.792Z", - "amount": Decimal("0.17"), - "links": [ - { - "amount": Decimal("-0.17"), - "currency_rate": Decimal("1"), - "id": "bb85db9226d7450fb99eb83e7fb37505", - "type": shared.PaymentLinkType.INVOICE, - }, - ], - }, - ], - "note": "Need to send products asap.", - "reference": "normal payment 20/03 17.05", - "total_amount": Decimal("0.17"), - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.create(request={ - "accounting_payment": { - "account_ref": { - "id": "81", - }, - "customer_ref": { - "id": "19", - }, - "date_": "2022-03-12T00:00:00", - "lines": [ - { - "amount": Decimal("0"), - "links": [ - { - "amount": Decimal("-1.1"), - "id": "246", - "type": shared.PaymentLinkType.INVOICE, - }, - { - "amount": Decimal("1.1"), - "id": "280", - "type": shared.PaymentLinkType.CREDIT_NOTE, - }, - ], - }, - ], - "total_amount": Decimal("0"), - }, - "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.CreatePaymentRequest](../../models/operations/createpaymentrequest.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.AccountingCreatePaymentResponse](../../models/shared/accountingcreatepaymentresponse.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 payment model* endpoint returns the expected data for the request payload when creating a [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company and integration. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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 - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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 Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.payments.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.GetCreatePaymentModelRequest](../../models/operations/getcreatepaymentmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/codatlendingreports/README.md b/lending/docs/sdks/codatlendingreports/README.md deleted file mode 100644 index e15cc6c82..000000000 --- a/lending/docs/sdks/codatlendingreports/README.md +++ /dev/null @@ -1,153 +0,0 @@ -# Sales.Reports - -## Overview - -### Available Operations - -* [get_orders](#get_orders) - Get orders report -* [get_refunds](#get_refunds) - Get refunds report - -## get_orders - -The *Get orders report* endpoint returns the number of orders, total value, and average order value for a specific company's commerce connection over one or more periods of time. - -This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - -[Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the order metrics. - -#### Response structure - -The Orders report's dimensions and measures are: - -| Index | Dimensions | -|---------------|----------------| -| `index` = 0 | Period | -| `index` = 1 | Order metrics | - -| Index | Measures | -|---------------|------------| -| `index` = 0 | Count | -| `index` = 1 | Value | - -The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.reports.get_orders(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "number_of_periods": 64425, - "period_length": 176756, - "period_unit": shared.PeriodUnit.DAY, - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetCommerceOrdersReportRequest](../../models/operations/getcommerceordersreportrequest.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.CommerceReport](../../models/shared/commercereport.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_refunds - -The *Get refunds report* endpoint returns the number and total value of refunds and the refund rate for a specific company's commerce connection over one or more periods of time. - -This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - -[Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the refunds metrics. - -#### Response structure - -The Refunds report's dimensions and measures are: - -| Index | Dimensions | -|----------------|----------------| -| `index` = 0 | Period | -| `index` = 1 | Refund metrics | - -| Index | Measures | -|----------------|------------| -| `index` = 0 | Count | -| `index` = 1 | Value | -| `index` = 2 | Percentage | - -The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.reports.get_refunds(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "number_of_periods": 555513, - "period_length": 931992, - "period_unit": shared.PeriodUnit.YEAR, - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceRefundsReportRequest](../../models/operations/getcommercerefundsreportrequest.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.CommerceReport](../../models/shared/commercereport.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/lending/docs/sdks/codatlendingsalespayments/README.md b/lending/docs/sdks/codatlendingsalespayments/README.md deleted file mode 100644 index c286ffdaf..000000000 --- a/lending/docs/sdks/codatlendingsalespayments/README.md +++ /dev/null @@ -1,507 +0,0 @@ -# Sales.Payments - -## Overview - -### Available Operations - -* [get](#get) - Get payment -* [list](#list) - List payments - -## get - -The *Get payment* endpoint returns a single payment for a given paymentId. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommercePaymentRequest](../../models/operations/getcommercepaymentrequest.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.CommercePayment](../../models/shared/commercepayment.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payments.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.ListCommercePaymentsRequest](../../models/operations/listcommercepaymentsrequest.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.CommercePayments](../../models/shared/commercepayments.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/lending/docs/sdks/codatlendingsuppliers/README.md b/lending/docs/sdks/codatlendingsuppliers/README.md deleted file mode 100644 index ad0da364b..000000000 --- a/lending/docs/sdks/codatlendingsuppliers/README.md +++ /dev/null @@ -1,459 +0,0 @@ -# LoanWriteback.Suppliers - -## Overview - -### Available Operations - -* [create](#create) - Create supplier -* [get_create_update_model](#get_create_update_model) - Get create/update supplier model - -## create - -The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create/update supplier model](https://docs.codat.io/lending-api#/operations/get-create-update-suppliers-model). - - -### Example Usage: Malformed query - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.create(request={ - "accounting_supplier": { - "addresses": [ - { - "city": "Bakersfield", - "country": "USA", - "line1": "Unit 51", - "line2": "Bakersfield Industrial Estate", - "region": "California", - "type": shared.AccountingAddressType.BILLING, - }, - ], - "contact_name": "Kelly's Industrial Supplies", - "default_currency": "string", - "email_address": "sales@kellysupplies.com", - "id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", - "metadata": { - "is_deleted": True, - }, - "modified_date": "2022-10-23T00:00:00Z", - "phone": "07999 999999", - "registration_number": "string", - "source_modified_date": "2022-10-23T00:00:00Z", - "status": shared.SupplierStatus.UNKNOWN, - "supplemental_data": { - "content": { - "property1": { - "property1": "", - "property2": "", - }, - "property2": { - "property1": "", - "property2": "", - }, - }, - }, - "supplier_name": "Kelly's Industrial Supplies", - "tax_number": "string", - }, - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.create(request={ - "accounting_supplier": { - "contact_name": "Joe Bloggs", - "id": "73593", - "status": shared.SupplierStatus.ACTIVE, - "supplier_name": "test 20230420 1004", - }, - "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.CreateSupplierRequest](../../models/operations/createsupplierrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[shared.AccountingCreateSupplierResponse](../../models/shared/accountingcreatesupplierresponse.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_update_model - -The *Get create/update supplier model* endpoint returns the expected data for the request payload when creating and updating a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company and integration. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - - -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.suppliers.get_create_update_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.GetCreateUpdateSuppliersModelRequest](../../models/operations/getcreateupdatesuppliersmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/codatlendingtransactions/README.md b/lending/docs/sdks/codatlendingtransactions/README.md deleted file mode 100644 index ae104e412..000000000 --- a/lending/docs/sdks/codatlendingtransactions/README.md +++ /dev/null @@ -1,360 +0,0 @@ -# Sales.Transactions - -## Overview - -### Available Operations - -* [get](#get) - Get transaction -* [list](#list) - List transactions - -## get - -The *Get transaction* endpoint returns a single transaction for a given transactionId. - -[Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceTransactionRequest](../../models/operations/getcommercetransactionrequest.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.CommerceTransaction](../../models/shared/commercetransaction.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - -[Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.transactions.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.ListCommerceTransactionsRequest](../../models/operations/listcommercetransactionsrequest.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.CommerceTransactions](../../models/shared/commercetransactions.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/lending/docs/sdks/codatlendingtransfers/README.md b/lending/docs/sdks/codatlendingtransfers/README.md deleted file mode 100644 index ad25d3f0c..000000000 --- a/lending/docs/sdks/codatlendingtransfers/README.md +++ /dev/null @@ -1,507 +0,0 @@ -# Transactions.Transfers - -## Overview - -### Available Operations - -* [get](#get) - Get transfer -* [list](#list) - List transfers - -## get - -The *Get transfer* endpoint returns a single transfer for a given transferId. - -[Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transfer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingTransferRequest](../../models/operations/getaccountingtransferrequest.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.AccountingTransfer](../../models/shared/accountingtransfer.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List transfers* endpoint returns a list of [transfers](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - -[Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.transfers.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.ListAccountingTransfersRequest](../../models/operations/listaccountingtransfersrequest.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.AccountingTransfers](../../models/shared/accountingtransfers.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/lending/docs/sdks/companies/README.md b/lending/docs/sdks/companies/README.md index 240d3c52c..c74df904a 100644 --- a/lending/docs/sdks/companies/README.md +++ b/lending/docs/sdks/companies/README.md @@ -1,571 +1,567 @@ -# Companies - -## Overview - -Create and manage your SMB users' companies. - -### Available Operations - -* [create](#create) - Create company -* [delete](#delete) - Delete a company -* [get](#get) - Get company -* [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/lending-api#/schemas/Company) that represents your customer in Codat. - -A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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/lending-api#/schemas/Company), its [connections](https://docs.codat.io/lending-api#/schemas/Connection) and any cached data. This operation is irreversible. - -A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.companies.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Simple company - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.companies.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` -### Example Usage: Subsidiary multi-entity company - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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 | \*/\* | - -## list - -The *List companies* endpoint returns a list of [companies](https://docs.codat.io/lending-api#/schemas/Company) associated to your instances. - -A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. -Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. - -### Example Usage: Unauthorized - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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 +* [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/lending-api#/schemas/Company) that represents your customer in Codat. + +A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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/lending-api#/schemas/Company), its [connections](https://docs.codat.io/lending-api#/schemas/Connection) and any cached data. This operation is irreversible. + +A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Simple company + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.companies.get(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Subsidiary multi-entity company + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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 | \*/\* | + +## list + +The *List companies* endpoint returns a list of [companies](https://docs.codat.io/lending-api#/schemas/Company) associated to your instances. + +A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. +Each company can have multiple [connections](https://docs.codat.io/lending-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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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/lending-api#/schemas/Company) represents a business sharing access to their data. + +### Example Usage: Unauthorized + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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/lending/docs/sdks/companyinfo/README.md b/lending/docs/sdks/companyinfo/README.md index 0f3a82aad..ea2b5cbbb 100644 --- a/lending/docs/sdks/companyinfo/README.md +++ b/lending/docs/sdks/companyinfo/README.md @@ -1,107 +1,107 @@ -# CompanyInfo - -## Overview - -View company information fetched from the source platform. - -### Available Operations - -* [get_accounting_profile](#get_accounting_profile) - Get company accounting profile -* [get_commerce_profile](#get_commerce_profile) - Get company commerce profile - -## get_accounting_profile - -Gets the latest basic info for a company. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.company_info.get_accounting_profile(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingProfileRequest](../../models/operations/getaccountingprofilerequest.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.AccountingCompanyInfo](../../models/shared/accountingcompanyinfo.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_commerce_profile - -Retrieve information about the company, as seen in the commerce -platform. - -This may include information like addresses, tax registration details and -social media or website information." - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.company_info.get_commerce_profile(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.GetCommerceProfileRequest](../../models/operations/getcommerceprofilerequest.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.CommerceCompanyInfo](../../models/shared/commercecompanyinfo.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# CompanyInfo + +## Overview + +View company information fetched from the source platform. + +### Available Operations + +* [get_accounting_profile](#get_accounting_profile) - Get company accounting profile +* [get_commerce_profile](#get_commerce_profile) - Get company commerce profile + +## get_accounting_profile + +Gets the latest basic info for a company. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.company_info.get_accounting_profile(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.GetAccountingProfileRequest](../../models/operations/getaccountingprofilerequest.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.AccountingCompanyInfo](../../models/shared/accountingcompanyinfo.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_commerce_profile + +Retrieve information about the company, as seen in the commerce +platform. + +This may include information like addresses, tax registration details and +social media or website information." + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.company_info.get_commerce_profile(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.GetCommerceProfileRequest](../../models/operations/getcommerceprofilerequest.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.CommerceCompanyInfo](../../models/shared/commercecompanyinfo.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 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/lending/docs/sdks/connections/README.md b/lending/docs/sdks/connections/README.md index 3191b0563..ab464f827 100644 --- a/lending/docs/sdks/connections/README.md +++ b/lending/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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.connections.create(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` +### Example Usage: Unauthorized + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.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/lending/docs/sdks/createoperations/README.md b/lending/docs/sdks/createoperations/README.md deleted file mode 100644 index 4dbf8a182..000000000 --- a/lending/docs/sdks/createoperations/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# LoanWriteback.CreateOperations - -## Overview - -### Available Operations - -* [get](#get) - Get create operation -* [list](#list) - List create operations - -## get - -Retrieve create operation. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.create_operations.get(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 - -List create operations. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.create_operations.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.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/lending/docs/sdks/creditnotes/README.md b/lending/docs/sdks/creditnotes/README.md deleted file mode 100644 index 8834d63a9..000000000 --- a/lending/docs/sdks/creditnotes/README.md +++ /dev/null @@ -1,724 +0,0 @@ -# AccountsReceivable.CreditNotes - -## Overview - -### Available Operations - -* [get](#get) - Get credit note -* [list](#list) - List credit notes - -## get - -The *Get credit note* endpoint returns a single credit note for a given creditNoteId. - -[Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "credit_note_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingCreditNoteRequest](../../models/operations/getaccountingcreditnoterequest.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.AccountingCreditNote](../../models/shared/accountingcreditnote.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List credit notes* endpoint returns a list of [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) for a given company's connection. - -[Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.credit_notes.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.ListAccountingCreditNotesRequest](../../models/operations/listaccountingcreditnotesrequest.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.AccountingCreditNotes](../../models/shared/accountingcreditnotes.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/lending/docs/sdks/customers/README.md b/lending/docs/sdks/customers/README.md deleted file mode 100644 index b4a900be5..000000000 --- a/lending/docs/sdks/customers/README.md +++ /dev/null @@ -1,1068 +0,0 @@ -# AccountsReceivable.Customers - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download customer attachment -* [get](#get) - Get customer -* [get_attachment](#get_attachment) - Get customer attachment -* [list](#list) - List customers -* [list_attachments](#list_attachments) - List customer attachments - -## download_attachment - -The *Download customer attachment* endpoint downloads a specific attachment for a given `customerId` and `attachmentId`. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.DownloadAccountingCustomerAttachmentRequest](../../models/operations/downloadaccountingcustomerattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 - -The *Get customer* endpoint returns a single customer for a given customerId. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingCustomerRequest](../../models/operations/getaccountingcustomerrequest.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.AccountingCustomer](../../models/shared/accountingcustomer.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get customer attachment* endpoint returns a specific attachment for a given `customerId` and `attachmentId`. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingCustomerAttachmentRequest](../../models/operations/getaccountingcustomerattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.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.ListAccountingCustomersRequest](../../models/operations/listaccountingcustomersrequest.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.AccountingCustomers](../../models/shared/accountingcustomers.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 | \*/\* | - -## list_attachments - -The *List customer attachments* endpoint returns a list of attachments avialable to download for given `customerId`. - -[Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.customers.list_attachments(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "customer_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.ListAccountingCustomerAttachmentsRequest](../../models/operations/listaccountingcustomerattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/dataintegrity/README.md b/lending/docs/sdks/dataintegrity/README.md index 9c1f6711f..4f052266a 100644 --- a/lending/docs/sdks/dataintegrity/README.md +++ b/lending/docs/sdks/dataintegrity/README.md @@ -1,168 +1,168 @@ -# DataIntegrity - -## Overview - -Match mutable accounting data with immutable banking data to increase confidence in financial data. - -### Available Operations - -* [details](#details) - List data integrity details -* [status](#status) - Get data integrity status -* [summaries](#summaries) - Get data integrity summaries - -## details - -The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results. - -The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.data_integrity.details(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "data_type": shared.DataIntegrityDataType.BANKING_ACCOUNTS, - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.ListDataIntegrityDetailsRequest](../../models/operations/listdataintegritydetailsrequest.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.DataIntegrityDetails](../../models/shared/dataintegritydetails.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 | \*/\* | - -## status - -The *Get data integrity status* endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/DataIntegrityStatus) for the company’s match results between the data type provided in the URL and other data types that Data Integrity uses to support matching. -This endpoint helps you understand whether match data is available and, if so, how to usefully query it. - -The response tells you: - -- Whether match results are available. -- When the results were generated, and their status. -- The connection IDs, amounts, and dates involved to support useful querying. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.data_integrity.status(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "data_type": shared.DataIntegrityDataType.BANKING_ACCOUNTS, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetDataIntegrityStatusRequest](../../models/operations/getdataintegritystatusrequest.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.DataIntegrityStatuses](../../models/shared/dataintegritystatuses.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 | \*/\* | - -## summaries - -The *Get data integrity summary* endpoint returns a [summary](https://docs.codat.io/lending-api#/schemas/DataIntegritySummary) of match results for a given data type filtered by a query string in the [Codat query language](https://docs.codat.io/using-the-api/querying). - -For example, if you wanted to see summary match results only for transactions after 1 December 2020, you could include a query parameter of `query=date>2020-12-01`. - -The endpoint response includes only the summary results, not transactions. To view match data for transactions, use the [List data integrity details](https://docs.codat.io/lending-api#/operations/get-data-integrity-summaries) endpoint. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.data_integrity.summaries(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "data_type": shared.DataIntegrityDataType.BANKING_ACCOUNTS, - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetDataIntegritySummariesRequest](../../models/operations/getdataintegritysummariesrequest.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.DataIntegritySummaries](../../models/shared/dataintegritysummaries.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# DataIntegrity + +## Overview + +Match mutable accounting data with immutable banking data to increase confidence in financial data. + +### Available Operations + +* [details](#details) - List data integrity details +* [status](#status) - Get data integrity status +* [summaries](#summaries) - Get data integrity summaries + +## details + +The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results. + +The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.data_integrity.details(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "data_type": "banking-accounts", + "order_by": "-modifiedDate", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `request` | [operations.ListDataIntegrityDetailsRequest](../../models/operations/listdataintegritydetailsrequest.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.DataIntegrityDetails](../../models/shared/dataintegritydetails.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 | \*/\* | + +## status + +The *Get data integrity status* endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/DataIntegrityStatus) for the company’s match results between the data type provided in the URL and other data types that Data Integrity uses to support matching. +This endpoint helps you understand whether match data is available and, if so, how to usefully query it. + +The response tells you: + +- Whether match results are available. +- When the results were generated, and their status. +- The connection IDs, amounts, and dates involved to support useful querying. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.data_integrity.status(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "data_type": "banking-accounts", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetDataIntegrityStatusRequest](../../models/operations/getdataintegritystatusrequest.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.DataIntegrityStatuses](../../models/shared/dataintegritystatuses.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 | \*/\* | + +## summaries + +The *Get data integrity summary* endpoint returns a [summary](https://docs.codat.io/lending-api#/schemas/DataIntegritySummary) of match results for a given data type filtered by a query string in the [Codat query language](https://docs.codat.io/using-the-api/querying). + +For example, if you wanted to see summary match results only for transactions after 1 December 2020, you could include a query parameter of `query=date>2020-12-01`. + +The endpoint response includes only the summary results, not transactions. To view match data for transactions, use the [List data integrity details](https://docs.codat.io/lending-api#/operations/get-data-integrity-summaries) endpoint. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.data_integrity.summaries(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "data_type": "banking-accounts", + "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetDataIntegritySummariesRequest](../../models/operations/getdataintegritysummariesrequest.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.DataIntegritySummaries](../../models/shared/dataintegritysummaries.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/lending/docs/sdks/directcosts/README.md b/lending/docs/sdks/directcosts/README.md deleted file mode 100644 index d53485026..000000000 --- a/lending/docs/sdks/directcosts/README.md +++ /dev/null @@ -1,642 +0,0 @@ -# LoanWriteback.DirectCosts - -## Overview - -### Available Operations - -* [create](#create) - Create direct cost -* [get_create_model](#get_create_model) - Get create direct cost model - -## create - -The *Create direct cost* endpoint creates a new [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create direct cost model](https://docs.codat.io/lending-api#/operations/get-create-directCosts-model). - -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_prototype": { - "currency": "GBP", - "issue_date": "2023-02-12", - "line_items": [ - { - "account_ref": { - "id": "288", - }, - "quantity": Decimal("1"), - "sub_total": Decimal("15"), - "unit_amount": Decimal("15"), - }, - ], - "payment_allocations": [ - { - "allocation": {}, - "payment": { - "account_ref": { - "id": "750-1", - }, - }, - }, - ], - "sub_total": Decimal("15"), - "tax_amount": Decimal("0"), - "total_amount": Decimal("15"), - }, - }) - - # Handle response - print(res) - -``` -### Example Usage: Malformed query - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_prototype": { - "currency": "GBP", - "issue_date": "2022-10-23T00:00:00Z", - "line_items": [ - { - "quantity": Decimal("2124.3"), - "tracking": { - "invoice_to": { - "data_type": "journalEntry", - }, - "record_refs": [], - }, - "unit_amount": Decimal("1861.66"), - }, - ], - "payment_allocations": [ - { - "allocation": { - "allocated_on_date": "2022-10-23T00:00:00Z", - "currency": "GBP", - }, - "payment": { - "currency": "GBP", - "paid_on_date": "2022-10-23T00:00:00Z", - }, - }, - ], - "sub_total": Decimal("3566.34"), - "tax_amount": Decimal("7664.68"), - "total_amount": Decimal("208.93"), - }, - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_prototype": { - "contact_ref": { - "data_type": shared.ContactRefDataType.SUPPLIERS, - "id": "80000001-1671793885", - }, - "currency": "USD", - "issue_date": "2023-03-21T10:19:52.223Z", - "line_items": [ - { - "account_ref": { - "id": "8000000D-1671793811", - "name": "Purchases - Hardware for Resale", - }, - "description": "test description line 1", - "discount_amount": Decimal("0"), - "discount_percentage": Decimal("0"), - "item_ref": { - "id": "80000001-1674566705", - "name": "item test", - }, - "quantity": Decimal("1"), - "sub_total": Decimal("99"), - "tax_amount": Decimal("360"), - "total_amount": Decimal("70"), - "tracking_category_refs": [ - { - "id": "80000001-1674553252", - "name": "Class 1", - }, - ], - "unit_amount": Decimal("7"), - }, - ], - "note": "directCost 21/03 09.20", - "payment_allocations": [ - { - "allocation": { - "allocated_on_date": "2023-01-29T10:19:52.223Z", - "currency_rate": Decimal("0"), - "total_amount": Decimal("88"), - }, - "payment": { - "account_ref": { - "id": "80000028-1671794219", - "name": "Bank Account 1", - }, - "note": "payment allocations note", - "paid_on_date": "2023-01-28T10:19:52.223Z", - "reference": "payment allocations reference", - "total_amount": Decimal("54"), - }, - }, - ], - "reference": "test ref", - "sub_total": Decimal("362"), - "tax_amount": Decimal("4"), - "total_amount": Decimal("366"), - }, - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_prototype": { - "currency": "USD", - "currency_rate": Decimal("0.5"), - "issue_date": "2023-03-31T00:00:00", - "line_items": [ - { - "account_ref": { - "id": "195", - }, - "quantity": Decimal("1"), - "sub_total": Decimal("9.99"), - "tax_amount": Decimal("2"), - "total_amount": Decimal("11.99"), - "unit_amount": Decimal("9.99"), - }, - ], - "note": "Test 1", - "payment_allocations": [ - { - "allocation": { - "allocated_on_date": "2023-03-31T00:00:00", - "currency": "USD", - "total_amount": Decimal("11.99"), - }, - "payment": { - "account_ref": { - "id": "348", - "name": "CMRR Renewal", - }, - "currency": "USD", - "id": "4355", - "note": "test note", - "paid_on_date": "2023-03-31T00:00:00", - "reference": "test reference", - "total_amount": Decimal("11.99"), - }, - }, - ], - "reference": "test ref", - "sub_total": Decimal("9.99"), - "tax_amount": Decimal("2"), - "total_amount": Decimal("11.99"), - }, - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.create(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_cost_prototype": { - "contact_ref": { - "data_type": shared.ContactRefDataType.SUPPLIERS, - "id": "699f0091-b127-4796-9f15-41a2f42abeb2", - }, - "currency": "GBP", - "issue_date": "2023-02-25", - "line_items": [ - { - "description": "negative direct cost", - "item_ref": { - "id": "965cfc0e-4d80-4059-9641-4a392f9ad549", - }, - "quantity": Decimal("-1"), - "sub_total": Decimal("-35"), - "tax_amount": Decimal("-7"), - "tax_rate_ref": { - "id": "INPUT2", - }, - "total_amount": Decimal("-42"), - "unit_amount": Decimal("35"), - }, - ], - "payment_allocations": [ - { - "allocation": { - "total_amount": Decimal("-42"), - }, - "payment": { - "account_ref": { - "id": "bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4", - }, - "currency": "GBP", - }, - }, - ], - "reference": "Scenario One neg DC", - "sub_total": Decimal("-35"), - "tax_amount": Decimal("-7"), - "total_amount": Decimal("-42"), - }, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `request` | [operations.CreateDirectCostRequest](../../models/operations/createdirectcostrequest.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.AccountingCreateDirectCostResponse](../../models/shared/accountingcreatedirectcostresponse.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 direct cost model* endpoint returns the expected data for the request payload when creating a [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company and integration. - -[Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - - -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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 - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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 Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.direct_costs.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.GetCreateDirectCostsModelRequest](../../models/operations/getcreatedirectcostsmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/directincomes/README.md b/lending/docs/sdks/directincomes/README.md deleted file mode 100644 index 6a6b0e721..000000000 --- a/lending/docs/sdks/directincomes/README.md +++ /dev/null @@ -1,613 +0,0 @@ -# AccountsReceivable.DirectIncomes - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download direct income attachment -* [get](#get) - Get direct income -* [get_attachment](#get_attachment) - Get direct income attachment -* [list](#list) - List direct incomes -* [list_attachments](#list_attachments) - List direct income attachments - -## download_attachment - -The *Download direct income attachment* endpoint downloads a specific attachment for a given `directIncomeId` and `attachmentId`. - -[Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.DownloadAccountingDirectIncomeAttachmentRequest](../../models/operations/downloadaccountingdirectincomeattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 - -The *Get direct income* endpoint returns a single direct income for a given directIncomeId. - -[Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingDirectIncomeRequest](../../models/operations/getaccountingdirectincomerequest.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.AccountingDirectIncome](../../models/shared/accountingdirectincome.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get direct income attachment* endpoint returns a specific attachment for a given `directIncomeId` and `attachmentId`. - -[Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingDirectIncomeAttachmentRequest](../../models/operations/getaccountingdirectincomeattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 direct incomes* endpoint returns a list of [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) for a given company's connection. - -[Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.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.ListAccountingDirectIncomesRequest](../../models/operations/listaccountingdirectincomesrequest.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.AccountingDirectIncomes](../../models/shared/accountingdirectincomes.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 | \*/\* | - -## list_attachments - -The *List direct income attachments* endpoint returns a list of attachments available to download for given `directIncomeId`. - -[Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.direct_incomes.list_attachments(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "direct_income_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.ListAccountingDirectIncomeAttachmentsRequest](../../models/operations/listaccountingdirectincomeattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/disputes/README.md b/lending/docs/sdks/disputes/README.md deleted file mode 100644 index d25230845..000000000 --- a/lending/docs/sdks/disputes/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Sales.Disputes - -## Overview - -### Available Operations - -* [get](#get) - Get dispute -* [list](#list) - List disputes - -## get - -The *Get dispute* endpoint returns a single dispute for a given disputeId. - -[Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.disputes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "dispute_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.disputes.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "dispute_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceDisputeRequest](../../models/operations/getcommercedisputerequest.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.CommerceDispute](../../models/shared/commercedispute.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List disputes* endpoint returns a list of [disputes](https://docs.codat.io/lending-api#/schemas/Dispute) for a given company's connection. - -[Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.disputes.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: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.disputes.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.ListCommerceDisputesRequest](../../models/operations/listcommercedisputesrequest.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.CommerceDisputes](../../models/shared/commercedisputes.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/lending/docs/sdks/excelreports/README.md b/lending/docs/sdks/excelreports/README.md index d777783d1..7ffb5023c 100644 --- a/lending/docs/sdks/excelreports/README.md +++ b/lending/docs/sdks/excelreports/README.md @@ -1,176 +1,173 @@ -# ExcelReports - -## Overview - -Download reports in Excel format. - -### Available Operations - -* [download](#download) - Download Excel report -* [generate](#generate) - Generate Excel report -* [get_status](#get_status) - Get Excel report status - -## download - -The *Download Excel report* endpoint downloads the latest successfully generated Excel report of a specified report type for a given company. - -The downloadable Excel file is returned in the response. You can save it to your local machine. - -You can [learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.excel_reports.download(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_type": shared.ExcelReportTypes.ENHANCED_CASH_FLOW, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.DownloadExcelReportRequest](../../models/operations/downloadexcelreportrequest.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 - -**[bytes](../../models/.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 | \*/\* | - -## generate - -The *Generate Excel report* endpoint requests the production of a downloadable Excel file for a report type specified in the `reportType` query parameter. - -In response, the endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/ExcelStatus) detailing the current state of the report generation request. - -### Report types - -| reportType | Description | -|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| -| `audit` | Identifies inaccurate or out-of-date accounts, helping you to make decisions with confidence. || [audit](https://docs.codat.io/lending/excel/audit-report) | Identify inaccurate or out-of-date accounts, helping you to make decisions with confidence. | -| `enhancedCashFlow` | Provides a fully categorized list of bank transactions for a company, allowing lenders to accurately forecast a company's cash flow. | -| `enhancedFinancials` | Supports decision-making using fully categorized financial statements to allow lenders to automate their underwriting processes. | -| `enhancedInvoices` | Helps verify that payments have been made against historic invoices. Great for invoice finance lenders. | - -[Learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - - - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.excel_reports.generate(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_type": shared.ExcelReportTypes.ENHANCED_FINANCIALS, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.GenerateExcelReportRequest](../../models/operations/generateexcelreportrequest.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.ExcelStatus](../../models/shared/excelstatus.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_status - -The *Get Excel report status* returns the status of the report mostly recently requested for Excel generation. It does not return the status of any historical report requests. - -Poll this endpoint to check the progress of the report once you have requested its generation. This will not affect the generation of the report. - -When the report generation completes successfully, the `inProgress` property will be marked as `false` and the `success` field will be marked as `true`. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.excel_reports.get_status(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_type": shared.ExcelReportTypes.ENHANCED_CASH_FLOW, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetExcelReportGenerationStatusRequest](../../models/operations/getexcelreportgenerationstatusrequest.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.ExcelStatus](../../models/shared/excelstatus.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# ExcelReports + +## Overview + +Download reports in Excel format. + +### Available Operations + +* [download](#download) - Download Excel report +* [generate](#generate) - Generate Excel report +* [get_status](#get_status) - Get Excel report status + +## download + +The *Download Excel report* endpoint downloads the latest successfully generated Excel report of a specified report type for a given company. + +The downloadable Excel file is returned in the response. You can save it to your local machine. + +You can [learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.excel_reports.download(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.DownloadExcelReportRequest](../../models/operations/downloadexcelreportrequest.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 + +**[bytes](../../models/.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 | \*/\* | + +## generate + +The *Generate Excel report* endpoint requests the production of a downloadable Excel file for a report type specified in the `reportType` query parameter. + +In response, the endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/ExcelStatus) detailing the current state of the report generation request. + +### Report types + +| reportType | Description | +|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| +| `audit` | Identifies inaccurate or out-of-date accounts, helping you to make decisions with confidence. || [audit](https://docs.codat.io/lending/excel/audit-report) | Identify inaccurate or out-of-date accounts, helping you to make decisions with confidence. | +| `enhancedCashFlow` | Provides a fully categorized list of bank transactions for a company, allowing lenders to accurately forecast a company's cash flow. | +| `enhancedFinancials` | Supports decision-making using fully categorized financial statements to allow lenders to automate their underwriting processes. | +| `enhancedInvoices` | Helps verify that payments have been made against historic invoices. Great for invoice finance lenders. | + +[Learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. + + + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.excel_reports.generate(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.GenerateExcelReportRequest](../../models/operations/generateexcelreportrequest.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.ExcelStatus](../../models/shared/excelstatus.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_status + +The *Get Excel report status* returns the status of the report mostly recently requested for Excel generation. It does not return the status of any historical report requests. + +Poll this endpoint to check the progress of the report once you have requested its generation. This will not affect the generation of the report. + +When the report generation completes successfully, the `inProgress` property will be marked as `false` and the `success` field will be marked as `true`. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.excel_reports.get_status(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GetExcelReportGenerationStatusRequest](../../models/operations/getexcelreportgenerationstatusrequest.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.ExcelStatus](../../models/shared/excelstatus.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/lending/docs/sdks/fileupload/README.md b/lending/docs/sdks/fileupload/README.md index 82aea7981..bd680db24 100644 --- a/lending/docs/sdks/fileupload/README.md +++ b/lending/docs/sdks/fileupload/README.md @@ -1,152 +1,152 @@ -# FileUpload - -## Overview - -Endpoints to manage uploaded files. - -### Available Operations - -* [download](#download) - Download all files for a company -* [list_uploaded](#list_uploaded) - List all files uploaded by a company -* [upload](#upload) - Upload files for a company - -## download - -The *Download files* endpoint downloads all files that have been uploaded by to SMB to Codat. A `date` may be specified to download any files uploaded on the date provided. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.file_upload.download(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "date_": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `request` | [operations.DownloadFilesRequest](../../models/operations/downloadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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_uploaded - -The *List files* endpoint returns a list of all files uploaded to Codat by the SMB. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.file_upload.list_uploaded(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `request` | [operations.ListFilesRequest](../../models/operations/listfilesrequest.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.File]](../../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 | \*/\* | - -## upload - -The *Upload files* endpoint uploads multiple files provided by the SMB to Codat. This may include personal identity documents, pitch decks, contracts, or files with accounting and banking data. - -Uploaded files must meet the following requirements: - -- Up to 20 files can be uploaded at a time. -- PDF, XLS, XLSX, XLSB, CSV, DOC, DOCX, PPT, PPTX, JPEG, JPG, and PNG files can be uploaded. -- Each file can be up to 10MB in size. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.file_upload.upload(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.UploadFilesRequest](../../models/operations/uploadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# FileUpload + +## Overview + +Endpoints to manage uploaded files. + +### Available Operations + +* [download](#download) - Download all files for a company +* [list_uploaded](#list_uploaded) - List all files uploaded by a company +* [upload](#upload) - Upload files for a company + +## download + +The *Download files* endpoint downloads all files that have been uploaded by to SMB to Codat. A `date` may be specified to download any files uploaded on the date provided. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.file_upload.download(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "date": "2022-10-23T00:00:00Z", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.DownloadFilesRequest](../../models/operations/downloadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[httpx.Response](../../models/data.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_uploaded + +The *List files* endpoint returns a list of all files uploaded to Codat by the SMB. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.file_upload.list_uploaded(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `request` | [operations.ListFilesRequest](../../models/operations/listfilesrequest.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.File]](../../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 | \*/\* | + +## upload + +The *Upload files* endpoint uploads multiple files provided by the SMB to Codat. This may include personal identity documents, pitch decks, contracts, or files with accounting and banking data. + +Uploaded files must meet the following requirements: + +- Up to 20 files can be uploaded at a time. +- PDF, XLS, XLSX, XLSB, CSV, DOC, DOCX, PPT, PPTX, JPEG, JPG, and PNG files can be uploaded. +- Each file can be up to 10MB in size. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.file_upload.upload(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.UploadFilesRequest](../../models/operations/uploadfilesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | | errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/lending/docs/sdks/financialstatements/README.md b/lending/docs/sdks/financialstatements/README.md new file mode 100644 index 000000000..6d95f36d6 --- /dev/null +++ b/lending/docs/sdks/financialstatements/README.md @@ -0,0 +1,5 @@ +# FinancialStatements + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/financialsummary/README.md b/lending/docs/sdks/financialsummary/README.md new file mode 100644 index 000000000..f19abccf0 --- /dev/null +++ b/lending/docs/sdks/financialsummary/README.md @@ -0,0 +1,119 @@ +# FinancialSummary + +## Overview + +View financial summary information for a company, including credit model reports and accounting score. + +### Available Operations + +* [download_credit_model_excel](#download_credit_model_excel) - Download credit model Excel +* [get_financial_summary](#get_financial_summary) - Get financial summary insights + +## download_credit_model_excel + +> **Available as beta release** +> +> This endpoint is part of a beta release. Please contact your account manager if you want to enable it. + +Use the *Download Credit Model Excel* endpoint to download the credit model Excel file. + +Before using it, you must call the [Generate report](https://docs.codat.io/lending-api#/operations/generate-report) endpoint of type `creditModel`. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.financial_summary.download_credit_model_excel(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "max_age": "2022-10-23T00:00:00Z", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `request` | [operations.DownloadCreditModelExcelRequest](../../models/operations/downloadcreditmodelexcelrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[httpx.Response](../../models/data.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_financial_summary + +> **Available as beta release** +> +> This endpoint is part of a beta release. Please contact your account manager if you want to enable it. + +Financial summary insights provide high-level indicators about the accuracy and completeness of a business’s financial data. These insights include: +- Closed Books Indicator – An estimate of the most recent accounting period officially closed by a business +- Accounting Score – An evaluation of the quality and completeness of a business’s bookkeeping + +Before accessing this endpoint, you must call the [Generate report](https://docs.codat.io/lending-api#/operations/generate-report) endpoint of type `creditModel`. + +> Please note that missing elements might be disabled for the account. Please contact account manager for more details. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.financial_summary.get_financial_summary(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.GetFinancialSummaryRequest](../../models/operations/getfinancialsummaryrequest.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.FinancialSummary](../../models/shared/financialsummary.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/lending/docs/sdks/invoices/README.md b/lending/docs/sdks/invoices/README.md deleted file mode 100644 index bee1f8cb3..000000000 --- a/lending/docs/sdks/invoices/README.md +++ /dev/null @@ -1,1180 +0,0 @@ -# AccountsReceivable.Invoices - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download invoice attachment -* [download_pdf](#download_pdf) - Get invoice as PDF -* [get](#get) - Get invoice -* [get_attachment](#get_attachment) - Get invoice attachment -* [list](#list) - List invoices -* [list_attachments](#list_attachments) - List invoice attachments -* [list_reconciled](#list_reconciled) - List reconciled invoices - -## download_attachment - -The *Download invoice attachment* endpoint downloads a specific attachment for a given `invoiceId` and `attachmentId`. - -[Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.DownloadAccountingInvoiceAttachmentRequest](../../models/operations/downloadaccountinginvoiceattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 | \*/\* | - -## download_pdf - -Download invoice as a pdf. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.download_pdf(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.DownloadAccountingInvoicePdfRequest](../../models/operations/downloadaccountinginvoicepdfrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get - -The *Get invoice* endpoint returns a single invoice for a given invoiceId. - -[Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - -### Tips and traps - -To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingInvoiceRequest](../../models/operations/getaccountinginvoicerequest.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.AccountingInvoice](../../models/shared/accountinginvoice.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get invoice attachment* endpoint returns a specific attachment for a given `invoiceId` and `attachmentId`. - -[Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingInvoiceAttachmentRequest](../../models/operations/getaccountinginvoiceattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 invoices* endpoint returns a list of [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for a given company's connection. - -[Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - -### Useful queries - -- Outstanding invoices - `query = amountDue > 0` -- Invoices due after a certain date: `query = dueDate > 2021-01-28` - -[Read more about querying](https://docs.codat.io/using-the-api/querying). - -### Tips and traps - -To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.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.ListAccountingInvoicesRequest](../../models/operations/listaccountinginvoicesrequest.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.AccountingInvoices](../../models/shared/accountinginvoices.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 | \*/\* | - -## list_attachments - -The *List invoice attachments* endpoint returns a list of attachments available to download for given `invoiceId`. - -[Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list_attachments(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "invoice_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.ListAccountingInvoiceAttachmentsRequest](../../models/operations/listaccountinginvoiceattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list_reconciled - -Gets a list of invoices linked to the corresponding banking transaction - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.invoices.list_reconciled(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `request` | [operations.ListReconciledInvoicesRequest](../../models/operations/listreconciledinvoicesrequest.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.EnhancedInvoicesReport](../../models/shared/enhancedinvoicesreport.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/lending/docs/sdks/journalentries/README.md b/lending/docs/sdks/journalentries/README.md deleted file mode 100644 index 6391c3d2d..000000000 --- a/lending/docs/sdks/journalentries/README.md +++ /dev/null @@ -1,677 +0,0 @@ -# Transactions.JournalEntries - -## Overview - -### Available Operations - -* [get](#get) - Get journal entry -* [list](#list) - List journal entries - -## get - -The *Get journal entry* endpoint returns a single journal entry for a given journalEntryId. - -[Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_entry_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingJournalEntryRequest](../../models/operations/getaccountingjournalentryrequest.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.AccountingJournalEntry](../../models/shared/accountingjournalentry.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List journal entries* endpoint returns a list of [journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) for a given company's connection. - -[Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journal_entries.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.ListAccountingJournalEntriesRequest](../../models/operations/listaccountingjournalentriesrequest.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.AccountingJournalEntries](../../models/shared/accountingjournalentries.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/lending/docs/sdks/journals/README.md b/lending/docs/sdks/journals/README.md deleted file mode 100644 index 22b6375e7..000000000 --- a/lending/docs/sdks/journals/README.md +++ /dev/null @@ -1,301 +0,0 @@ -# Transactions.Journals - -## Overview - -### Available Operations - -* [get](#get) - Get journal -* [list](#list) - List journals - -## get - -The *Get journal* endpoint returns a single journal for a given journalId. - -[Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "journal_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingJournalRequest](../../models/operations/getaccountingjournalrequest.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.AccountingJournal](../../models/shared/accountingjournal.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List journals* endpoint returns a list of [journals](https://docs.codat.io/lending-api#/schemas/Journal) for a given company's connection. - -[Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.transactions.journals.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.ListAccountingJournalsRequest](../../models/operations/listaccountingjournalsrequest.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.AccountingJournals](../../models/shared/accountingjournals.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/lending/docs/sdks/liabilities/README.md b/lending/docs/sdks/liabilities/README.md index 35f859cdf..cb68f26cf 100644 --- a/lending/docs/sdks/liabilities/README.md +++ b/lending/docs/sdks/liabilities/README.md @@ -1,210 +1,206 @@ -# Liabilities - -## Overview - -Debt and other liabilities. - -### Available Operations - -* [generate_loan_summary](#generate_loan_summary) - Generate loan summaries report -* [generate_loan_transactions](#generate_loan_transactions) - Generate loan transactions report -* [get_loan_summary](#get_loan_summary) - Get loan summaries -* [list_loan_transactions](#list_loan_transactions) - List loan transactions - -## generate_loan_summary - -The _Generate loan summaries_ endpoint requests the generation of the Loan Summaries report. - -Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - -Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.liabilities.generate_loan_summary(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "source_type": operations.SourceType.ACCOUNTING, - }) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.GenerateLoanSummaryRequest](../../models/operations/generateloansummaryrequest.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_loan_transactions - -The _Generate loan transactions_ endpoint requests the generation of the Loan Transactions report. - -Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - -Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.liabilities.generate_loan_transactions(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "source_type": operations.QueryParamSourceType.COMMERCE, - }) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GenerateLoanTransactionsRequest](../../models/operations/generateloantransactionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_loan_summary - -The *Get loan summaries* endpoint returns a summary by integration type of all loans identified from a company's accounting, banking, and commerce integrations. - -The endpoint returns a list of a company's [loan summaries](https://docs.codat.io/lending-api#/schemas/LoanSummary) for each valid data connection. - -Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.liabilities.get_loan_summary(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "source_type": operations.GetLoanSummaryQueryParamSourceType.ACCOUNTING, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `request` | [operations.GetLoanSummaryRequest](../../models/operations/getloansummaryrequest.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.LoanSummary](../../models/shared/loansummary.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_loan_transactions - -The *List loan transactions* endpoint returns all [loan transactions](https://docs.codat.io/lending-api#/schemas/LoanTransactions) identified from a company's accounting, banking, and commerce integrations. - -This detail gives analysts a better idea of the loan obligations a company may have. - -Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.liabilities.list_loan_transactions(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "source_type": operations.ListLoanTransactionsQueryParamSourceType.COMMERCE, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.ListLoanTransactionsRequest](../../models/operations/listloantransactionsrequest.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.LoanTransactions](../../models/shared/loantransactions.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# Liabilities + +## Overview + +Debt and other liabilities. + +### Available Operations + +* [generate_loan_summary](#generate_loan_summary) - Generate loan summaries report +* [generate_loan_transactions](#generate_loan_transactions) - Generate loan transactions report +* [get_loan_summary](#get_loan_summary) - Get loan summaries +* [list_loan_transactions](#list_loan_transactions) - List loan transactions + +## generate_loan_summary + +The _Generate loan summaries_ endpoint requests the generation of the Loan Summaries report. + +Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). + +Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.liabilities.generate_loan_summary(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `request` | [operations.GenerateLoanSummaryRequest](../../models/operations/generateloansummaryrequest.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_loan_transactions + +The _Generate loan transactions_ endpoint requests the generation of the Loan Transactions report. + +Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). + +Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + cl_client.liabilities.generate_loan_transactions(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Use the SDK ... + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `request` | [operations.GenerateLoanTransactionsRequest](../../models/operations/generateloantransactionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------- | ---------------------------- | ---------------------------- | +| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | +| errors.ErrorMessage | 500, 503 | application/json | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## get_loan_summary + +The *Get loan summaries* endpoint returns a summary by integration type of all loans identified from a company's accounting, banking, and commerce integrations. + +The endpoint returns a list of a company's [loan summaries](https://docs.codat.io/lending-api#/schemas/LoanSummary) for each valid data connection. + +Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.liabilities.get_loan_summary(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `request` | [operations.GetLoanSummaryRequest](../../models/operations/getloansummaryrequest.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.LoanSummary](../../models/shared/loansummary.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_loan_transactions + +The *List loan transactions* endpoint returns all [loan transactions](https://docs.codat.io/lending-api#/schemas/LoanTransactions) identified from a company's accounting, banking, and commerce integrations. + +This detail gives analysts a better idea of the loan obligations a company may have. + +Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.liabilities.list_loan_transactions(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `request` | [operations.ListLoanTransactionsRequest](../../models/operations/listloantransactionsrequest.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.LoanTransactions](../../models/shared/loantransactions.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/lending/docs/sdks/loanwriteback/README.md b/lending/docs/sdks/loanwriteback/README.md new file mode 100644 index 000000000..c08103ad6 --- /dev/null +++ b/lending/docs/sdks/loanwriteback/README.md @@ -0,0 +1,5 @@ +# LoanWriteback + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/locations/README.md b/lending/docs/sdks/locations/README.md deleted file mode 100644 index 1cd7b1196..000000000 --- a/lending/docs/sdks/locations/README.md +++ /dev/null @@ -1,254 +0,0 @@ -# Sales.Locations - -## Overview - -### Available Operations - -* [get](#get) - Get location -* [list](#list) - List locations - -## get - -The *Get location* endpoint returns a single location for a given locationId. - -[Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "location_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "location_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "location_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "location_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceLocationRequest](../../models/operations/getcommercelocationrequest.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.CommerceLocation](../../models/shared/commercelocation.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List locations* endpoint returns a list of [locations](https://docs.codat.io/lending-api#/schemas/Location) for a given company's connection. - -[Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.locations.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.ListCommerceLocationsRequest](../../models/operations/listcommercelocationsrequest.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.CommerceLocations](../../models/shared/commercelocations.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/managedata/README.md b/lending/docs/sdks/managedata/README.md index 54e153c37..d9ee1dde0 100644 --- a/lending/docs/sdks/managedata/README.md +++ b/lending/docs/sdks/managedata/README.md @@ -1,53 +1,53 @@ -# ManageData - -## Overview - -### Available Operations - -* [get_status](#get_status) - Get data status - -## get_status - -Get the state of each data type for a company - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_data.get_status(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `request` | [operations.GetDataStatusRequest](../../models/operations/getdatastatusrequest.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.GetDataStatusDataStatuses](../../models/operations/getdatastatusdatastatuses.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ----------------------- | ----------------------- | ----------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# ManageData + +## Overview + +### Available Operations + +* [get_status](#get_status) - Get data status + +## get_status + +Get the state of each data type for a company + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.manage_data.get_status(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `request` | [operations.GetDataStatusRequest](../../models/operations/getdatastatusrequest.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.GetDataStatusDataStatuses](../../models/operations/getdatastatusdatastatuses.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/lending/docs/sdks/managereports/README.md b/lending/docs/sdks/managereports/README.md index 4dccbcd94..9f4ca1753 100644 --- a/lending/docs/sdks/managereports/README.md +++ b/lending/docs/sdks/managereports/README.md @@ -1,107 +1,158 @@ -# ManageReports - -## Overview - -Generate and review generated reports for a company. - -### Available Operations - -* [generate_report](#generate_report) - Generate report -* [list_reports](#list_reports) - List reports - -## generate_report - -Use the *Generate report* endpoint to initiate the generation of a report specified by the `reportType` parameter. - -This action triggers the system to refresh and pull the necessary data from the company's data sources to ensure the report contains the most up-to-date information. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_reports.generate_report(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_type": shared.ReportType.CATEGORIZED_BANK_STATEMENT, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `request` | [operations.GenerateReportRequest](../../models/operations/generatereportrequest.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.ReportOperation](../../models/shared/reportoperation.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 | \*/\* | - -## list_reports - -Use the *List reports* endpoint to return details (such as generation's current status, date of request, and date of generation) about all reports generated for a company. The query parameter can be used to filter the results. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_reports.list_reports(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.ListReportsRequest](../../models/operations/listreportsrequest.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.Reports](../../models/shared/reports.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | +# ManageReports + +## Overview + +Generate and review generated reports for a company. + +### Available Operations + +* [generate_report](#generate_report) - Generate report +* [get_report_status](#get_report_status) - Get report status +* [list_reports](#list_reports) - List reports + +## generate_report + +Use the *Generate report* endpoint to initiate the generation of a report specified by the `reportType` parameter. + +This action triggers the system to refresh and pull the necessary data from the company's data sources to ensure the report contains the most up-to-date information. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.manage_reports.generate_report(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `request` | [operations.GenerateReportRequest](../../models/operations/generatereportrequest.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.ReportOperation](../../models/shared/reportoperation.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 | \*/\* | + +## get_report_status + +Use the *Get report status* endpoint to return the metadata about report generation, such as its current status, date of request, and date of generation. + +You can either provide the ID of a report or use `latest` as the ID value to get the most recent generated *reportName* report for the company. + + + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.manage_reports.get_report_status(request={ + "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", + "max_age": "2022-10-23T00:00:00Z", + }) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `request` | [operations.GetReportStatusRequest](../../models/operations/getreportstatusrequest.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.ReportOperation](../../models/shared/reportoperation.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_reports + +Use the *List reports* endpoint to return details (such as generation's current status, date of request, and date of generation) about all reports generated for a company. The query parameter can be used to filter the results. + +### Example Usage + + +```python +from codat_lending import CodatLending +from codat_lending.models import shared + + +with CodatLending( + security=shared.Security( + auth_header="Basic BASE_64_ENCODED(API_KEY)", + ), +) as cl_client: + + res = cl_client.manage_reports.list_reports(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.ListReportsRequest](../../models/operations/listreportsrequest.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.Reports](../../models/shared/reports.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/lending/docs/sdks/metrics/README.md b/lending/docs/sdks/metrics/README.md deleted file mode 100644 index 92f2b60ff..000000000 --- a/lending/docs/sdks/metrics/README.md +++ /dev/null @@ -1,231 +0,0 @@ -# Sales.Metrics - -## Overview - -### Available Operations - -* [get_customer_retention](#get_customer_retention) - Get customer retention metrics -* [get_lifetime_value](#get_lifetime_value) - Get lifetime value metrics -* [get_revenue](#get_revenue) - Get commerce revenue metrics - -## get_customer_retention - -The *Get customer retention metrics* endpoint returns customer retention insights for a specific company's commerce connection over one or more periods of time. - -This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - -#### Customer retention metrics - -- __Existing customers__: the number of unique customers that have placed an order(s) in the specified period and any previous period. -- __New customers__: the number of unique customers that have placed an order(s) in the specified period and none in any previous period. -- __Total customers__: the total number of existing and new customers within the specified period. -- __Retention rate__: the ratio of existing customers within the specified period compared to the total customers at the end of the previous period represented as a percentage. -- __Repeat rate__: the ratio of existing customers to total customers over the specified period represented as a percentage. - -[Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate customer retention metrics. - -#### Response structure - -The Customer retention report's dimensions and measures are: - -| Index | Dimensions | -|-----------------------------|----------------------------| -| `index` = 0 | Period | -| `index` = 1 | Customer retention metrics | - -| Index | Measures | -|----------------------|------------| -| `index` = 0 | Count | -| `index` = 1 | Percentage | - -The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.metrics.get_customer_retention(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "number_of_periods": 292320, - "period_length": 555812, - "period_unit": shared.PeriodUnit.DAY, - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetCommerceCustomerRetentionMetricsRequest](../../models/operations/getcommercecustomerretentionmetricsrequest.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.CommerceReport](../../models/shared/commercereport.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_lifetime_value - -The *Get lifetime value metrics* endpoint returns the average revenue that a specific company will generate throughout its lifespan over one or more periods of time. - -This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - -[Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the lifetime value metrics. - -#### Response structure - -The Lifetime value report's dimensions and measures are: - -| Index | Dimensions | -|---------------|------------------------| -| `index` = 0 | Period | -| `index` = 1 | Lifetime value metrics | - -| Index | Measures | -|-------------------|---------| -| `index` = 1 | Value | - -The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.metrics.get_lifetime_value(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "number_of_periods": 976344, - "period_length": 402759, - "period_unit": shared.PeriodUnit.DAY, - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceLifetimeValueMetricsRequest](../../models/operations/getcommercelifetimevaluemetricsrequest.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.CommerceReport](../../models/shared/commercereport.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_revenue - -The *Get revenue report* endpoint returns the revenue and revenue growth for a specific company connection over one or more periods of time. - -This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - -[Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the revenue metrics. - -#### Response structure - -The Revenue report's dimensions and measures are: - -| Index | Dimensions | -|---------------|------------| -| `index` = 0 | Period | -| `index` = 1 | Revenue | - -| Index | Measures | -|---------------|--------------------------------------------------------------------------------------------------------------------------| -| `index` = 0 | Value | -| `index` = 1 | Percentage change, defined as the change between the current and previous periods' values and expressed as a percentage. | - -The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.metrics.get_revenue(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "number_of_periods": 459595, - "period_length": 44877, - "period_unit": shared.PeriodUnit.YEAR, - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceRevenueMetricsRequest](../../models/operations/getcommercerevenuemetricsrequest.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.CommerceReport](../../models/shared/commercereport.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/lending/docs/sdks/orders/README.md b/lending/docs/sdks/orders/README.md deleted file mode 100644 index 0b1caeaf0..000000000 --- a/lending/docs/sdks/orders/README.md +++ /dev/null @@ -1,703 +0,0 @@ -# Sales.Orders - -## Overview - -### Available Operations - -* [get](#get) - Get order -* [list](#list) - List orders - -## get - -The *Get order* endpoint returns a single order for a given orderId. - -[Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Partner Commerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "order_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceOrderRequest](../../models/operations/getcommerceorderrequest.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.CommerceOrder](../../models/shared/commerceorder.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List orders* endpoint returns a list of [orders](https://docs.codat.io/lending-api#/schemas/Order) for a given company's connection. - -[Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Partner Commerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.orders.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.ListCommerceOrdersRequest](../../models/operations/listcommerceordersrequest.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.CommerceOrders](../../models/shared/commerceorders.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/lending/docs/sdks/paymentmethods/README.md b/lending/docs/sdks/paymentmethods/README.md deleted file mode 100644 index 44c3c0476..000000000 --- a/lending/docs/sdks/paymentmethods/README.md +++ /dev/null @@ -1,458 +0,0 @@ -# Sales.PaymentMethods - -## Overview - -### Available Operations - -* [get](#get) - Get payment method -* [list](#list) - List payment methods - -## get - -The *Get payment method* endpoint returns a single payment method for a given paymentMethodId. - -[Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "payment_method_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommercePaymentMethodRequest](../../models/operations/getcommercepaymentmethodrequest.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.CommercePaymentMethod](../../models/shared/commercepaymentmethod.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List payment methods* endpoint returns a list of [payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) for a given company's connection. - -[Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: Mollie - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: Mollie Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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: SumUp - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.payment_methods.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.ListCommercePaymentMethodsRequest](../../models/operations/listcommercepaymentmethodsrequest.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.CommercePaymentMethods](../../models/shared/commercepaymentmethods.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/lending/docs/sdks/payments/README.md b/lending/docs/sdks/payments/README.md deleted file mode 100644 index 5af96d62c..000000000 --- a/lending/docs/sdks/payments/README.md +++ /dev/null @@ -1,865 +0,0 @@ -# AccountsReceivable.Payments - -## Overview - -### Available Operations - -* [get](#get) - Get payment -* [list](#list) - List payments - -## get - -The *Get payment* endpoint returns a single payment for a given paymentId. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "payment_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingPaymentRequest](../../models/operations/getaccountingpaymentrequest.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.AccountingPayment](../../models/shared/accountingpayment.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - -[Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.payments.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.ListAccountingPaymentsRequest](../../models/operations/listaccountingpaymentsrequest.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.AccountingPayments](../../models/shared/accountingpayments.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/lending/docs/sdks/productcategories/README.md b/lending/docs/sdks/productcategories/README.md deleted file mode 100644 index ab47536f4..000000000 --- a/lending/docs/sdks/productcategories/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# Sales.ProductCategories - -## Overview - -### Available Operations - -* [get](#get) - Get product category -* [list](#list) - List product categories - -## get - -The *Get product* endpoint returns a single product for a given productId. - -[Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. "Furniture"), or sometimes by tax profile. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.product_categories.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetCommerceProductCategoryRequest](../../models/operations/getcommerceproductcategoryrequest.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.CommerceProductCategory](../../models/shared/commerceproductcategory.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List product categories* endpoint returns a list of [product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) for a given company's connection. - -[Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. "Furniture"), or sometimes by tax profile. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.product_categories.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.ListCommerceProductCategoriesRequest](../../models/operations/listcommerceproductcategoriesrequest.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.CommerceProductCategories](../../models/shared/commerceproductcategories.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/lending/docs/sdks/products/README.md b/lending/docs/sdks/products/README.md deleted file mode 100644 index 278f4b8ea..000000000 --- a/lending/docs/sdks/products/README.md +++ /dev/null @@ -1,556 +0,0 @@ -# Sales.Products - -## Overview - -### Available Operations - -* [get](#get) - Get product -* [list](#list) - List products - -## get - -The *Get product* endpoint returns a single product for a given productId. - -[Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "product_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCommerceProductRequest](../../models/operations/getcommerceproductrequest.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.CommerceProduct](../../models/shared/commerceproduct.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List products* endpoint returns a list of [products](https://docs.codat.io/lending-api#/schemas/Product) for a given company's connection. - -[Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Amazon Seller Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: BigCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Clover - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Lightspeed K Trial - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: PrestaShop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Shopify - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Square - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Stripe Test - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: WooCommerce - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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: Zettle - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.sales.products.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.ListCommerceProductsRequest](../../models/operations/listcommerceproductsrequest.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.CommerceProducts](../../models/shared/commerceproducts.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/lending/docs/sdks/profitandloss/README.md b/lending/docs/sdks/profitandloss/README.md deleted file mode 100644 index c06c33692..000000000 --- a/lending/docs/sdks/profitandloss/README.md +++ /dev/null @@ -1,506 +0,0 @@ -# FinancialStatements.ProfitAndLoss - -## Overview - -### Available Operations - -* [get](#get) - Get profit and loss -* [get_categorized_accounts](#get_categorized_accounts) - Get categorized profit and loss statement - -## get - -Gets the latest profit and loss for a company. - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "period_length": 4, - "periods_to_compare": 20, - "start_month": "2022-10-23T00:00:00Z", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingProfitAndLossRequest](../../models/operations/getaccountingprofitandlossrequest.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.AccountingProfitAndLossReport](../../models/shared/accountingprofitandlossreport.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_categorized_accounts - -The *Get categorized profit and loss statement* endpoint returns a list of categorized accounts that appear on a company’s Profit and Loss statement. It also includes a balance as of the financial statement date. - -Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.financial_statements.profit_and_loss.get_categorized_accounts(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "report_date": "29-09-2020", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetCategorizedProfitAndLossStatementRequest](../../models/operations/getcategorizedprofitandlossstatementrequest.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.EnhancedFinancialReport](../../models/shared/enhancedfinancialreport.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/lending/docs/sdks/pulloperations/README.md b/lending/docs/sdks/pulloperations/README.md deleted file mode 100644 index 493c139ce..000000000 --- a/lending/docs/sdks/pulloperations/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# ManageData.PullOperations - -## Overview - -### Available Operations - -* [get](#get) - Get pull operation -* [list](#list) - List pull operations - -## get - -Retrieve information about a single dataset or pull operation. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_data.pull_operations.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "dataset_id": "fa5f3e86-bd80-49b8-853c-5fbba4b201f5", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `request` | [operations.GetPullOperationRequest](../../models/operations/getpulloperationrequest.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.PullOperation](../../models/shared/pulloperation.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 - -Gets the pull operation history (datasets) for a given company. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_data.pull_operations.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.ListPullOperationsRequest](../../models/operations/listpulloperationsrequest.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.PullOperations](../../models/shared/pulloperations.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/lending/docs/sdks/refresh/README.md b/lending/docs/sdks/refresh/README.md deleted file mode 100644 index 7f7af262c..000000000 --- a/lending/docs/sdks/refresh/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# ManageData.Refresh - -## Overview - -### Available Operations - -* [all_data_types](#all_data_types) - Refresh all data -* [data_type](#data_type) - Refresh data type - -## all_data_types - -Refreshes all data types with `fetch on first link` set to `true` for a given company. - -This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - -[Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - cl_client.manage_data.refresh.all_data_types(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Use the SDK ... - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `request` | [operations.RefreshAllDataTypesRequest](../../models/operations/refreshalldatatypesrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## data_type - -Refreshes a given data type for a given company. - -This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.manage_data.refresh.data_type(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "data_type": shared.SchemaDataType.INVOICES, - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `request` | [operations.RefreshDataTypeRequest](../../models/operations/refreshdatatyperequest.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.PullOperation](../../models/shared/pulloperation.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/lending/docs/sdks/reports/README.md b/lending/docs/sdks/reports/README.md deleted file mode 100644 index cb51f0df1..000000000 --- a/lending/docs/sdks/reports/README.md +++ /dev/null @@ -1,878 +0,0 @@ -# AccountsReceivable.Reports - -## Overview - -### Available Operations - -* [get_aged_creditors](#get_aged_creditors) - Aged creditors report -* [get_aged_debtors](#get_aged_debtors) - Aged debtors report -* [is_aged_creditors_available](#is_aged_creditors_available) - Aged creditors report available -* [is_aged_debtors_available](#is_aged_debtors_available) - Aged debtors report available - -## get_aged_creditors - -Returns aged creditors report for company that shows the total balance owed by a business to its suppliers over time. - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_creditors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetAccountingAgedCreditorsReportRequest](../../models/operations/getaccountingagedcreditorsreportrequest.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.AccountingAgedCreditorReport](../../models/shared/accountingagedcreditorreport.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_aged_debtors - -Returns aged debtors report for company that shows the total outstanding balance due from customers to the business over time. - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: MYOB AccountRight and Essentials - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared -from datetime import date - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.get_aged_debtors(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "number_of_periods": 12, - "period_length_days": 30, - "report_date": date.fromisoformat("2022-12-31"), - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingAgedDebtorsReportRequest](../../models/operations/getaccountingageddebtorsreportrequest.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.AccountingAgedDebtorReport](../../models/shared/accountingageddebtorreport.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 | \*/\* | - -## is_aged_creditors_available - -Indicates whether the aged creditor report is available for the company. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.is_aged_creditors_available(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.IsAgedCreditorsReportAvailableRequest](../../models/operations/isagedcreditorsreportavailablerequest.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 - -**[bool](../../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 | \*/\* | - -## is_aged_debtors_available - -Indicates whether the aged debtors report is available for the company. - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_receivable.reports.is_aged_debtors_available(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.IsAgedDebtorsReportAvailableRequest](../../models/operations/isageddebtorsreportavailablerequest.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 - -**[bool](../../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/lending/docs/sdks/sales/README.md b/lending/docs/sdks/sales/README.md new file mode 100644 index 000000000..543e9ce4e --- /dev/null +++ b/lending/docs/sdks/sales/README.md @@ -0,0 +1,5 @@ +# Sales + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/sourceaccounts/README.md b/lending/docs/sdks/sourceaccounts/README.md deleted file mode 100644 index dacb76f47..000000000 --- a/lending/docs/sdks/sourceaccounts/README.md +++ /dev/null @@ -1,286 +0,0 @@ -# LoanWriteback.SourceAccounts - -## Overview - -### Available Operations - -* [create](#create) - Create source account -* [create_mapping](#create_mapping) - Create bank feed account mapping -* [list_mappings](#list_mappings) - List bank feed account mappings - -## 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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.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_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 | | | ✅ | - -### Example Usage: Example - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.source_accounts.create_mapping(request={ - "bank_feed_bank_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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.source_accounts.create_mapping(request={ - "bank_feed_bank_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.BankFeedBankAccountMappingResponse](../../models/shared/bankfeedbankaccountmappingresponse.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_mappings - -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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.source_accounts.list_mappings(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/lending/docs/sdks/suppliers/README.md b/lending/docs/sdks/suppliers/README.md deleted file mode 100644 index bced2ef26..000000000 --- a/lending/docs/sdks/suppliers/README.md +++ /dev/null @@ -1,1070 +0,0 @@ -# AccountsPayable.Suppliers - -## Overview - -### Available Operations - -* [download_attachment](#download_attachment) - Download supplier attachment -* [get](#get) - Get supplier -* [get_attachment](#get_attachment) - Get supplier attachment -* [list](#list) - List suppliers -* [list_attachments](#list_attachments) - List supplier attachments - -## download_attachment - -The *Download supplier attachment* endpoint downloads a specific attachment for a given `supplierId` and `attachmentId`. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.download_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.DownloadAccountingSupplierAttachmentRequest](../../models/operations/downloadaccountingsupplierattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[httpx.Response](../../models/data.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 - -The *Get supplier* endpoint returns a single supplier for a given supplierId. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingSupplierRequest](../../models/operations/getaccountingsupplierrequest.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.AccountingSupplier](../../models/shared/accountingsupplier.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## get_attachment - -The *Get supplier attachment* endpoint returns a specific attachment for a given `supplierId` and `attachmentId`. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.get_attachment(request={ - "attachment_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.GetAccountingSupplierAttachmentRequest](../../models/operations/getaccountingsupplierattachmentrequest.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.AccountingAttachment](../../models/shared/accountingattachment.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 suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Clear Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Dynamics 365 Business Central - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Exact (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreeAgent - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: FreshBooks - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: KashFlow - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Desktop - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: QuickBooks Online Sandbox - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 200cloud - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage 50 (UK) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Business Cloud Accounting - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Sage Intacct - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Wave - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "order_by": "-modifiedDate", - "query": "id=e3334455-1aed-4e71-ab43-6bccf12092ee", - }) - - # Handle response - print(res) - -``` -### Example Usage: Zoho Books - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.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.ListAccountingSuppliersRequest](../../models/operations/listaccountingsuppliersrequest.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.AccountingSuppliers](../../models/shared/accountingsuppliers.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 | \*/\* | - -## list_attachments - -The *List supplier attachments* endpoint returns a list of attachments available to download for given `supplierId`. - -[Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - -### Example Usage - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.accounts_payable.suppliers.list_attachments(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "supplier_id": "13d946f0-c5d5-42bc-b092-97ece17923ab", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| `request` | [operations.ListAccountingSupplierAttachmentsRequest](../../models/operations/listaccountingsupplierattachmentsrequest.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.Attachments](../../models/shared/attachments.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 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/lending/docs/sdks/transactioncategories/README.md b/lending/docs/sdks/transactioncategories/README.md deleted file mode 100644 index 78296f2a9..000000000 --- a/lending/docs/sdks/transactioncategories/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Banking.TransactionCategories - -## Overview - -### Available Operations - -* [get](#get) - Get transaction category -* [list](#list) - List transaction categories - -## get - -The *Get transaction category* endpoint returns a single transaction category for a given transactionCategoryId. - -[Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transaction_categories.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_category_id": "", - }) - - # Handle response - print(res) - -``` -### Example Usage: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transaction_categories.get(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - "transaction_category_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| `request` | [operations.GetBankingTransactionCategoryRequest](../../models/operations/getbankingtransactioncategoryrequest.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.BankingTransactionCategory](../../models/shared/bankingtransactioncategory.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| ---------------------------- | ---------------------------- | ---------------------------- | -| errors.ErrorMessage | 401, 402, 403, 404, 409, 429 | application/json | -| errors.ErrorMessage | 500, 503 | application/json | -| errors.SDKError | 4XX, 5XX | \*/\* | - -## list - -The *List transaction categories* endpoint returns a list of [transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) for a given company's connection. - -[Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - -Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - -### Example Usage: Basiq - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transaction_categories.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: Plaid - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.banking.transaction_categories.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.ListBankingTransactionCategoriesRequest](../../models/operations/listbankingtransactioncategoriesrequest.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.BankingTransactionCategories](../../models/shared/bankingtransactioncategories.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/lending/docs/sdks/transactions/README.md b/lending/docs/sdks/transactions/README.md new file mode 100644 index 000000000..748b14477 --- /dev/null +++ b/lending/docs/sdks/transactions/README.md @@ -0,0 +1,5 @@ +# TransactionsGroup + +## Overview + +### Available Operations \ No newline at end of file diff --git a/lending/docs/sdks/transfers/README.md b/lending/docs/sdks/transfers/README.md deleted file mode 100644 index a3010024b..000000000 --- a/lending/docs/sdks/transfers/README.md +++ /dev/null @@ -1,400 +0,0 @@ -# LoanWriteback.Transfers - -## Overview - -### Available Operations - -* [create](#create) - Create transfer -* [get_create_model](#get_create_model) - Get create transfer model - -## create - -The *Create transfer* endpoint creates a new [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - -[Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - -**Integration-specific behavior** - -Required data may vary by integration. To see what data to post, first call [Get create transfer model](https://docs.codat.io/lending-api#/operations/get-create-transfers-model). - -### Example Usage: Malformed query - - -```python -from codat_lending import CodatLending -from codat_lending.models import operations, shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.create(request=operations.CreateTransferRequest( - accounting_transfer=shared.AccountingTransfer( - date_="2022-10-23T00:00:00Z", - deposited_record_refs=[ - shared.AccountingRecordRef( - data_type="journalEntry", - ), - ], - from_=shared.TransferAccount( - account_ref=shared.AccountingRecordRef( - data_type="journalEntry", - ), - currency="GBP", - ), - modified_date="2022-10-23T00:00:00Z", - source_modified_date="2022-10-23T00:00:00Z", - to=shared.TransferAccount( - account_ref=shared.AccountingRecordRef( - data_type="journalEntry", - ), - currency="GBP", - ), - ), - 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_lending import CodatLending -from codat_lending.models import operations, shared -from decimal import Decimal - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.create(request=operations.CreateTransferRequest( - accounting_transfer=shared.AccountingTransfer( - contact_ref=shared.ContactRef( - data_type=shared.ContactRefDataType.CUSTOMERS, - id="80000028-167239230944", - ), - date_="2023-01-26T11:51:18.104Z", - description="test transfers push 20230126 12.08", - from_=shared.TransferAccount( - account_ref=shared.AccountingRecordRef( - data_type="bankAccounts", - id="80000028-1671794219", - ), - amount=Decimal("12"), - ), - metadata=shared.Metadata( - is_deleted=True, - ), - status=shared.AccountingTransferStatus.UNKNOWN, - to=shared.TransferAccount( - account_ref=shared.AccountingRecordRef( - data_type="bankAccounts", - id="80000004-1671793811", - ), - amount=Decimal("12"), - ), - tracking_category_refs=[ - shared.TrackingCategoryRef( - id="80000001-1674553252", - name="Class 1", - ), - ], - ), - 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.CreateTransferRequest](../../models/operations/createtransferrequest.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.AccountingCreateTransferResponse](../../models/shared/accountingcreatetransferresponse.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 transfer model* endpoint returns the expected data for the request payload when creating a [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company and integration. - -[Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - -**Integration-specific behavior** - -See the *response examples* for integration-specific indicative models. - - -### Example Usage: Exact (Netherlands) - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Oracle NetSuite - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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 - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.get_create_model(request={ - "company_id": "8a210b68-6988-11ed-a1eb-0242ac120002", - "connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171", - }) - - # Handle response - print(res) - -``` -### Example Usage: Xero - - -```python -from codat_lending import CodatLending -from codat_lending.models import shared - - -with CodatLending( - security=shared.Security( - auth_header="Basic BASE_64_ENCODED(API_KEY)", - ), -) as cl_client: - - res = cl_client.loan_writeback.transfers.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.GetCreateTransfersModelRequest](../../models/operations/getcreatetransfersmodelrequest.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 | \*/\* | \ No newline at end of file diff --git a/lending/pyproject.toml b/lending/pyproject.toml index 318121ff0..f111a0177 100644 --- a/lending/pyproject.toml +++ b/lending/pyproject.toml @@ -1,58 +1,35 @@ - [project] name = "codat-lending" -version = "11.0.1" +version = "11.0.2" description = "Make credit decisions backed by enhanced financials, metrics, reports, and data integrity features." -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_lending", from = "src" } + { include = "codat_lending", from = "src" }, ] -include = ["py.typed", "src/codat_lending/py.typed"] - -[tool.setuptools.package-data] -"*" = ["py.typed", "src/codat_lending/py.typed"] - -[virtualenvs] -in-project = true +include = ["src/codat_lending/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/lending/src/codat_lending/__init__.py b/lending/src/codat_lending/__init__.py index 833c68cd5..1c57a8283 100644 --- a/lending/src/codat_lending/__init__.py +++ b/lending/src/codat_lending/__init__.py @@ -1,4 +1,426 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +# flake8: noqa + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.api.account_balances import AccountBalances +from codat_lending.api.account_transactions import AccountTransactions +from codat_lending.api.accounting_bank_data import AccountingBankData +from codat_lending.api.accounts import Accounts +from codat_lending.api.balance_sheet import BalanceSheet +from codat_lending.api.bank_accounts import BankAccounts +from codat_lending.api.bank_transactions import BankTransactions +from codat_lending.api.bank_statements import BankStatements +from codat_lending.api.banking_accounts import BankingAccounts +from codat_lending.api.bill_credit_notes import BillCreditNotes +from codat_lending.api.bill_payments import BillPayments +from codat_lending.api.bills import Bills +from codat_lending.api.cash_flow import CashFlow +from codat_lending.api.categorized_statement import CategorizedStatement +from codat_lending.api.companies import Companies +from codat_lending.api.company_info import CompanyInfo +from codat_lending.api.connections import Connections +from codat_lending.api.create_operations import CreateOperations +from codat_lending.api.credit_notes import CreditNotes +from codat_lending.api.customers import Customers +from codat_lending.api.data_integrity import DataIntegrity +from codat_lending.api.direct_costs import DirectCosts +from codat_lending.api.direct_incomes import DirectIncomes +from codat_lending.api.disputes import Disputes +from codat_lending.api.excel_reports import ExcelReports +from codat_lending.api.financial_statements_accounts import FinancialStatementsAccounts +from codat_lending.api.financial_summary import FinancialSummary +from codat_lending.api.invoices import Invoices +from codat_lending.api.journal_entries import JournalEntries +from codat_lending.api.journals import Journals +from codat_lending.api.liabilities import Liabilities +from codat_lending.api.loan_writeback_accounts import LoanWritebackAccounts +from codat_lending.api.loan_writeback_payments import LoanWritebackPayments +from codat_lending.api.loan_writeback_suppliers import LoanWritebackSuppliers +from codat_lending.api.locations import Locations +from codat_lending.api.manage_data import ManageData +from codat_lending.api.manage_reports import ManageReports +from codat_lending.api.metrics import Metrics +from codat_lending.api.orders import Orders +from codat_lending.api.payment_methods import PaymentMethods +from codat_lending.api.payments import Payments +from codat_lending.api.product_categories import ProductCategories +from codat_lending.api.products import Products +from codat_lending.api.profit_and_loss import ProfitAndLoss +from codat_lending.api.pull_operations import PullOperations +from codat_lending.api.refresh import Refresh +from codat_lending.api.reports import Reports +from codat_lending.api.sales_customers import SalesCustomers +from codat_lending.api.sales_payments import SalesPayments +from codat_lending.api.sales_reports import SalesReports +from codat_lending.api.sales_transactions import SalesTransactions +from codat_lending.api.source_accounts import SourceAccounts +from codat_lending.api.suppliers import Suppliers +from codat_lending.api.transaction_categories import TransactionCategories +from codat_lending.api.transactions import Transactions +from codat_lending.api.transactions_direct_costs import TransactionsDirectCosts +from codat_lending.api.transactions_transfers import TransactionsTransfers +from codat_lending.api.transfers import Transfers + +# import ApiClient +from codat_lending.api_response import ApiResponse +from codat_lending.api_client import ApiClient +from codat_lending.configuration import Configuration +from codat_lending.exceptions import OpenApiException +from codat_lending.exceptions import ApiTypeError +from codat_lending.exceptions import ApiValueError +from codat_lending.exceptions import ApiKeyError +from codat_lending.exceptions import ApiAttributeError +from codat_lending.exceptions import ApiException + +# import models into sdk package +from codat_lending.models.account import Account +from codat_lending.models.shared.accountbalance import AccountBalance +from codat_lending.models.shared.accountbalanceamounts import AccountBalanceAmounts +from codat_lending.models.shared.accountcategoriesupdatedwebhook import AccountCategoriesUpdatedWebhook +from codat_lending.models.shared.accountcategoriesupdatedwebhookdata import AccountCategoriesUpdatedWebhookData +from codat_lending.models.shared.accountcategorylevel import AccountCategoryLevel +from codat_lending.models.shared.accountidentifiertype import AccountIdentifierType +from codat_lending.models.shared.accountidentifiers import AccountIdentifiers +from codat_lending.models.shared.accountinfo import AccountInfo +from codat_lending.models.shared.accountinstitution import AccountInstitution +from codat_lending.models.shared.accountprototype import AccountPrototype +from codat_lending.models.shared.accountref import AccountRef +from codat_lending.models.shared.accountstatus import AccountStatus +from codat_lending.models.shared.accounttransactionline import AccountTransactionLine +from codat_lending.models.account_transaction_line_record_ref import AccountTransactionLineRecordRef +from codat_lending.models.shared.accountingaccount import AccountingAccount +from codat_lending.models.shared.accountingaccounttransaction import AccountingAccountTransaction +from codat_lending.models.shared.accountingaccounttransactions import AccountingAccountTransactions +from codat_lending.models.shared.accountingaccounts import AccountingAccounts +from codat_lending.models.shared.accountingaddress import AccountingAddress +from codat_lending.models.shared.accountingaddresstype import AccountingAddressType +from codat_lending.models.shared.accountingagedcreditorreport import AccountingAgedCreditorReport +from codat_lending.models.shared.accountingageddebtorreport import AccountingAgedDebtorReport +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingbalancesheet import AccountingBalanceSheet +from codat_lending.models.shared.accountingbankaccount import AccountingBankAccount +from codat_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from codat_lending.models.shared.accountingbankaccounts import AccountingBankAccounts +from codat_lending.models.shared.accountingbanktransaction import AccountingBankTransaction +from codat_lending.models.shared.accountingbanktransactions import AccountingBankTransactions +from codat_lending.models.shared.accountingbill import AccountingBill +from codat_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNote +from codat_lending.models.shared.accountingbillcreditnotes import AccountingBillCreditNotes +from codat_lending.models.shared.accountingbillpayment import AccountingBillPayment +from codat_lending.models.accounting_bill_payment_all_of_payment_method_ref import AccountingBillPaymentAllOfPaymentMethodRef +from codat_lending.models.accounting_bill_payment_all_of_supplier_ref import AccountingBillPaymentAllOfSupplierRef +from codat_lending.models.shared.accountingbillpayments import AccountingBillPayments +from codat_lending.models.shared.accountingbills import AccountingBills +from codat_lending.models.shared.accountingcashflowstatement import AccountingCashFlowStatement +from codat_lending.models.shared.accountingcompanyinfo import AccountingCompanyInfo +from codat_lending.models.shared.accountingcreateaccountresponse import AccountingCreateAccountResponse +from codat_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData +from codat_lending.models.shared.accountingcreatebankaccountresponse import AccountingCreateBankAccountResponse +from codat_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData +from codat_lending.models.shared.accountingcreatebanktransactions import AccountingCreateBankTransactions +from codat_lending.models.shared.accountingcreatebanktransactionsresponse import AccountingCreateBankTransactionsResponse +from codat_lending.models.accounting_create_bank_transactions_response_all_of_data import AccountingCreateBankTransactionsResponseAllOfData +from codat_lending.models.shared.accountingcreatedirectcostresponse import AccountingCreateDirectCostResponse +from codat_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData +from codat_lending.models.shared.accountingcreatepaymentresponse import AccountingCreatePaymentResponse +from codat_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData +from codat_lending.models.shared.accountingcreatesupplierresponse import AccountingCreateSupplierResponse +from codat_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData +from codat_lending.models.accounting_create_transfer_response import AccountingCreateTransferResponse +from codat_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData +from codat_lending.models.shared.accountingcreditnote import AccountingCreditNote +from codat_lending.models.shared.accountingcreditnotes import AccountingCreditNotes +from codat_lending.models.shared.accountingcustomer import AccountingCustomer +from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRef +from codat_lending.models.shared.accountingcustomers import AccountingCustomers +from codat_lending.models.shared.accountingdirectcost import AccountingDirectCost +from codat_lending.models.shared.accountingdirectcosts import AccountingDirectCosts +from codat_lending.models.shared.accountingdirectincome import AccountingDirectIncome +from codat_lending.models.shared.accountingdirectincomes import AccountingDirectIncomes +from codat_lending.models.shared.accountinginvoice import AccountingInvoice +from codat_lending.models.shared.accountinginvoices import AccountingInvoices +from codat_lending.models.shared.accountingjournal import AccountingJournal +from codat_lending.models.shared.accountingjournalentries import AccountingJournalEntries +from codat_lending.models.shared.accountingjournalentry import AccountingJournalEntry +from codat_lending.models.shared.accountingjournals import AccountingJournals +from codat_lending.models.shared.accountingpayment import AccountingPayment +from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation +from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocation +from codat_lending.models.accounting_payment_method import AccountingPaymentMethod +from codat_lending.models.shared.accountingpayments import AccountingPayments +from codat_lending.models.shared.accountingprofitandlossreport import AccountingProfitAndLossReport +from codat_lending.models.shared.accountingrecordref import AccountingRecordRef +from codat_lending.models.shared.accountingsupplier import AccountingSupplier +from codat_lending.models.shared.accountingsuppliers import AccountingSuppliers +from codat_lending.models.accounting_tracking_category import AccountingTrackingCategory +from codat_lending.models.shared.accountingtransfer import AccountingTransfer +from codat_lending.models.shared.accountingtransfers import AccountingTransfers +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.accountspayabletracking import AccountsPayableTracking +from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTracking +from codat_lending.models.shared.agedcreditor import AgedCreditor +from codat_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstanding +from codat_lending.models.shared.ageddebtor import AgedDebtor +from codat_lending.models.shared.agedoutstandingamount import AgedOutstandingAmount +from codat_lending.models.shared.agedoutstandingamountdetail import AgedOutstandingAmountDetail +from codat_lending.models.shared.attachments import Attachments +from codat_lending.models.shared.balancesheet import BalanceSheet +from codat_lending.models.bank_account_prototype import BankAccountPrototype +from codat_lending.models.shared.bankaccountref import BankAccountRef +from codat_lending.models.shared.bankaccountstatus import BankAccountStatus +from codat_lending.models.shared.bankfeedbankaccountmapping import BankFeedBankAccountMapping +from codat_lending.models.shared.bankfeedbankaccountmappingresponse import BankFeedBankAccountMappingResponse +from codat_lending.models.shared.bankfeedmapping import BankFeedMapping +from codat_lending.models.shared.bankstatementuploadconfiguration import BankStatementUploadConfiguration +from codat_lending.models.shared.banktransactiontype import BankTransactionType +from codat_lending.models.shared.bankingaccount import BankingAccount +from codat_lending.models.shared.bankingaccountbalance import BankingAccountBalance +from codat_lending.models.shared.bankingaccountbalances import BankingAccountBalances +from codat_lending.models.shared.bankingaccounts import BankingAccounts +from codat_lending.models.shared.bankingtransaction import BankingTransaction +from codat_lending.models.shared.bankingtransactioncategories import BankingTransactionCategories +from codat_lending.models.shared.bankingtransactioncategory import BankingTransactionCategory +from codat_lending.models.shared.bankingtransactionref import BankingTransactionRef +from codat_lending.models.shared.bankingtransactions import BankingTransactions +from codat_lending.models.shared.billcreditnotelineitem import BillCreditNoteLineItem +from codat_lending.models.shared.billcreditnotestatus import BillCreditNoteStatus +from codat_lending.models.bill_line_item import BillLineItem +from codat_lending.models.bill_line_item_purchase_order_line_ref import BillLineItemPurchaseOrderLineRef +from codat_lending.models.shared.billpaymentline import BillPaymentLine +from codat_lending.models.shared.billpaymentlinelink import BillPaymentLineLink +from codat_lending.models.shared.billpaymentlinelinktype import BillPaymentLineLinkType +from codat_lending.models.shared.billstatus import BillStatus +from codat_lending.models.shared.billedtotype import BilledToType +from codat_lending.models.shared.billedtotype1 import BilledToType1 +from codat_lending.models.shared.cashflowstatement import CashFlowStatement +from codat_lending.models.cash_flow_transaction import CashFlowTransaction +from codat_lending.models.categorized_bank_statement_accounts import CategorizedBankStatementAccounts +from codat_lending.models.categorized_bank_statement_transactions import CategorizedBankStatementTransactions +from codat_lending.models.shared.clientratelimitwebhook import ClientRateLimitWebhook +from codat_lending.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload +from codat_lending.models.shared.commerceaddress import CommerceAddress +from codat_lending.models.shared.commerceaddresstype import CommerceAddressType +from codat_lending.models.shared.commercecompanyinfo import CommerceCompanyInfo +from codat_lending.models.shared.commercecustomer import CommerceCustomer +from codat_lending.models.shared.commercecustomerref import CommerceCustomerRef +from codat_lending.models.shared.commercecustomers import CommerceCustomers +from codat_lending.models.shared.commercedispute import CommerceDispute +from codat_lending.models.shared.commercedisputes import CommerceDisputes +from codat_lending.models.shared.commercelocation import CommerceLocation +from codat_lending.models.shared.commercelocations import CommerceLocations +from codat_lending.models.shared.commerceorder import CommerceOrder +from codat_lending.models.shared.commerceorders import CommerceOrders +from codat_lending.models.shared.commercepayment import CommercePayment +from codat_lending.models.shared.commercepaymentmethod import CommercePaymentMethod +from codat_lending.models.shared.commercepaymentmethods import CommercePaymentMethods +from codat_lending.models.shared.commercepayments import CommercePayments +from codat_lending.models.shared.commerceproduct import CommerceProduct +from codat_lending.models.shared.commerceproductcategories import CommerceProductCategories +from codat_lending.models.shared.commerceproductcategory import CommerceProductCategory +from codat_lending.models.shared.commerceproducts import CommerceProducts +from codat_lending.models.shared.commercerecordref import CommerceRecordRef +from codat_lending.models.shared.commercereport import CommerceReport +from codat_lending.models.shared.commercereportcomponent import CommerceReportComponent +from codat_lending.models.shared.commercereportdimension import CommerceReportDimension +from codat_lending.models.commerce_report_dimension_items import CommerceReportDimensionItems +from codat_lending.models.shared.commercereporterror import CommerceReportError +from codat_lending.models.shared.commercereportmeasure import CommerceReportMeasure +from codat_lending.models.commerce_tax_component import CommerceTaxComponent +from codat_lending.models.shared.commercetransaction import CommerceTransaction +from codat_lending.models.shared.commercetransactions import CommerceTransactions +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.company_details import CompanyDetails +from codat_lending.models.shared.companyreference import CompanyReference +from codat_lending.models.company_reference_links import CompanyReferenceLinks +from codat_lending.models.shared.companyrequestbody import CompanyRequestBody +from codat_lending.models.shared.companyupdaterequest import CompanyUpdateRequest +from codat_lending.models.shared.connection import Connection +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.contact_ref import ContactRef +from codat_lending.models.contact_reference import ContactReference +from codat_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransaction +from codat_lending.models.create_connection_request import CreateConnectionRequest +from codat_lending.models.create_source_account200_response import CreateSourceAccount200Response +from codat_lending.models.create_source_account_request import CreateSourceAccountRequest +from codat_lending.models.created_date import CreatedDate +from codat_lending.models.shared.creditnotelineitem import CreditNoteLineItem +from codat_lending.models.shared.creditnotestatus import CreditNoteStatus +from codat_lending.models.shared.customerstatus import CustomerStatus +from codat_lending.models.shared.dataconnectionerror import DataConnectionError +from codat_lending.models.shared.dataconnectionstatus import DataConnectionStatus +from codat_lending.models.shared.dataintegrityamounts import DataIntegrityAmounts +from codat_lending.models.shared.dataintegritybyamount import DataIntegrityByAmount +from codat_lending.models.shared.dataintegritybycount import DataIntegrityByCount +from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionId +from codat_lending.models.shared.dataintegritydates import DataIntegrityDates +from codat_lending.models.shared.dataintegritydetail import DataIntegrityDetail +from codat_lending.models.shared.dataintegritydetails import DataIntegrityDetails +from codat_lending.models.shared.dataintegritymatch import DataIntegrityMatch +from codat_lending.models.shared.dataintegritystatus import DataIntegrityStatus +from codat_lending.models.shared.dataintegritystatusinfo import DataIntegrityStatusInfo +from codat_lending.models.shared.dataintegritystatuses import DataIntegrityStatuses +from codat_lending.models.shared.dataintegritysummaries import DataIntegritySummaries +from codat_lending.models.shared.dataintegritysummary import DataIntegritySummary +from codat_lending.models.data_integrity_type import DataIntegrityType +from codat_lending.models.shared.datasource import DataSource +from codat_lending.models.shared.datastatus import DataStatus +from codat_lending.models.data_statuses import DataStatuses +from codat_lending.models.shared.datatype import DataType +from codat_lending.models.shared.directcostlineitem import DirectCostLineItem +from codat_lending.models.shared.directcostprototype import DirectCostPrototype +from codat_lending.models.shared.directincomelineitem import DirectIncomeLineItem +from codat_lending.models.shared.disputestatus import DisputeStatus +from codat_lending.models.shared.enduploadsessionrequest import EndUploadSessionRequest +from codat_lending.models.shared.enhancedcashflowitem import EnhancedCashFlowItem +from codat_lending.models.shared.enhancedcashflowtransactions import EnhancedCashFlowTransactions +from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReport +from codat_lending.models.shared.enhancedinvoicereportitem import EnhancedInvoiceReportItem +from codat_lending.models.shared.enhancedinvoicesreport import EnhancedInvoicesReport +from codat_lending.models.shared.enhancedreportaccountcategory import EnhancedReportAccountCategory +from codat_lending.models.shared.enhancedreportinfo import EnhancedReportInfo +from codat_lending.models.error_message import ErrorMessage +from codat_lending.models.shared.errorvalidation import ErrorValidation +from codat_lending.models.shared.errorvalidationitem import ErrorValidationItem +from codat_lending.models.shared.excelreporttypes import ExcelReportTypes +from codat_lending.models.shared.excelstatus import ExcelStatus +from codat_lending.models.shared.file import File +from codat_lending.models.financial_summary import FinancialSummary +from codat_lending.models.financial_summary_accounting_score import FinancialSummaryAccountingScore +from codat_lending.models.financial_summary_books_closed_date import FinancialSummaryBooksClosedDate +from codat_lending.models.get_report_status_report_id_parameter import GetReportStatusReportIdParameter +from codat_lending.models.shared.halref import HalRef +from codat_lending.models.shared.integritystatus import IntegrityStatus +from codat_lending.models.shared.invoicelineitem import InvoiceLineItem +from codat_lending.models.shared.invoicestatus import InvoiceStatus +from codat_lending.models.shared.itemref import ItemRef +from codat_lending.models.item_reference import ItemReference +from codat_lending.models.shared.items import Items +from codat_lending.models.shared.journalentryrecordref import JournalEntryRecordRef +from codat_lending.models.journal_line import JournalLine +from codat_lending.models.journal_line_tracking import JournalLineTracking +from codat_lending.models.journal_prototype import JournalPrototype +from codat_lending.models.shared.journalref import JournalRef +from codat_lending.models.shared.journalstatus import JournalStatus +from codat_lending.models.shared.lendingcustomerref import LendingCustomerRef +from codat_lending.models.shared.links import Links +from codat_lending.models.shared.loanref import LoanRef +from codat_lending.models.shared.loansummary import LoanSummary +from codat_lending.models.shared.loansummaryintegrationtype import LoanSummaryIntegrationType +from codat_lending.models.shared.loansummaryrecordref import LoanSummaryRecordRef +from codat_lending.models.shared.loansummaryrecordreftype import LoanSummaryRecordRefType +from codat_lending.models.shared.loansummaryreportinfo import LoanSummaryReportInfo +from codat_lending.models.shared.loansummaryreportitem import LoanSummaryReportItem +from codat_lending.models.shared.loantransactions import LoanTransactions +from codat_lending.models.shared.loantransactionsreportinfo import LoanTransactionsReportInfo +from codat_lending.models.shared.locationref import LocationRef +from codat_lending.models.shared.metadata import Metadata +from codat_lending.models.model0 import Model0 +from codat_lending.models.model3 import Model3 +from codat_lending.models.shared.orderdiscountallocation import OrderDiscountAllocation +from codat_lending.models.shared.orderlineitem import OrderLineItem +from codat_lending.models.paging_info import PagingInfo +from codat_lending.models.shared.payment import Payment +from codat_lending.models.shared.paymentallocationpayment import PaymentAllocationPayment +from codat_lending.models.shared.paymentline import PaymentLine +from codat_lending.models.shared.paymentlinelink import PaymentLineLink +from codat_lending.models.shared.paymentlinktype import PaymentLinkType +from codat_lending.models.shared.paymentmethodref import PaymentMethodRef +from codat_lending.models.payment_method_type import PaymentMethodType +from codat_lending.models.shared.paymentref import PaymentRef +from codat_lending.models.shared.paymentstatus import PaymentStatus +from codat_lending.models.shared.paymenttype import PaymentType +from codat_lending.models.phone_number import PhoneNumber +from codat_lending.models.shared.productinventory import ProductInventory +from codat_lending.models.shared.productinventorylocation import ProductInventoryLocation +from codat_lending.models.shared.productprice import ProductPrice +from codat_lending.models.shared.productref import ProductRef +from codat_lending.models.shared.productvariant import ProductVariant +from codat_lending.models.shared.productvariantref import ProductVariantRef +from codat_lending.models.shared.productvariantstatus import ProductVariantStatus +from codat_lending.models.shared.profitandlossreport import ProfitAndLossReport +from codat_lending.models.shared.projectref import ProjectRef +from codat_lending.models.shared.pulloperation import PullOperation +from codat_lending.models.shared.pulloperations import PullOperations +from codat_lending.models.purchase_order_reference import PurchaseOrderReference +from codat_lending.models.shared.pushchangetype import PushChangeType +from codat_lending.models.shared.pushfieldvalidation import PushFieldValidation +from codat_lending.models.shared.pushoperation import PushOperation +from codat_lending.models.shared.pushoperationchange import PushOperationChange +from codat_lending.models.shared.pushoperationref import PushOperationRef +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.pushoperations import PushOperations +from codat_lending.models.shared.pushoption import PushOption +from codat_lending.models.shared.pushoptionchoice import PushOptionChoice +from codat_lending.models.shared.pushoptionproperty import PushOptionProperty +from codat_lending.models.shared.pushoptiontype import PushOptionType +from codat_lending.models.shared.pushvalidationinfo import PushValidationInfo +from codat_lending.models.record_line_reference import RecordLineReference +from codat_lending.models.shared.reportbasis import ReportBasis +from codat_lending.models.shared.reportcomponentmeasure import ReportComponentMeasure +from codat_lending.models.shared.reportinfo import ReportInfo +from codat_lending.models.shared.reportinput import ReportInput +from codat_lending.models.report_item import ReportItem +from codat_lending.models.shared.reportitems import ReportItems +from codat_lending.models.shared.reportline import ReportLine +from codat_lending.models.shared.reportoperation import ReportOperation +from codat_lending.models.report_source_reference import ReportSourceReference +from codat_lending.models.shared.reports import Reports +from codat_lending.models.shared.routinginfo import RoutingInfo +from codat_lending.models.sales_order_reference import SalesOrderReference +from codat_lending.models.shared.servicecharge import ServiceCharge +from codat_lending.models.shared.servicechargetype import ServiceChargeType +from codat_lending.models.shared.sourceaccount import SourceAccount +from codat_lending.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_lending.models.source_account_v2 import SourceAccountV2 +from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from codat_lending.models.shared.sourceref import SourceRef +from codat_lending.models.shared.startuploadsessionrequest import StartUploadSessionRequest +from codat_lending.models.shared.status import Status +from codat_lending.models.shared.supplementaldata import SupplementalData +from codat_lending.models.shared.supplierref import SupplierRef +from codat_lending.models.shared.supplierstatus import SupplierStatus +from codat_lending.models.shared.targetaccountoption import TargetAccountOption +from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocation +from codat_lending.models.shared.taxcomponentref import TaxComponentRef +from codat_lending.models.shared.taxrateref import TaxRateRef +from codat_lending.models.tax_rate_reference import TaxRateReference +from codat_lending.models.shared.tracking import Tracking +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef +from codat_lending.models.tracking_record_ref import TrackingRecordRef +from codat_lending.models.shared.transactioncategory import TransactionCategory +from codat_lending.models.shared.transactioncategoryref import TransactionCategoryRef +from codat_lending.models.shared.transactioncategorystatus import TransactionCategoryStatus +from codat_lending.models.shared.transactioncode import TransactionCode +from codat_lending.models.shared.transactionsourceref import TransactionSourceRef +from codat_lending.models.shared.transactionsourcetype import TransactionSourceType +from codat_lending.models.shared.transactiontype import TransactionType +from codat_lending.models.shared.transferaccount import TransferAccount +from codat_lending.models.update_connection import UpdateConnection +from codat_lending.models.upload_bank_statement_data_request import UploadBankStatementDataRequest +from codat_lending.models.valid_data_type_links import ValidDataTypeLinks +from codat_lending.models.shared.validation import Validation +from codat_lending.models.shared.validationitem import ValidationItem +from codat_lending.models.shared.weblink import WebLink +from codat_lending.models.withholding_tax import WithholdingTax +from .sdk import CodatLending from ._version import ( __title__, @@ -7,11 +429,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/lending/src/codat_lending/_hooks/__init__.py b/lending/src/codat_lending/_hooks/__init__.py index 2ee66cdd5..9a9b25d03 100644 --- a/lending/src/codat_lending/_hooks/__init__.py +++ b/lending/src/codat_lending/_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/lending/src/codat_lending/_hooks/sdkhooks.py b/lending/src/codat_lending/_hooks/sdkhooks.py index 1bdad7ee6..d130d2d60 100644 --- a/lending/src/codat_lending/_hooks/sdkhooks.py +++ b/lending/src/codat_lending/_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_lending.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/lending/src/codat_lending/_hooks/types.py b/lending/src/codat_lending/_hooks/types.py index a8ca189f0..5abf97b02 100644 --- a/lending/src/codat_lending/_hooks/types.py +++ b/lending/src/codat_lending/_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_lending.httpclient import HttpClient -from codat_lending.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/lending/src/codat_lending/_httpx_transport.py b/lending/src/codat_lending/_httpx_transport.py new file mode 100644 index 000000000..68ec2095f --- /dev/null +++ b/lending/src/codat_lending/_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/lending/src/codat_lending/_version.py b/lending/src/codat_lending/_version.py index 0805065a3..958a0e763 100644 --- a/lending/src/codat_lending/_version.py +++ b/lending/src/codat_lending/_version.py @@ -1,12 +1,17 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Version metadata for codat-lending. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations import importlib.metadata __title__: str = "codat-lending" -__version__: str = "11.0.1" +__version__: str = "3.0.0" __openapi_doc_version__: str = "3.0.0" -__gen_version__: str = "2.881.4" -__user_agent__: str = "speakeasy-sdk/python 11.0.1 2.881.4 3.0.0 codat-lending" +__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-lending" try: if __package__ is not None: diff --git a/lending/src/codat_lending/account_balances.py b/lending/src/codat_lending/account_balances.py index 757a90c1d..3aa7660ab 100644 --- a/lending/src/codat_lending/account_balances.py +++ b/lending/src/codat_lending/account_balances.py @@ -1,225 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.account_balances — re-export of the account_balances method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class AccountBalances(BaseSDK): - def list( - self, - *, - request: Union[ - operations.ListBankingAccountBalancesRequest, - operations.ListBankingAccountBalancesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccountBalances: - r"""List account balances - - The *List account balances* endpoint returns a list of [account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) for a given company's connection. - - [Account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) are balances for a bank account, including end-of-day batch balance or running balances per transaction. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingAccountBalancesRequest - ) - request = cast(operations.ListBankingAccountBalancesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accountBalances", - 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-banking-account-balances", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccountBalances, 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.ListBankingAccountBalancesRequest, - operations.ListBankingAccountBalancesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccountBalances: - r"""List account balances - - The *List account balances* endpoint returns a list of [account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) for a given company's connection. - - [Account balances](https://docs.codat.io/lending-api#/schemas/AccountBalance) are balances for a bank account, including end-of-day batch balance or running balances per transaction. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingAccountBalancesRequest - ) - request = cast(operations.ListBankingAccountBalancesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accountBalances", - 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-banking-account-balances", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccountBalances, 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_lending.api.account_balances import AccountBalances diff --git a/lending/src/codat_lending/account_transactions.py b/lending/src/codat_lending/account_transactions.py index 2b1df525a..f9db13107 100644 --- a/lending/src/codat_lending/account_transactions.py +++ b/lending/src/codat_lending/account_transactions.py @@ -1,443 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.account_transactions — re-export of the account_transactions method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class AccountTransactions(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingAccountTransactionRequest, - operations.GetAccountingAccountTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccountTransaction: - r"""Get account transaction - - The *Get account transaction* endpoint returns a single account transaction for a given accountTransactionId. - - [Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingAccountTransactionRequest - ) - request = cast(operations.GetAccountingAccountTransactionRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/accountTransactions/{accountTransactionId}", - 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-accounting-account-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAccountTransaction, http_res - ) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingAccountTransactionRequest, - operations.GetAccountingAccountTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccountTransaction: - r"""Get account transaction - - The *Get account transaction* endpoint returns a single account transaction for a given accountTransactionId. - - [Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingAccountTransactionRequest - ) - request = cast(operations.GetAccountingAccountTransactionRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/accountTransactions/{accountTransactionId}", - 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-accounting-account-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAccountTransaction, http_res - ) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingAccountTransactionsRequest, - operations.ListAccountingAccountTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccountTransactions: - r"""List account transactions - - The *List account transactions* endpoint returns a list of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) for a given company's connection. - - [Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingAccountTransactionsRequest - ) - request = cast(operations.ListAccountingAccountTransactionsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/accountTransactions", - 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-accounting-account-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAccountTransactions, 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.ListAccountingAccountTransactionsRequest, - operations.ListAccountingAccountTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccountTransactions: - r"""List account transactions - - The *List account transactions* endpoint returns a list of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) for a given company's connection. - - [Account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction) represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingAccountTransactionsRequest - ) - request = cast(operations.ListAccountingAccountTransactionsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/accountTransactions", - 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-accounting-account-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAccountTransactions, 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_lending.api.account_transactions import AccountTransactions diff --git a/lending/src/codat_lending/accounts.py b/lending/src/codat_lending/accounts.py index 4182b20a0..c10e83d04 100644 --- a/lending/src/codat_lending/accounts.py +++ b/lending/src/codat_lending/accounts.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.accounts — re-export of the accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Accounts(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingBankAccountRequest, - operations.GetAccountingBankAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankAccount: - r"""Get bank account - - The *Get bank account* endpoint returns a single account for a given accountId. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.GetAccountingBankAccountRequest - ) - request = cast(operations.GetAccountingBankAccountRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{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="get-accounting-bank-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankAccount, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingBankAccountRequest, - operations.GetAccountingBankAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankAccount: - r"""Get bank account - - The *Get bank account* endpoint returns a single account for a given accountId. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.GetAccountingBankAccountRequest - ) - request = cast(operations.GetAccountingBankAccountRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{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="get-accounting-bank-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankAccount, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingBankAccountsRequest, - operations.ListAccountingBankAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankAccounts: - r"""List bank accounts - - The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/lending-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.ListAccountingBankAccountsRequest - ) - request = cast(operations.ListAccountingBankAccountsRequest, 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-accounting-bank-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankAccounts, 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.ListAccountingBankAccountsRequest, - operations.ListAccountingBankAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankAccounts: - r"""List bank accounts - - The *List bank accounts* endpoint returns a list of [bank accounts](https://docs.codat.io/lending-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.ListAccountingBankAccountsRequest - ) - request = cast(operations.ListAccountingBankAccountsRequest, 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-accounting-bank-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankAccounts, 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_lending.api.accounts import Accounts diff --git a/lending/src/codat_lending/accounts_payable.py b/lending/src/codat_lending/accounts_payable.py index d6a5dd50c..d42b1e4ee 100644 --- a/lending/src/codat_lending/accounts_payable.py +++ b/lending/src/codat_lending/accounts_payable.py @@ -1,33 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.accounts_payable — re-export of the accounts_payable method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.bill_credit_notes import BillCreditNotes -from codat_lending.bill_payments import BillPayments -from codat_lending.bills import Bills -from codat_lending.suppliers import Suppliers -from typing import Optional - - -class AccountsPayable(BaseSDK): - bills: Bills - suppliers: Suppliers - bill_credit_notes: BillCreditNotes - bill_payments: BillPayments - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.bills = Bills(self.sdk_configuration, parent_ref=self.parent_ref) - self.suppliers = Suppliers(self.sdk_configuration, parent_ref=self.parent_ref) - self.bill_credit_notes = BillCreditNotes( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.bill_payments = BillPayments( - self.sdk_configuration, parent_ref=self.parent_ref - ) +from codat_lending.api.accounts_payable import AccountsPayable diff --git a/lending/src/codat_lending/accounts_receivable.py b/lending/src/codat_lending/accounts_receivable.py index 15faf00b7..eab92a705 100644 --- a/lending/src/codat_lending/accounts_receivable.py +++ b/lending/src/codat_lending/accounts_receivable.py @@ -1,39 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.accounts_receivable — re-export of the accounts_receivable method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.credit_notes import CreditNotes -from codat_lending.customers import Customers -from codat_lending.direct_incomes import DirectIncomes -from codat_lending.invoices import Invoices -from codat_lending.payments import Payments -from codat_lending.reports import Reports -from typing import Optional - - -class AccountsReceivable(BaseSDK): - customers: Customers - direct_incomes: DirectIncomes - invoices: Invoices - credit_notes: CreditNotes - payments: Payments - reports: Reports - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.customers = Customers(self.sdk_configuration, parent_ref=self.parent_ref) - self.direct_incomes = DirectIncomes( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.invoices = Invoices(self.sdk_configuration, parent_ref=self.parent_ref) - self.credit_notes = CreditNotes( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.payments = Payments(self.sdk_configuration, parent_ref=self.parent_ref) - self.reports = Reports(self.sdk_configuration, parent_ref=self.parent_ref) +from codat_lending.api.accounts_receivable import AccountsReceivable diff --git a/lending/src/codat_lending/api/__init__.py b/lending/src/codat_lending/api/__init__.py new file mode 100644 index 000000000..c444cfaeb --- /dev/null +++ b/lending/src/codat_lending/api/__init__.py @@ -0,0 +1,63 @@ +# flake8: noqa + +# import apis into api package +from codat_lending.api.account_balances import AccountBalances +from codat_lending.api.account_transactions import AccountTransactions +from codat_lending.api.accounting_bank_data import AccountingBankData +from codat_lending.api.accounts import Accounts +from codat_lending.api.balance_sheet import BalanceSheet +from codat_lending.api.bank_accounts import BankAccounts +from codat_lending.api.bank_transactions import BankTransactions +from codat_lending.api.bank_statements import BankStatements +from codat_lending.api.banking_accounts import BankingAccounts +from codat_lending.api.bill_credit_notes import BillCreditNotes +from codat_lending.api.bill_payments import BillPayments +from codat_lending.api.bills import Bills +from codat_lending.api.cash_flow import CashFlow +from codat_lending.api.categorized_statement import CategorizedStatement +from codat_lending.api.companies import Companies +from codat_lending.api.company_info import CompanyInfo +from codat_lending.api.connections import Connections +from codat_lending.api.create_operations import CreateOperations +from codat_lending.api.credit_notes import CreditNotes +from codat_lending.api.customers import Customers +from codat_lending.api.data_integrity import DataIntegrity +from codat_lending.api.direct_costs import DirectCosts +from codat_lending.api.direct_incomes import DirectIncomes +from codat_lending.api.disputes import Disputes +from codat_lending.api.excel_reports import ExcelReports +from codat_lending.api.file_upload import FileUpload +from codat_lending.api.financial_statements_accounts import FinancialStatementsAccounts +from codat_lending.api.financial_summary import FinancialSummary +from codat_lending.api.invoices import Invoices +from codat_lending.api.journal_entries import JournalEntries +from codat_lending.api.journals import Journals +from codat_lending.api.liabilities import Liabilities +from codat_lending.api.loan_writeback_accounts import LoanWritebackAccounts +from codat_lending.api.loan_writeback_payments import LoanWritebackPayments +from codat_lending.api.loan_writeback_suppliers import LoanWritebackSuppliers +from codat_lending.api.locations import Locations +from codat_lending.api.manage_data import ManageData +from codat_lending.api.manage_reports import ManageReports +from codat_lending.api.metrics import Metrics +from codat_lending.api.orders import Orders +from codat_lending.api.payment_methods import PaymentMethods +from codat_lending.api.payments import Payments +from codat_lending.api.product_categories import ProductCategories +from codat_lending.api.products import Products +from codat_lending.api.profit_and_loss import ProfitAndLoss +from codat_lending.api.pull_operations import PullOperations +from codat_lending.api.refresh import Refresh +from codat_lending.api.reports import Reports +from codat_lending.api.sales_customers import SalesCustomers +from codat_lending.api.sales_payments import SalesPayments +from codat_lending.api.sales_reports import SalesReports +from codat_lending.api.sales_transactions import SalesTransactions +from codat_lending.api.source_accounts import SourceAccounts +from codat_lending.api.suppliers import Suppliers +from codat_lending.api.transaction_categories import TransactionCategories +from codat_lending.api.transactions import Transactions +from codat_lending.api.transactions_direct_costs import TransactionsDirectCosts +from codat_lending.api.transactions_transfers import TransactionsTransfers +from codat_lending.api.transfers import Transfers + diff --git a/lending/src/codat_lending/api/account_balances.py b/lending/src/codat_lending/api/account_balances.py new file mode 100644 index 000000000..bea843664 --- /dev/null +++ b/lending/src/codat_lending/api/account_balances.py @@ -0,0 +1,301 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankingaccountbalances import BankingAccountBalances + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class ListBankingAccountBalancesRequestTypedDict(TypedDict): + """TypedDict variant of ListBankingAccountBalancesRequest, 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 ListBankingAccountBalancesRequest(BaseModel): + """Request envelope for list_banking_account_balances.""" + 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 AccountBalances: + """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 list( + self, + *, + request: Union['ListBankingAccountBalancesRequest', 'ListBankingAccountBalancesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccountBalances: + """List account balances""" # noqa: E501 + + if isinstance(request, dict): + request = ListBankingAccountBalancesRequest.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_banking_account_balances_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': "BankingAccountBalances", + '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-banking-account-balances', + ) + 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['ListBankingAccountBalancesRequest', 'ListBankingAccountBalancesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccountBalances: + 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_banking_account_balances_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/banking-accountBalances', + 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/lending/src/codat_lending/api/account_transactions.py b/lending/src/codat_lending/api/account_transactions.py new file mode 100644 index 000000000..42b767fd4 --- /dev/null +++ b/lending/src/codat_lending/api/account_transactions.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingaccounttransaction import AccountingAccountTransaction +from codat_lending.models.shared.accountingaccounttransactions import AccountingAccountTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingAccountTransactionRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingAccountTransactionRequest, 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_transaction_id: Annotated[str, Field(description="Unique identifier for an account transaction.")] + + +class GetAccountingAccountTransactionRequest(BaseModel): + """Request envelope for get_accounting_account_transaction.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + account_transaction_id: Annotated[str, Field(description="Unique identifier for an account transaction.")] + + @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 ListAccountingAccountTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingAccountTransactionsRequest, 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 ListAccountingAccountTransactionsRequest(BaseModel): + """Request envelope for list_accounting_account_transactions.""" + 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 AccountTransactions: + """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['GetAccountingAccountTransactionRequest', 'GetAccountingAccountTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccountTransaction: + """Get account transaction""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingAccountTransactionRequest.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_accounting_account_transaction_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_transaction_id=request.account_transaction_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': "AccountingAccountTransaction", + '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='get-accounting-account-transaction', + ) + 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['GetAccountingAccountTransactionRequest', 'GetAccountingAccountTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccountTransaction: + 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_accounting_account_transaction_serialize( + self, + company_id, + connection_id, + account_transaction_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_transaction_id is not None: + _path_params['accountTransactionId'] = account_transaction_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}/data/accountTransactions/{accountTransactionId}', + 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['ListAccountingAccountTransactionsRequest', 'ListAccountingAccountTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccountTransactions: + """List account transactions""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingAccountTransactionsRequest.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_accounting_account_transactions_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': "AccountingAccountTransactions", + '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-accounting-account-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 list_async( + self, + *, + request: Union['ListAccountingAccountTransactionsRequest', 'ListAccountingAccountTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccountTransactions: + 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_accounting_account_transactions_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/accountTransactions', + 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/lending/src/codat_lending/api/accounting_bank_data.py b/lending/src/codat_lending/api/accounting_bank_data.py new file mode 100644 index 000000000..f97ec8eff --- /dev/null +++ b/lending/src/codat_lending/api/accounting_bank_data.py @@ -0,0 +1,312 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 +# CODAT_GROUP_IMPORTS: AccountingBankData +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.api.accounts import Accounts + +from codat_lending.models.shared.accountingbanktransactions import AccountingBankTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class ListAccountingBankAccountTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBankAccountTransactionsRequest, 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.")] + 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 ListAccountingBankAccountTransactionsRequest(BaseModel): + """Request envelope for list_accounting_bank_account_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.")] + 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 AccountingBankData: + """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 + # CODAT_GROUP_CHILDREN_BEGIN: AccountingBankData + self.accounts = Accounts(api_client=self.api_client) + # CODAT_GROUP_CHILDREN_END: AccountingBankData + + + @validate_call(config={"arbitrary_types_allowed": True}) + def list_transactions( + self, + *, + request: Union['ListAccountingBankAccountTransactionsRequest', 'ListAccountingBankAccountTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankTransactions: + """List bank account transactions""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBankAccountTransactionsRequest.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_accounting_bank_account_transactions_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + account_id=request.account_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': "AccountingBankTransactions", + '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-accounting-bank-account-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 list_transactions_async( + self, + *, + request: Union['ListAccountingBankAccountTransactionsRequest', 'ListAccountingBankAccountTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankTransactions: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_transactions( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_bank_account_transactions_serialize( + self, + company_id, + connection_id, + account_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 + if account_id is not None: + _path_params['accountId'] = account_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/{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 + ) + + diff --git a/lending/src/codat_lending/api/accounts.py b/lending/src/codat_lending/api/accounts.py new file mode 100644 index 000000000..b7fba4fde --- /dev/null +++ b/lending/src/codat_lending/api/accounts.py @@ -0,0 +1,523 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingbankaccount import AccountingBankAccount +from codat_lending.models.shared.accountingbankaccounts import AccountingBankAccounts + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingBankAccountRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBankAccountRequest, 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 GetAccountingBankAccountRequest(BaseModel): + """Request envelope for get_accounting_bank_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 ListAccountingBankAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBankAccountsRequest, 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 ListAccountingBankAccountsRequest(BaseModel): + """Request envelope for list_accounting_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 Accounts: + """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['GetAccountingBankAccountRequest', 'GetAccountingBankAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankAccount: + """Get bank account""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBankAccountRequest.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_accounting_bank_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]] = { + '200': "AccountingBankAccount", + '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='get-accounting-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 get_async( + self, + *, + request: Union['GetAccountingBankAccountRequest', 'GetAccountingBankAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankAccount: + 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_accounting_bank_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='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/bankAccounts/{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 list( + self, + *, + request: Union['ListAccountingBankAccountsRequest', 'ListAccountingBankAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankAccounts: + """List bank accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBankAccountsRequest.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_accounting_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': "AccountingBankAccounts", + '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-accounting-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['ListAccountingBankAccountsRequest', 'ListAccountingBankAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBankAccounts: + 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_accounting_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/lending/src/codat_lending/api/accounts_payable.py b/lending/src/codat_lending/api/accounts_payable.py new file mode 100644 index 000000000..faf0688ae --- /dev/null +++ b/lending/src/codat_lending/api/accounts_payable.py @@ -0,0 +1,29 @@ +"""Generated wrapper exposing the accounts-payable sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.bill_credit_notes import BillCreditNotes +from codat_lending.api.bill_payments import BillPayments +from codat_lending.api.bills import Bills +from codat_lending.api.suppliers import Suppliers + + +class AccountsPayable: + bill_credit_notes: BillCreditNotes + bill_payments: BillPayments + bills: Bills + suppliers: Suppliers + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.bill_credit_notes = BillCreditNotes(api_client=self.api_client) + self.bill_payments = BillPayments(api_client=self.api_client) + self.bills = Bills(api_client=self.api_client) + self.suppliers = Suppliers(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/accounts_receivable.py b/lending/src/codat_lending/api/accounts_receivable.py new file mode 100644 index 000000000..83ca7b749 --- /dev/null +++ b/lending/src/codat_lending/api/accounts_receivable.py @@ -0,0 +1,35 @@ +"""Generated wrapper exposing the accounts-receivable sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.credit_notes import CreditNotes +from codat_lending.api.customers import Customers +from codat_lending.api.direct_incomes import DirectIncomes +from codat_lending.api.invoices import Invoices +from codat_lending.api.payments import Payments +from codat_lending.api.reports import Reports + + +class AccountsReceivable: + credit_notes: CreditNotes + customers: Customers + direct_incomes: DirectIncomes + invoices: Invoices + payments: Payments + reports: Reports + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.credit_notes = CreditNotes(api_client=self.api_client) + self.customers = Customers(api_client=self.api_client) + self.direct_incomes = DirectIncomes(api_client=self.api_client) + self.invoices = Invoices(api_client=self.api_client) + self.payments = Payments(api_client=self.api_client) + self.reports = Reports(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/balance_sheet.py b/lending/src/codat_lending/api/balance_sheet.py new file mode 100644 index 000000000..0b02b3e7e --- /dev/null +++ b/lending/src/codat_lending/api/balance_sheet.py @@ -0,0 +1,513 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingbalancesheet import AccountingBalanceSheet +from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingBalanceSheetRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBalanceSheetRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: NotRequired[Annotated[Optional[str], Field(description="The month the report starts from.")]] + + +class GetAccountingBalanceSheetRequest(BaseModel): + """Request envelope for get_accounting_balance_sheet.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: Annotated[Optional[str], Field(description="The month the report starts from.")] = 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 GetCategorizedBalanceSheetStatementRequestTypedDict(TypedDict): + """TypedDict variant of GetCategorizedBalanceSheetStatementRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + number_of_periods: NotRequired[Annotated[Optional[int], Field(description="The number of periods to return. If not provided, 12 periods will be used as the default value.")]] + + +class GetCategorizedBalanceSheetStatementRequest(BaseModel): + """Request envelope for get_categorized_balance_sheet_statement.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + number_of_periods: Annotated[Optional[int], Field(description="The number of periods to return. If not provided, 12 periods will be used as the default value.")] = 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 BalanceSheet: + """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['GetAccountingBalanceSheetRequest', 'GetAccountingBalanceSheetRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBalanceSheet: + """Get balance sheet""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBalanceSheetRequest.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_accounting_balance_sheet_serialize( + company_id=request.company_id, + period_length=request.period_length, + periods_to_compare=request.periods_to_compare, + start_month=request.start_month, + _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': "AccountingBalanceSheet", + '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='get-accounting-balance-sheet', + ) + 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['GetAccountingBalanceSheetRequest', 'GetAccountingBalanceSheetRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBalanceSheet: + 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_accounting_balance_sheet_serialize( + self, + company_id, + period_length, + periods_to_compare, + start_month, + _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 period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if periods_to_compare is not None: + + _query_params.append(('periodsToCompare', periods_to_compare)) + + if start_month is not None: + + _query_params.append(('startMonth', start_month)) + + # 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}/data/financials/balanceSheet', + 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_categorized_accounts( + self, + *, + request: Union['GetCategorizedBalanceSheetStatementRequest', 'GetCategorizedBalanceSheetStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedFinancialReport: + """Get categorized balance sheet statement""" # noqa: E501 + + if isinstance(request, dict): + request = GetCategorizedBalanceSheetStatementRequest.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_categorized_balance_sheet_statement_serialize( + company_id=request.company_id, + report_date=request.report_date, + number_of_periods=request.number_of_periods, + _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': "EnhancedFinancialReport", + '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-categorized-balance-sheet-statement', + ) + 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_categorized_accounts_async( + self, + *, + request: Union['GetCategorizedBalanceSheetStatementRequest', 'GetCategorizedBalanceSheetStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedFinancialReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_categorized_accounts( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_categorized_balance_sheet_statement_serialize( + self, + company_id, + report_date, + number_of_periods, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + # 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}/reports/enhancedBalanceSheet/accounts', + 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/lending/src/codat_lending/api/bank_accounts.py b/lending/src/codat_lending/api/bank_accounts.py new file mode 100644 index 000000000..055d55dda --- /dev/null +++ b/lending/src/codat_lending/api/bank_accounts.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingbankaccount import AccountingBankAccount +from codat_lending.models.shared.accountingcreatebankaccountresponse import AccountingCreateBankAccountResponse +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + accounting_bank_account: NotRequired[Optional[AccountingBankAccount]] + + +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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + accounting_bank_account: Optional[AccountingBankAccount] = 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 GetCreateUpdateBankAccountsModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateUpdateBankAccountsModelRequest, 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 GetCreateUpdateBankAccountsModelRequest(BaseModel): + """Request envelope for get_create_update_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 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, + ) -> AccountingCreateBankAccountResponse: + """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, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + accounting_bank_account=request.accounting_bank_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': "AccountingCreateBankAccountResponse", + '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, + ) -> AccountingCreateBankAccountResponse: + 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, + allow_sync_on_push_complete, + accounting_bank_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 + # 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 accounting_bank_account is not None: + _body_params = accounting_bank_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='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_update_model( + self, + *, + request: Union['GetCreateUpdateBankAccountsModelRequest', 'GetCreateUpdateBankAccountsModelRequestTypedDict'], + 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 = GetCreateUpdateBankAccountsModelRequest.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_update_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-update-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_update_model_async( + self, + *, + request: Union['GetCreateUpdateBankAccountsModelRequest', 'GetCreateUpdateBankAccountsModelRequestTypedDict'], + 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_update_model( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_create_update_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 + ) + + diff --git a/lending/src/codat_lending/api/bank_statements.py b/lending/src/codat_lending/api/bank_statements.py new file mode 100644 index 000000000..7948b9e9b --- /dev/null +++ b/lending/src/codat_lending/api/bank_statements.py @@ -0,0 +1,1990 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, field_validator +from typing import Any, Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankstatementuploadconfiguration import BankStatementUploadConfiguration +from codat_lending.models.categorized_bank_statement_accounts import CategorizedBankStatementAccounts +from codat_lending.models.categorized_bank_statement_transactions import CategorizedBankStatementTransactions +from codat_lending.models.shared.enduploadsessionrequest import EndUploadSessionRequest +from codat_lending.models.shared.pulloperation import PullOperation +from codat_lending.models.shared.startuploadsessionrequest import StartUploadSessionRequest + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_lending.models.shared.bankingtransactions import BankingTransactions +from codat_lending.models.shared.bankingaccount import BankingAccount +UploadBankStatementDataRequestBody = TypeAliasType("UploadBankStatementDataRequestBody", Union[BankingTransactions, BankingAccount, Any]) + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadCategorizedBankStatementExcelRequestTypedDict(TypedDict): + """TypedDict variant of DownloadCategorizedBankStatementExcelRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: NotRequired[Annotated[Optional[str], Field(description="The maximum age of report to fetch.")]] + + +class DownloadCategorizedBankStatementExcelRequest(BaseModel): + """Request envelope for download_categorized_bank_statement_excel.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: Annotated[Optional[str], Field(description="The maximum age of report to fetch.")] = 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 EndBankStatementUploadSessionRequestTypedDict(TypedDict): + """TypedDict variant of EndBankStatementUploadSessionRequest, 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.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its sync.")] + end_upload_session_request: NotRequired[Optional[EndUploadSessionRequest]] + + +class EndBankStatementUploadSessionRequest(BaseModel): + """Request envelope for end_bank_statement_upload_session.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its sync.")] + end_upload_session_request: Optional[EndUploadSessionRequest] = 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 GetBankStatementUploadConfigurationRequestTypedDict(TypedDict): + """TypedDict variant of GetBankStatementUploadConfigurationRequest, 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 GetBankStatementUploadConfigurationRequest(BaseModel): + """Request envelope for get_bank_statement_upload_configuration.""" + 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 GetCategorizedBankStatementTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of GetCategorizedBankStatementTransactionsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: NotRequired[Annotated[Optional[str], Field(description="The maximum age of report to fetch.")]] + 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 GetCategorizedBankStatementTransactionsRequest(BaseModel): + """Request envelope for get_categorized_bank_statement_transactions.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: Annotated[Optional[str], Field(description="The maximum age of report to fetch.")] = None + 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 ListCategorizedBankStatementAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListCategorizedBankStatementAccountsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: NotRequired[Annotated[Optional[str], Field(description="The maximum age of report to fetch.")]] + 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 ListCategorizedBankStatementAccountsRequest(BaseModel): + """Request envelope for list_categorized_bank_statement_accounts.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: Annotated[Optional[str], Field(description="The maximum age of report to fetch.")] = None + 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 SetBankStatementUploadConfigurationRequestTypedDict(TypedDict): + """TypedDict variant of SetBankStatementUploadConfigurationRequest, 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_statement_upload_configuration: NotRequired[Optional[BankStatementUploadConfiguration]] + + +class SetBankStatementUploadConfigurationRequest(BaseModel): + """Request envelope for set_bank_statement_upload_configuration.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bank_statement_upload_configuration: Optional[BankStatementUploadConfiguration] = 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 StartBankStatementUploadSessionRequestTypedDict(TypedDict): + """TypedDict variant of StartBankStatementUploadSessionRequest, 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.")] + start_upload_session_request: NotRequired[Optional[StartUploadSessionRequest]] + + +class StartBankStatementUploadSessionRequest(BaseModel): + """Request envelope for start_bank_statement_upload_session.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + start_upload_session_request: Optional[StartUploadSessionRequest] = 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 UploadBankStatementDataRequestTypedDict(TypedDict): + """TypedDict variant of UploadBankStatementDataRequest, 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.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its sync.")] + request_body: Union[UploadBankStatementDataRequestBody, Any] + path: NotRequired[Annotated[Optional[str], Field(description="The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`.")]] + + +class UploadBankStatementDataRequest(BaseModel): + """Request envelope for upload_bank_statement_data.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its sync.")] + request_body: Union[UploadBankStatementDataRequestBody, Any] + path: Annotated[Optional[str], Field(description="The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`.")] = 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 BankStatements: + """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 download_categorized_bank_statement_excel( + self, + *, + request: Union['DownloadCategorizedBankStatementExcelRequest', 'DownloadCategorizedBankStatementExcelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download categorized bank statement Excel""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadCategorizedBankStatementExcelRequest.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._download_categorized_bank_statement_excel_serialize( + company_id=request.company_id, + report_id=request.report_id, + max_age=request.max_age, + _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': "bytearray", + '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='download-categorized-bank-statement-excel', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_categorized_bank_statement_excel_async( + self, + *, + request: Union['DownloadCategorizedBankStatementExcelRequest', 'DownloadCategorizedBankStatementExcelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_categorized_bank_statement_excel( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_categorized_bank_statement_excel_serialize( + self, + company_id, + report_id, + max_age, + _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 report_id is not None: + _path_params['reportId'] = report_id + # process the query parameters + if max_age is not None: + + _query_params.append(('maxAge', max_age)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/reports/categorizedBankStatement/{reportId}/excel', + 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 end_upload_session( + self, + *, + request: Union['EndBankStatementUploadSessionRequest', 'EndBankStatementUploadSessionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """End upload session""" # noqa: E501 + + if isinstance(request, dict): + request = EndBankStatementUploadSessionRequest.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._end_bank_statement_upload_session_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + dataset_id=request.dataset_id, + end_upload_session_request=request.end_upload_session_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': 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='end-bank-statement-upload-session', + ) + 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 end_upload_session_async( + self, + *, + request: Union['EndBankStatementUploadSessionRequest', 'EndBankStatementUploadSessionRequestTypedDict'], + 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.end_upload_session( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _end_bank_statement_upload_session_serialize( + self, + company_id, + connection_id, + dataset_id, + end_upload_session_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 + if connection_id is not None: + _path_params['connectionId'] = connection_id + if dataset_id is not None: + _path_params['datasetId'] = dataset_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if end_upload_session_request is not None: + _body_params = end_upload_session_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='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/bankStatements/upload/dataset/{datasetId}/endSession', + 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_upload_configuration( + self, + *, + request: Union['GetBankStatementUploadConfigurationRequest', 'GetBankStatementUploadConfigurationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankStatementUploadConfiguration: + """Get upload configuration""" # noqa: E501 + + if isinstance(request, dict): + request = GetBankStatementUploadConfigurationRequest.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_statement_upload_configuration_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': "BankStatementUploadConfiguration", + '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-bank-statement-upload-configuration', + ) + 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_upload_configuration_async( + self, + *, + request: Union['GetBankStatementUploadConfigurationRequest', 'GetBankStatementUploadConfigurationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankStatementUploadConfiguration: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_upload_configuration( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_bank_statement_upload_configuration_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}/bankStatements/upload/configuration', + 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_categorized_bank_statement_transactions( + self, + *, + request: Union['GetCategorizedBankStatementTransactionsRequest', 'GetCategorizedBankStatementTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CategorizedBankStatementTransactions: + """Get categorized bank statement transactions""" # noqa: E501 + + if isinstance(request, dict): + request = GetCategorizedBankStatementTransactionsRequest.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_categorized_bank_statement_transactions_serialize( + company_id=request.company_id, + report_id=request.report_id, + max_age=request.max_age, + 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': "CategorizedBankStatementTransactions", + '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-categorized-bank-statement-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 get_categorized_bank_statement_transactions_async( + self, + *, + request: Union['GetCategorizedBankStatementTransactionsRequest', 'GetCategorizedBankStatementTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CategorizedBankStatementTransactions: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_categorized_bank_statement_transactions( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_categorized_bank_statement_transactions_serialize( + self, + company_id, + report_id, + max_age, + 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 report_id is not None: + _path_params['reportId'] = report_id + # process the query parameters + if max_age is not None: + + _query_params.append(('maxAge', max_age)) + + 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}/reports/categorizedBankStatement/{reportId}/transactions', + 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_categorized_bank_statement_accounts( + self, + *, + request: Union['ListCategorizedBankStatementAccountsRequest', 'ListCategorizedBankStatementAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CategorizedBankStatementAccounts: + """List categorized bank statement accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListCategorizedBankStatementAccountsRequest.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_categorized_bank_statement_accounts_serialize( + company_id=request.company_id, + report_id=request.report_id, + max_age=request.max_age, + 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': "CategorizedBankStatementAccounts", + '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-categorized-bank-statement-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_categorized_bank_statement_accounts_async( + self, + *, + request: Union['ListCategorizedBankStatementAccountsRequest', 'ListCategorizedBankStatementAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CategorizedBankStatementAccounts: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_categorized_bank_statement_accounts( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_categorized_bank_statement_accounts_serialize( + self, + company_id, + report_id, + max_age, + 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 report_id is not None: + _path_params['reportId'] = report_id + # process the query parameters + if max_age is not None: + + _query_params.append(('maxAge', max_age)) + + 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}/reports/categorizedBankStatement/{reportId}/accounts', + 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 set_upload_configuration( + self, + *, + request: Union['SetBankStatementUploadConfigurationRequest', 'SetBankStatementUploadConfigurationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankStatementUploadConfiguration: + """Set upload configuration""" # noqa: E501 + + if isinstance(request, dict): + request = SetBankStatementUploadConfigurationRequest.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._set_bank_statement_upload_configuration_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + bank_statement_upload_configuration=request.bank_statement_upload_configuration, + _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': "BankStatementUploadConfiguration", + '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='set-bank-statement-upload-configuration', + ) + 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 set_upload_configuration_async( + self, + *, + request: Union['SetBankStatementUploadConfigurationRequest', 'SetBankStatementUploadConfigurationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankStatementUploadConfiguration: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.set_upload_configuration( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _set_bank_statement_upload_configuration_serialize( + self, + company_id, + connection_id, + bank_statement_upload_configuration, + _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_statement_upload_configuration is not None: + _body_params = bank_statement_upload_configuration + + + 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}/bankStatements/upload/configuration', + 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 start_upload_session( + self, + *, + request: Union['StartBankStatementUploadSessionRequest', 'StartBankStatementUploadSessionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + """Start upload session""" # noqa: E501 + + if isinstance(request, dict): + request = StartBankStatementUploadSessionRequest.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._start_bank_statement_upload_session_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + start_upload_session_request=request.start_upload_session_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': "PullOperation", + '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='start-bank-statement-upload-session', + ) + 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 start_upload_session_async( + self, + *, + request: Union['StartBankStatementUploadSessionRequest', 'StartBankStatementUploadSessionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.start_upload_session( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _start_bank_statement_upload_session_serialize( + self, + company_id, + connection_id, + start_upload_session_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 + 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 start_upload_session_request is not None: + _body_params = start_upload_session_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='POST', + resource_path='/companies/{companyId}/connections/{connectionId}/bankStatements/upload/startSession', + 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 upload_bank_statement_data( + self, + *, + request: Union['UploadBankStatementDataRequest', 'UploadBankStatementDataRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Upload data""" # noqa: E501 + + if isinstance(request, dict): + request = UploadBankStatementDataRequest.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._upload_bank_statement_data_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + dataset_id=request.dataset_id, + request_body=request.request_body, + path=request.path, + _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='upload-bank-statement-data', + ) + 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 upload_bank_statement_data_async( + self, + *, + request: Union['UploadBankStatementDataRequest', 'UploadBankStatementDataRequestTypedDict'], + 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.upload_bank_statement_data( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _upload_bank_statement_data_serialize( + self, + company_id, + connection_id, + dataset_id, + request_body, + path, + _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 dataset_id is not None: + _path_params['datasetId'] = dataset_id + # process the query parameters + if path is not None: + + _query_params.append(('path', path)) + + # 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}/bankStatements/upload/dataset/{datasetId}/upload', + 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/lending/src/codat_lending/api/bank_transactions.py b/lending/src/codat_lending/api/bank_transactions.py new file mode 100644 index 000000000..dcdf6eb22 --- /dev/null +++ b/lending/src/codat_lending/api/bank_transactions.py @@ -0,0 +1,531 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcreatebanktransactions import AccountingCreateBankTransactions +from codat_lending.models.shared.accountingcreatebanktransactionsresponse import AccountingCreateBankTransactionsResponse +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.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.")]] + accounting_create_bank_transactions: NotRequired[Optional[AccountingCreateBankTransactions]] + + +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 + accounting_create_bank_transactions: Optional[AccountingCreateBankTransactions] = 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 BankTransactions: + """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, + ) -> AccountingCreateBankTransactionsResponse: + """Create bank account 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, + accounting_create_bank_transactions=request.accounting_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': "AccountingCreateBankTransactionsResponse", + '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, + ) -> AccountingCreateBankTransactionsResponse: + 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, + accounting_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 accounting_create_bank_transactions is not None: + _body_params = accounting_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 account 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 + ) + + diff --git a/lending/src/codat_lending/api/banking.py b/lending/src/codat_lending/api/banking.py new file mode 100644 index 000000000..e5eab3e1f --- /dev/null +++ b/lending/src/codat_lending/api/banking.py @@ -0,0 +1,32 @@ +"""Generated wrapper exposing the banking sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.account_balances import AccountBalances +from codat_lending.api.banking_accounts import BankingAccounts +from codat_lending.api.categorized_statement import CategorizedStatement +from codat_lending.api.transaction_categories import TransactionCategories +from codat_lending.api.transactions import Transactions + + +class Banking: + account_balances: AccountBalances + accounts: BankingAccounts + categorized_statement: CategorizedStatement + transaction_categories: TransactionCategories + transactions: Transactions + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.account_balances = AccountBalances(api_client=self.api_client) + self.accounts = BankingAccounts(api_client=self.api_client) + self.categorized_statement = CategorizedStatement(api_client=self.api_client) + self.transaction_categories = TransactionCategories(api_client=self.api_client) + self.transactions = Transactions(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/banking_accounts.py b/lending/src/codat_lending/api/banking_accounts.py new file mode 100644 index 000000000..bc0d99b0c --- /dev/null +++ b/lending/src/codat_lending/api/banking_accounts.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankingaccount import BankingAccount +from codat_lending.models.shared.bankingaccounts import BankingAccounts + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetBankingAccountRequestTypedDict(TypedDict): + """TypedDict variant of GetBankingAccountRequest, 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 GetBankingAccountRequest(BaseModel): + """Request envelope for get_banking_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 ListBankingAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListBankingAccountsRequest, 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 ListBankingAccountsRequest(BaseModel): + """Request envelope for list_banking_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 BankingAccounts: + """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['GetBankingAccountRequest', 'GetBankingAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccount: + """Get account""" # noqa: E501 + + if isinstance(request, dict): + request = GetBankingAccountRequest.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_banking_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]] = { + '200': "BankingAccount", + '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='get-banking-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 get_async( + self, + *, + request: Union['GetBankingAccountRequest', 'GetBankingAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccount: + 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_banking_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='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/banking-accounts/{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 list( + self, + *, + request: Union['ListBankingAccountsRequest', 'ListBankingAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccounts: + """List accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListBankingAccountsRequest.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_banking_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': "BankingAccounts", + '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-banking-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['ListBankingAccountsRequest', 'ListBankingAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingAccounts: + 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_banking_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/banking-accounts', + 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/lending/src/codat_lending/api/bill_credit_notes.py b/lending/src/codat_lending/api/bill_credit_notes.py new file mode 100644 index 000000000..9a8f1f572 --- /dev/null +++ b/lending/src/codat_lending/api/bill_credit_notes.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNote +from codat_lending.models.shared.accountingbillcreditnotes import AccountingBillCreditNotes + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingBillCreditNoteRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBillCreditNoteRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_credit_note_id: Annotated[str, Field(description="Unique identifier for a bill credit note.")] + + +class GetAccountingBillCreditNoteRequest(BaseModel): + """Request envelope for get_accounting_bill_credit_note.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_credit_note_id: Annotated[str, Field(description="Unique identifier for a bill credit note.")] + + @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 ListAccountingBillCreditNotesRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBillCreditNotesRequest, 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 ListAccountingBillCreditNotesRequest(BaseModel): + """Request envelope for list_accounting_bill_credit_notes.""" + 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 BillCreditNotes: + """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['GetAccountingBillCreditNoteRequest', 'GetAccountingBillCreditNoteRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillCreditNote: + """Get bill credit note""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBillCreditNoteRequest.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_accounting_bill_credit_note_serialize( + company_id=request.company_id, + bill_credit_note_id=request.bill_credit_note_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': "AccountingBillCreditNote", + '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='get-accounting-bill-credit-note', + ) + 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['GetAccountingBillCreditNoteRequest', 'GetAccountingBillCreditNoteRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillCreditNote: + 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_accounting_bill_credit_note_serialize( + self, + company_id, + bill_credit_note_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 bill_credit_note_id is not None: + _path_params['billCreditNoteId'] = bill_credit_note_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}/data/billCreditNotes/{billCreditNoteId}', + 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['ListAccountingBillCreditNotesRequest', 'ListAccountingBillCreditNotesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillCreditNotes: + """List bill credit notes""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBillCreditNotesRequest.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_accounting_bill_credit_notes_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': "AccountingBillCreditNotes", + '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-accounting-bill-credit-notes', + ) + 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['ListAccountingBillCreditNotesRequest', 'ListAccountingBillCreditNotesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillCreditNotes: + 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_accounting_bill_credit_notes_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}/data/billCreditNotes', + 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/lending/src/codat_lending/api/bill_payments.py b/lending/src/codat_lending/api/bill_payments.py new file mode 100644 index 000000000..b455fe653 --- /dev/null +++ b/lending/src/codat_lending/api/bill_payments.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingbillpayment import AccountingBillPayment +from codat_lending.models.shared.accountingbillpayments import AccountingBillPayments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingBillPaymentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBillPaymentRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_payment_id: Annotated[str, Field(description="Unique identifier for a bill payment.")] + + +class GetAccountingBillPaymentRequest(BaseModel): + """Request envelope for get_accounting_bill_payment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_payment_id: Annotated[str, Field(description="Unique identifier for a bill payment.")] + + @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 ListAccountingBillPaymentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBillPaymentsRequest, 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 ListAccountingBillPaymentsRequest(BaseModel): + """Request envelope for list_accounting_bill_payments.""" + 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 BillPayments: + """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['GetAccountingBillPaymentRequest', 'GetAccountingBillPaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillPayment: + """Get bill payment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBillPaymentRequest.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_accounting_bill_payment_serialize( + company_id=request.company_id, + bill_payment_id=request.bill_payment_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': "AccountingBillPayment", + '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='get-accounting-bill-payment', + ) + 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['GetAccountingBillPaymentRequest', 'GetAccountingBillPaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillPayment: + 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_accounting_bill_payment_serialize( + self, + company_id, + bill_payment_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 bill_payment_id is not None: + _path_params['billPaymentId'] = bill_payment_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}/data/billPayments/{billPaymentId}', + 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['ListAccountingBillPaymentsRequest', 'ListAccountingBillPaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillPayments: + """List bill payments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBillPaymentsRequest.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_accounting_bill_payments_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': "AccountingBillPayments", + '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-accounting-bill-payments', + ) + 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['ListAccountingBillPaymentsRequest', 'ListAccountingBillPaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBillPayments: + 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_accounting_bill_payments_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}/data/billPayments', + 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/lending/src/codat_lending/api/bills.py b/lending/src/codat_lending/api/bills.py new file mode 100644 index 000000000..fdd8dd83b --- /dev/null +++ b/lending/src/codat_lending/api/bills.py @@ -0,0 +1,1210 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingbill import AccountingBill +from codat_lending.models.shared.accountingbills import AccountingBills +from codat_lending.models.shared.attachments import Attachments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingBillAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingBillAttachmentRequest, 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.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingBillAttachmentRequest(BaseModel): + """Request envelope for download_accounting_bill_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 GetAccountingBillRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBillRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + + +class GetAccountingBillRequest(BaseModel): + """Request envelope for get_accounting_bill.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + + @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 GetAccountingBillAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingBillAttachmentRequest, 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.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class GetAccountingBillAttachmentRequest(BaseModel): + """Request envelope for get_accounting_bill_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 ListAccountingBillAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBillAttachmentsRequest, 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.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + + +class ListAccountingBillAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_bill_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + bill_id: Annotated[str, Field(description="Unique identifier for a bill.")] + + @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 ListAccountingBillsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingBillsRequest, 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 ListAccountingBillsRequest(BaseModel): + """Request envelope for list_accounting_bills.""" + 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 Bills: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingBillAttachmentRequest', 'DownloadAccountingBillAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download bill attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingBillAttachmentRequest.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._download_accounting_bill_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + bill_id=request.bill_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-bill-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingBillAttachmentRequest', 'DownloadAccountingBillAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_bill_attachment_serialize( + self, + company_id, + connection_id, + bill_id, + attachment_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 bill_id is not None: + _path_params['billId'] = bill_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}/download', + 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['GetAccountingBillRequest', 'GetAccountingBillRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBill: + """Get bill""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBillRequest.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_accounting_bill_serialize( + company_id=request.company_id, + bill_id=request.bill_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': "AccountingBill", + '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='get-accounting-bill', + ) + 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['GetAccountingBillRequest', 'GetAccountingBillRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBill: + 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_accounting_bill_serialize( + self, + company_id, + bill_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 bill_id is not None: + _path_params['billId'] = bill_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}/data/bills/{billId}', + 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_attachment( + self, + *, + request: Union['GetAccountingBillAttachmentRequest', 'GetAccountingBillAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get bill attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingBillAttachmentRequest.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_accounting_bill_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + bill_id=request.bill_id, + attachment_id=request.attachment_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': "AccountingAttachment", + '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-accounting-bill-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingBillAttachmentRequest', 'GetAccountingBillAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_bill_attachment_serialize( + self, + company_id, + connection_id, + bill_id, + attachment_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 bill_id is not None: + _path_params['billId'] = bill_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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}/data/bills/{billId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingBillAttachmentsRequest', 'ListAccountingBillAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List bill attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBillAttachmentsRequest.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_accounting_bill_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + bill_id=request.bill_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': "Attachments", + '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-accounting-bill-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingBillAttachmentsRequest', 'ListAccountingBillAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_bill_attachments_serialize( + self, + company_id, + connection_id, + bill_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 bill_id is not None: + _path_params['billId'] = bill_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}/data/bills/{billId}/attachments', + 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['ListAccountingBillsRequest', 'ListAccountingBillsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBills: + """List bills""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingBillsRequest.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_accounting_bills_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': "AccountingBills", + '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-accounting-bills', + ) + 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['ListAccountingBillsRequest', 'ListAccountingBillsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingBills: + 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_accounting_bills_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}/data/bills', + 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/lending/src/codat_lending/api/cash_flow.py b/lending/src/codat_lending/api/cash_flow.py new file mode 100644 index 000000000..8ec651dfc --- /dev/null +++ b/lending/src/codat_lending/api/cash_flow.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcashflowstatement import AccountingCashFlowStatement + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingCashFlowStatementRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingCashFlowStatementRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: NotRequired[Annotated[Optional[str], Field(description="The month the report starts from.")]] + + +class GetAccountingCashFlowStatementRequest(BaseModel): + """Request envelope for get_accounting_cash_flow_statement.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: Annotated[Optional[str], Field(description="The month the report starts from.")] = 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 CashFlow: + """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['GetAccountingCashFlowStatementRequest', 'GetAccountingCashFlowStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCashFlowStatement: + """Get cash flow statement""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingCashFlowStatementRequest.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_accounting_cash_flow_statement_serialize( + company_id=request.company_id, + period_length=request.period_length, + periods_to_compare=request.periods_to_compare, + start_month=request.start_month, + _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': "AccountingCashFlowStatement", + '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='get-accounting-cash-flow-statement', + ) + 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['GetAccountingCashFlowStatementRequest', 'GetAccountingCashFlowStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCashFlowStatement: + 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_accounting_cash_flow_statement_serialize( + self, + company_id, + period_length, + periods_to_compare, + start_month, + _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 period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if periods_to_compare is not None: + + _query_params.append(('periodsToCompare', periods_to_compare)) + + if start_month is not None: + + _query_params.append(('startMonth', start_month)) + + # 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}/data/financials/cashFlowStatement', + 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/lending/src/codat_lending/api/categorized_statement.py b/lending/src/codat_lending/api/categorized_statement.py new file mode 100644 index 000000000..22ee331fe --- /dev/null +++ b/lending/src/codat_lending/api/categorized_statement.py @@ -0,0 +1,286 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.enhancedcashflowtransactions import EnhancedCashFlowTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCategorizedBankStatementRequestTypedDict(TypedDict): + """TypedDict variant of GetCategorizedBankStatementRequest, 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).")]] + + +class GetCategorizedBankStatementRequest(BaseModel): + """Request envelope for get_categorized_bank_statement.""" + 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 + + @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 CategorizedStatement: + """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['GetCategorizedBankStatementRequest', 'GetCategorizedBankStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedCashFlowTransactions: + """Get categorized bank statement""" # noqa: E501 + + if isinstance(request, dict): + request = GetCategorizedBankStatementRequest.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_categorized_bank_statement_serialize( + company_id=request.company_id, + page=request.page, + page_size=request.page_size, + query=request.query, + _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': "EnhancedCashFlowTransactions", + '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-categorized-bank-statement', + ) + 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['GetCategorizedBankStatementRequest', 'GetCategorizedBankStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedCashFlowTransactions: + 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_categorized_bank_statement_serialize( + self, + company_id, + page, + page_size, + query, + _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)) + + # 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}/reports/enhancedCashFlow/transactions', + 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/lending/src/codat_lending/api/companies.py b/lending/src/codat_lending/api/companies.py new file mode 100644 index 000000000..a3df74ddf --- /dev/null +++ b/lending/src/codat_lending/api/companies.py @@ -0,0 +1,1390 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict +from codat_lending.models.shared.companyupdaterequest import CompanyUpdateRequest + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.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 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 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/lending/src/codat_lending/api/company_info.py b/lending/src/codat_lending/api/company_info.py new file mode 100644 index 000000000..998ea742a --- /dev/null +++ b/lending/src/codat_lending/api/company_info.py @@ -0,0 +1,478 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcompanyinfo import AccountingCompanyInfo +from codat_lending.models.shared.commercecompanyinfo import CommerceCompanyInfo + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingProfileRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingProfileRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class GetAccountingProfileRequest(BaseModel): + """Request envelope for get_accounting_profile.""" + 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 GetCommerceProfileRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceProfileRequest, 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 GetCommerceProfileRequest(BaseModel): + """Request envelope for get_commerce_profile.""" + 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 CompanyInfo: + """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_accounting_profile( + self, + *, + request: Union['GetAccountingProfileRequest', 'GetAccountingProfileRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCompanyInfo: + """Get company accounting profile""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingProfileRequest.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_accounting_profile_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': "AccountingCompanyInfo", + '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='get-accounting-profile', + ) + 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_accounting_profile_async( + self, + *, + request: Union['GetAccountingProfileRequest', 'GetAccountingProfileRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCompanyInfo: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_accounting_profile( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_profile_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}/data/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 + ) + + + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_commerce_profile( + self, + *, + request: Union['GetCommerceProfileRequest', 'GetCommerceProfileRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCompanyInfo: + """Get company commerce profile""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceProfileRequest.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_commerce_profile_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': "CommerceCompanyInfo", + '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='get-commerce-profile', + ) + 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_commerce_profile_async( + self, + *, + request: Union['GetCommerceProfileRequest', 'GetCommerceProfileRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCompanyInfo: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_commerce_profile( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_profile_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}/data/commerce-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/lending/src/codat_lending/api/connections.py b/lending/src/codat_lending/api/connections.py new file mode 100644 index 000000000..81d0a759d --- /dev/null +++ b/lending/src/codat_lending/api/connections.py @@ -0,0 +1,1186 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.connection import Connection +from codat_lending.models.shared.connections import Connections +from codat_lending.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_lending.models.update_connection import UpdateConnection + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.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/lending/src/codat_lending/api/create_operations.py b/lending/src/codat_lending/api/create_operations.py new file mode 100644 index 000000000..87738a82a --- /dev/null +++ b/lending/src/codat_lending/api/create_operations.py @@ -0,0 +1,510 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.pushoperation import PushOperation +from codat_lending.models.shared.pushoperations import PushOperations + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +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="Unique identifier for the push operation.")] + + +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="Unique identifier for the push operation.")] + + @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 CreateOperations: + """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['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_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( + 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( + 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_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( + 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/lending/src/codat_lending/api/credit_notes.py b/lending/src/codat_lending/api/credit_notes.py new file mode 100644 index 000000000..30eb76ee5 --- /dev/null +++ b/lending/src/codat_lending/api/credit_notes.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcreditnote import AccountingCreditNote +from codat_lending.models.shared.accountingcreditnotes import AccountingCreditNotes + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingCreditNoteRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingCreditNoteRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + credit_note_id: Annotated[str, Field(description="Unique identifier for a credit note.")] + + +class GetAccountingCreditNoteRequest(BaseModel): + """Request envelope for get_accounting_credit_note.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + credit_note_id: Annotated[str, Field(description="Unique identifier for a credit note.")] + + @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 ListAccountingCreditNotesRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingCreditNotesRequest, 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 ListAccountingCreditNotesRequest(BaseModel): + """Request envelope for list_accounting_credit_notes.""" + 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 CreditNotes: + """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['GetAccountingCreditNoteRequest', 'GetAccountingCreditNoteRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreditNote: + """Get credit note""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingCreditNoteRequest.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_accounting_credit_note_serialize( + company_id=request.company_id, + credit_note_id=request.credit_note_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': "AccountingCreditNote", + '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='get-accounting-credit-note', + ) + 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['GetAccountingCreditNoteRequest', 'GetAccountingCreditNoteRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreditNote: + 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_accounting_credit_note_serialize( + self, + company_id, + credit_note_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 credit_note_id is not None: + _path_params['creditNoteId'] = credit_note_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}/data/creditNotes/{creditNoteId}', + 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['ListAccountingCreditNotesRequest', 'ListAccountingCreditNotesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreditNotes: + """List credit notes""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingCreditNotesRequest.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_accounting_credit_notes_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': "AccountingCreditNotes", + '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-accounting-credit-notes', + ) + 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['ListAccountingCreditNotesRequest', 'ListAccountingCreditNotesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreditNotes: + 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_accounting_credit_notes_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}/data/creditNotes', + 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/lending/src/codat_lending/api/customers.py b/lending/src/codat_lending/api/customers.py new file mode 100644 index 000000000..555beb73e --- /dev/null +++ b/lending/src/codat_lending/api/customers.py @@ -0,0 +1,1210 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingcustomer import AccountingCustomer +from codat_lending.models.shared.accountingcustomers import AccountingCustomers +from codat_lending.models.shared.attachments import Attachments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingCustomerAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingCustomerAttachmentRequest, 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.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingCustomerAttachmentRequest(BaseModel): + """Request envelope for download_accounting_customer_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 GetAccountingCustomerRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingCustomerRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + +class GetAccountingCustomerRequest(BaseModel): + """Request envelope for get_accounting_customer.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + @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 GetAccountingCustomerAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingCustomerAttachmentRequest, 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.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class GetAccountingCustomerAttachmentRequest(BaseModel): + """Request envelope for get_accounting_customer_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 ListAccountingCustomerAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingCustomerAttachmentsRequest, 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.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + +class ListAccountingCustomerAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_customer_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + @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 ListAccountingCustomersRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingCustomersRequest, 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 ListAccountingCustomersRequest(BaseModel): + """Request envelope for list_accounting_customers.""" + 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 Customers: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingCustomerAttachmentRequest', 'DownloadAccountingCustomerAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download customer attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingCustomerAttachmentRequest.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._download_accounting_customer_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + customer_id=request.customer_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-customer-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingCustomerAttachmentRequest', 'DownloadAccountingCustomerAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_customer_attachment_serialize( + self, + company_id, + connection_id, + customer_id, + attachment_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 customer_id is not None: + _path_params['customerId'] = customer_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}/download', + 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['GetAccountingCustomerRequest', 'GetAccountingCustomerRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCustomer: + """Get customer""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingCustomerRequest.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_accounting_customer_serialize( + company_id=request.company_id, + customer_id=request.customer_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': "AccountingCustomer", + '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='get-accounting-customer', + ) + 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['GetAccountingCustomerRequest', 'GetAccountingCustomerRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCustomer: + 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_accounting_customer_serialize( + self, + company_id, + customer_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 customer_id is not None: + _path_params['customerId'] = customer_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}/data/customers/{customerId}', + 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_attachment( + self, + *, + request: Union['GetAccountingCustomerAttachmentRequest', 'GetAccountingCustomerAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get customer attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingCustomerAttachmentRequest.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_accounting_customer_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + customer_id=request.customer_id, + attachment_id=request.attachment_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': "AccountingAttachment", + '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-accounting-customer-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingCustomerAttachmentRequest', 'GetAccountingCustomerAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_customer_attachment_serialize( + self, + company_id, + connection_id, + customer_id, + attachment_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 customer_id is not None: + _path_params['customerId'] = customer_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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}/data/customers/{customerId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingCustomerAttachmentsRequest', 'ListAccountingCustomerAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List customer attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingCustomerAttachmentsRequest.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_accounting_customer_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + customer_id=request.customer_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': "Attachments", + '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-accounting-customer-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingCustomerAttachmentsRequest', 'ListAccountingCustomerAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_customer_attachments_serialize( + self, + company_id, + connection_id, + customer_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 customer_id is not None: + _path_params['customerId'] = customer_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}/data/customers/{customerId}/attachments', + 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['ListAccountingCustomersRequest', 'ListAccountingCustomersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCustomers: + """List customers""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingCustomersRequest.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_accounting_customers_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': "AccountingCustomers", + '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-accounting-customers', + ) + 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['ListAccountingCustomersRequest', 'ListAccountingCustomersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCustomers: + 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_accounting_customers_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}/data/customers', + 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/lending/src/codat_lending/api/data_integrity.py b/lending/src/codat_lending/api/data_integrity.py new file mode 100644 index 000000000..6986334a4 --- /dev/null +++ b/lending/src/codat_lending/api/data_integrity.py @@ -0,0 +1,741 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing import Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.dataintegritydetails import DataIntegrityDetails +from codat_lending.models.shared.dataintegritystatuses import DataIntegrityStatuses +from codat_lending.models.shared.dataintegritysummaries import DataIntegritySummaries + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetDataIntegrityStatusRequestTypedDict(TypedDict): + """TypedDict variant of GetDataIntegrityStatusRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + + +class GetDataIntegrityStatusRequest(BaseModel): + """Request envelope for get_data_integrity_status.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + + @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 GetDataIntegritySummariesRequestTypedDict(TypedDict): + """TypedDict variant of GetDataIntegritySummariesRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + query: NotRequired[Annotated[Optional[str], Field(description="Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).")]] + + +class GetDataIntegritySummariesRequest(BaseModel): + """Request envelope for get_data_integrity_summaries.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + query: Annotated[Optional[str], Field(description="Codat query string. [Read more](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 ListDataIntegrityDetailsRequestTypedDict(TypedDict): + """TypedDict variant of ListDataIntegrityDetailsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + 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 ListDataIntegrityDetailsRequest(BaseModel): + """Request envelope for list_data_integrity_details.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[str, Field(description="A key for a Codat data type.")] + 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 DataIntegrity: + """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 status( + self, + *, + request: Union['GetDataIntegrityStatusRequest', 'GetDataIntegrityStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegrityStatuses: + """Get data integrity status""" # noqa: E501 + + if isinstance(request, dict): + request = GetDataIntegrityStatusRequest.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_data_integrity_status_serialize( + company_id=request.company_id, + data_type=request.data_type, + _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': "DataIntegrityStatuses", + '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-data-integrity-status', + ) + 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 status_async( + self, + *, + request: Union['GetDataIntegrityStatusRequest', 'GetDataIntegrityStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegrityStatuses: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.status( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_data_integrity_status_serialize( + self, + company_id, + data_type, + _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 data_type is not None: + _path_params['dataType'] = data_type + # 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='/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/status', + 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 summaries( + self, + *, + request: Union['GetDataIntegritySummariesRequest', 'GetDataIntegritySummariesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegritySummaries: + """Get data integrity summaries""" # noqa: E501 + + if isinstance(request, dict): + request = GetDataIntegritySummariesRequest.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_data_integrity_summaries_serialize( + company_id=request.company_id, + data_type=request.data_type, + query=request.query, + _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': "DataIntegritySummaries", + '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-data-integrity-summaries', + ) + 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 summaries_async( + self, + *, + request: Union['GetDataIntegritySummariesRequest', 'GetDataIntegritySummariesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegritySummaries: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.summaries( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_data_integrity_summaries_serialize( + self, + company_id, + data_type, + query, + _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 data_type is not None: + _path_params['dataType'] = data_type + # process the query parameters + if query is not None: + + _query_params.append(('query', query)) + + # 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='/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/summaries', + 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 details( + self, + *, + request: Union['ListDataIntegrityDetailsRequest', 'ListDataIntegrityDetailsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegrityDetails: + """List data integrity details""" # noqa: E501 + + if isinstance(request, dict): + request = ListDataIntegrityDetailsRequest.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_data_integrity_details_serialize( + company_id=request.company_id, + data_type=request.data_type, + 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': "DataIntegrityDetails", + '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-data-integrity-details', + ) + 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 details_async( + self, + *, + request: Union['ListDataIntegrityDetailsRequest', 'ListDataIntegrityDetailsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> DataIntegrityDetails: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.details( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_data_integrity_details_serialize( + self, + company_id, + data_type, + 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 data_type is not None: + _path_params['dataType'] = data_type + # 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='/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/details', + 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/lending/src/codat_lending/api/direct_costs.py b/lending/src/codat_lending/api/direct_costs.py new file mode 100644 index 000000000..3e15a0b66 --- /dev/null +++ b/lending/src/codat_lending/api/direct_costs.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcreatedirectcostresponse import AccountingCreateDirectCostResponse +from codat_lending.models.shared.directcostprototype import DirectCostPrototype +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class CreateDirectCostRequestTypedDict(TypedDict): + """TypedDict variant of CreateDirectCostRequest, 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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + direct_cost_prototype: NotRequired[Optional[DirectCostPrototype]] + + +class CreateDirectCostRequest(BaseModel): + """Request envelope for create_direct_cost.""" + 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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + direct_cost_prototype: Optional[DirectCostPrototype] = 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 GetCreateDirectCostsModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateDirectCostsModelRequest, 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 GetCreateDirectCostsModelRequest(BaseModel): + """Request envelope for get_create_direct_costs_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 DirectCosts: + """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['CreateDirectCostRequest', 'CreateDirectCostRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateDirectCostResponse: + """Create direct cost""" # noqa: E501 + + if isinstance(request, dict): + request = CreateDirectCostRequest.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_direct_cost_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + direct_cost_prototype=request.direct_cost_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': "AccountingCreateDirectCostResponse", + '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-direct-cost', + ) + 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['CreateDirectCostRequest', 'CreateDirectCostRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateDirectCostResponse: + 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_direct_cost_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + allow_sync_on_push_complete, + direct_cost_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)) + + 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 direct_cost_prototype is not None: + _body_params = direct_cost_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/directCosts', + 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['GetCreateDirectCostsModelRequest', 'GetCreateDirectCostsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create direct cost model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateDirectCostsModelRequest.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_direct_costs_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-directCosts-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['GetCreateDirectCostsModelRequest', 'GetCreateDirectCostsModelRequestTypedDict'], + 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_direct_costs_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/directCosts', + 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/lending/src/codat_lending/api/direct_incomes.py b/lending/src/codat_lending/api/direct_incomes.py new file mode 100644 index 000000000..600a73160 --- /dev/null +++ b/lending/src/codat_lending/api/direct_incomes.py @@ -0,0 +1,1230 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingdirectincome import AccountingDirectIncome +from codat_lending.models.shared.accountingdirectincomes import AccountingDirectIncomes +from codat_lending.models.shared.attachments import Attachments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingDirectIncomeAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingDirectIncomeAttachmentRequest, 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.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingDirectIncomeAttachmentRequest(BaseModel): + """Request envelope for download_accounting_direct_income_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 GetAccountingDirectIncomeRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingDirectIncomeRequest, 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.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + + +class GetAccountingDirectIncomeRequest(BaseModel): + """Request envelope for get_accounting_direct_income.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + + @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 GetAccountingDirectIncomeAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingDirectIncomeAttachmentRequest, 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.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + timeout_in_minutes: NotRequired[Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")]] + + +class GetAccountingDirectIncomeAttachmentRequest(BaseModel): + """Request envelope for get_accounting_direct_income_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + timeout_in_minutes: Annotated[Optional[int], Field(description="Time limit for the push operation to complete before it is timed out.")] = 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 ListAccountingDirectIncomeAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingDirectIncomeAttachmentsRequest, 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.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + + +class ListAccountingDirectIncomeAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_direct_income_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_income_id: Annotated[str, Field(description="Unique identifier for a direct income.")] + + @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 ListAccountingDirectIncomesRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingDirectIncomesRequest, 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 ListAccountingDirectIncomesRequest(BaseModel): + """Request envelope for list_accounting_direct_incomes.""" + 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 DirectIncomes: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingDirectIncomeAttachmentRequest', 'DownloadAccountingDirectIncomeAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download direct income attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingDirectIncomeAttachmentRequest.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._download_accounting_direct_income_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_income_id=request.direct_income_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-direct-income-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingDirectIncomeAttachmentRequest', 'DownloadAccountingDirectIncomeAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_direct_income_attachment_serialize( + self, + company_id, + connection_id, + direct_income_id, + attachment_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 direct_income_id is not None: + _path_params['directIncomeId'] = direct_income_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}/download', + 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['GetAccountingDirectIncomeRequest', 'GetAccountingDirectIncomeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectIncome: + """Get direct income""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingDirectIncomeRequest.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_accounting_direct_income_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_income_id=request.direct_income_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': "AccountingDirectIncome", + '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='get-accounting-direct-income', + ) + 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['GetAccountingDirectIncomeRequest', 'GetAccountingDirectIncomeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectIncome: + 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_accounting_direct_income_serialize( + self, + company_id, + connection_id, + direct_income_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 direct_income_id is not None: + _path_params['directIncomeId'] = direct_income_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}/data/directIncomes/{directIncomeId}', + 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_attachment( + self, + *, + request: Union['GetAccountingDirectIncomeAttachmentRequest', 'GetAccountingDirectIncomeAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get direct income attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingDirectIncomeAttachmentRequest.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_accounting_direct_income_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_income_id=request.direct_income_id, + attachment_id=request.attachment_id, + timeout_in_minutes=request.timeout_in_minutes, + _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': "AccountingAttachment", + '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-accounting-direct-income-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingDirectIncomeAttachmentRequest', 'GetAccountingDirectIncomeAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_direct_income_attachment_serialize( + self, + company_id, + connection_id, + direct_income_id, + attachment_id, + timeout_in_minutes, + _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 direct_income_id is not None: + _path_params['directIncomeId'] = direct_income_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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 '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/directIncomes/{directIncomeId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingDirectIncomeAttachmentsRequest', 'ListAccountingDirectIncomeAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List direct income attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingDirectIncomeAttachmentsRequest.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_accounting_direct_income_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_income_id=request.direct_income_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': "Attachments", + '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-accounting-direct-income-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingDirectIncomeAttachmentsRequest', 'ListAccountingDirectIncomeAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_direct_income_attachments_serialize( + self, + company_id, + connection_id, + direct_income_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 direct_income_id is not None: + _path_params['directIncomeId'] = direct_income_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}/data/directIncomes/{directIncomeId}/attachments', + 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['ListAccountingDirectIncomesRequest', 'ListAccountingDirectIncomesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectIncomes: + """List direct incomes""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingDirectIncomesRequest.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_accounting_direct_incomes_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': "AccountingDirectIncomes", + '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-accounting-direct-incomes', + ) + 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['ListAccountingDirectIncomesRequest', 'ListAccountingDirectIncomesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectIncomes: + 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_accounting_direct_incomes_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/directIncomes', + 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/lending/src/codat_lending/api/disputes.py b/lending/src/codat_lending/api/disputes.py new file mode 100644 index 000000000..f2a009e3f --- /dev/null +++ b/lending/src/codat_lending/api/disputes.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercedispute import CommerceDispute +from codat_lending.models.shared.commercedisputes import CommerceDisputes + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceDisputeRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceDisputeRequest, 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.")] + dispute_id: Annotated[str, Field(description="Unique identifier for a dispute.")] + + +class GetCommerceDisputeRequest(BaseModel): + """Request envelope for get_commerce_dispute.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + dispute_id: Annotated[str, Field(description="Unique identifier for a dispute.")] + + @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 ListCommerceDisputesRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceDisputesRequest, 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 ListCommerceDisputesRequest(BaseModel): + """Request envelope for list_commerce_disputes.""" + 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 Disputes: + """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['GetCommerceDisputeRequest', 'GetCommerceDisputeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceDispute: + """Get dispute""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceDisputeRequest.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_commerce_dispute_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + dispute_id=request.dispute_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': "CommerceDispute", + '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='get-commerce-dispute', + ) + 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['GetCommerceDisputeRequest', 'GetCommerceDisputeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceDispute: + 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_commerce_dispute_serialize( + self, + company_id, + connection_id, + dispute_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 dispute_id is not None: + _path_params['disputeId'] = dispute_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}/data/commerce-disputes/{disputeId}', + 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['ListCommerceDisputesRequest', 'ListCommerceDisputesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceDisputes: + """List disputes""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceDisputesRequest.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_commerce_disputes_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': "CommerceDisputes", + '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-commerce-disputes', + ) + 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['ListCommerceDisputesRequest', 'ListCommerceDisputesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceDisputes: + 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_commerce_disputes_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/commerce-disputes', + 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/lending/src/codat_lending/api/excel_reports.py b/lending/src/codat_lending/api/excel_reports.py new file mode 100644 index 000000000..5a8e2c8d8 --- /dev/null +++ b/lending/src/codat_lending/api/excel_reports.py @@ -0,0 +1,703 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 Any +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.excelreporttypes import ExcelReportTypes +from codat_lending.models.shared.excelstatus import ExcelStatus + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class DownloadExcelReportRequestTypedDict(TypedDict): + """TypedDict variant of DownloadExcelReportRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + +class DownloadExcelReportRequest(BaseModel): + """Request envelope for download_excel_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + @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 GenerateExcelReportRequestTypedDict(TypedDict): + """TypedDict variant of GenerateExcelReportRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + +class GenerateExcelReportRequest(BaseModel): + """Request envelope for generate_excel_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + @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 GetExcelReportGenerationStatusRequestTypedDict(TypedDict): + """TypedDict variant of GetExcelReportGenerationStatusRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + +class GetExcelReportGenerationStatusRequest(BaseModel): + """Request envelope for get_excel_report_generation_status.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[ExcelReportTypes, Field(description="The type of report you want to generate and download.")] + + @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 ExcelReports: + """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 download( + self, + *, + request: Union['DownloadExcelReportRequest', 'DownloadExcelReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bytes: + """Download Excel report""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadExcelReportRequest.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._download_excel_report_serialize( + company_id=request.company_id, + report_type=request.report_type, + _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': "bytearray", + '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='download-excel-report', + ) + 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 bytes(execute_with_retries(_do_call, _effective_retries)) + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_async( + self, + *, + request: Union['DownloadExcelReportRequest', 'DownloadExcelReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bytes: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_excel_report_serialize( + self, + company_id, + report_type, + _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 report_type is not None: + + _query_params.append(('reportType', report_type.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/data/companies/{companyId}/assess/excel/download', + 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( + self, + *, + request: Union['GenerateExcelReportRequest', 'GenerateExcelReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ExcelStatus: + """Generate Excel report""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateExcelReportRequest.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_excel_report_serialize( + company_id=request.company_id, + report_type=request.report_type, + _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': "ExcelStatus", + '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-excel-report', + ) + 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_async( + self, + *, + request: Union['GenerateExcelReportRequest', 'GenerateExcelReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ExcelStatus: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.generate( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_excel_report_serialize( + self, + company_id, + report_type, + _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 report_type is not None: + + _query_params.append(('reportType', report_type.value)) + + # 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='/data/companies/{companyId}/assess/excel', + 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_status( + self, + *, + request: Union['GetExcelReportGenerationStatusRequest', 'GetExcelReportGenerationStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ExcelStatus: + """Get Excel report status""" # noqa: E501 + + if isinstance(request, dict): + request = GetExcelReportGenerationStatusRequest.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_excel_report_generation_status_serialize( + company_id=request.company_id, + report_type=request.report_type, + _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': "ExcelStatus", + '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-excel-report-generation-status', + ) + 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_status_async( + self, + *, + request: Union['GetExcelReportGenerationStatusRequest', 'GetExcelReportGenerationStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ExcelStatus: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_status( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_excel_report_generation_status_serialize( + self, + company_id, + report_type, + _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 report_type is not None: + + _query_params.append(('reportType', report_type.value)) + + # 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='/data/companies/{companyId}/assess/excel', + 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/lending/src/codat_lending/api/file_upload.py b/lending/src/codat_lending/api/file_upload.py new file mode 100644 index 000000000..20710e173 --- /dev/null +++ b/lending/src/codat_lending/api/file_upload.py @@ -0,0 +1,740 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +from codat_lending.models.shared.fileupload import FileUpload as FileUploadModel +class DownloadFilesRequestTypedDict(TypedDict): + """TypedDict variant of DownloadFilesRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + date_: NotRequired[Annotated[Optional[str], Field(description="Only download files uploaded on this date.")]] + + +class DownloadFilesRequest(BaseModel): + """Request envelope for download_files.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + date_: Annotated[Optional[str], Field(description="Only download files uploaded on this date.")] = 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 ListFilesRequestTypedDict(TypedDict): + """TypedDict variant of ListFilesRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class ListFilesRequest(BaseModel): + """Request envelope for list_files.""" + 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 UploadFilesRequestTypedDict(TypedDict): + """TypedDict variant of UploadFilesRequest, 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.")] + file_upload: NotRequired[Optional[FileUploadModel]] + + +class UploadFilesRequest(BaseModel): + """Request envelope for upload_files.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + file_upload: Optional[FileUploadModel] = 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 FileUpload: + """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 download( + self, + *, + request: Union['DownloadFilesRequest', 'DownloadFilesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download all files for a company""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadFilesRequest.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._download_files_serialize( + company_id=request.company_id, + date_=request.date_, + _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': "bytearray", + '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='download-files', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_async( + self, + *, + request: Union['DownloadFilesRequest', 'DownloadFilesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_files_serialize( + self, + company_id, + date_, + _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 date_ is not None: + + _query_params.append(('date', date_)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/files/download', + 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_uploaded( + self, + *, + request: Union['ListFilesRequest', 'ListFilesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> List[File]: + """List all files uploaded by a company""" # noqa: E501 + + if isinstance(request, dict): + request = ListFilesRequest.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_files_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': "List[File]", + '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-files', + ) + 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_uploaded_async( + self, + *, + request: Union['ListFilesRequest', 'ListFilesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> List[File]: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_uploaded( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_files_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}/files', + 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 upload( + self, + *, + request: Union['UploadFilesRequest', 'UploadFilesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Upload files for a company""" # noqa: E501 + + if isinstance(request, dict): + request = UploadFilesRequest.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._upload_files_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + file_upload=request.file_upload, + _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='upload-files', + ) + 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 upload_async( + self, + *, + request: Union['UploadFilesRequest', 'UploadFilesRequestTypedDict'], + 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.upload( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _upload_files_serialize( + self, + company_id, + connection_id, + file_upload, + _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 + if file_upload is not None and file_upload.file is not None: + _cf = file_upload.file + # 3-tuple carries content_type onto the multipart part (matching Speakeasy's + # serialize_multipart_form); the 2-tuple lets files_parameters guess it. + _files['file'] = ( + (_cf.file_name, _cf.content, _cf.content_type) + if _cf.content_type is not None + else (_cf.file_name, _cf.content) + ) + # process the body parameter + + + 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( + [ + 'multipart/form-data' + ] + ) + ) + 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}/files', + 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/lending/src/codat_lending/api/financial_statements.py b/lending/src/codat_lending/api/financial_statements.py new file mode 100644 index 000000000..9fdd1090f --- /dev/null +++ b/lending/src/codat_lending/api/financial_statements.py @@ -0,0 +1,29 @@ +"""Generated wrapper exposing the financial-statements sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.financial_statements_accounts import FinancialStatementsAccounts +from codat_lending.api.balance_sheet import BalanceSheet +from codat_lending.api.cash_flow import CashFlow +from codat_lending.api.profit_and_loss import ProfitAndLoss + + +class FinancialStatements: + accounts: FinancialStatementsAccounts + balance_sheet: BalanceSheet + cash_flow: CashFlow + profit_and_loss: ProfitAndLoss + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.accounts = FinancialStatementsAccounts(api_client=self.api_client) + self.balance_sheet = BalanceSheet(api_client=self.api_client) + self.cash_flow = CashFlow(api_client=self.api_client) + self.profit_and_loss = ProfitAndLoss(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/financial_statements_accounts.py b/lending/src/codat_lending/api/financial_statements_accounts.py new file mode 100644 index 000000000..934376a1a --- /dev/null +++ b/lending/src/codat_lending/api/financial_statements_accounts.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingaccount import AccountingAccount +from codat_lending.models.shared.accountingaccounts import AccountingAccounts + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingAccountRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingAccountRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + account_id: Annotated[str, Field(description="Unique identifier for an account.")] + + +class GetAccountingAccountRequest(BaseModel): + """Request envelope for get_accounting_account.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + 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 ListAccountingAccountsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingAccountsRequest, 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 ListAccountingAccountsRequest(BaseModel): + """Request envelope for list_accounting_accounts.""" + 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 FinancialStatementsAccounts: + """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['GetAccountingAccountRequest', 'GetAccountingAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccount: + """Get account""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingAccountRequest.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_accounting_account_serialize( + company_id=request.company_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': "AccountingAccount", + '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='get-accounting-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 get_async( + self, + *, + request: Union['GetAccountingAccountRequest', 'GetAccountingAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccount: + 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_accounting_account_serialize( + self, + company_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 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}/data/accounts/{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 list( + self, + *, + request: Union['ListAccountingAccountsRequest', 'ListAccountingAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccounts: + """List accounts""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingAccountsRequest.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_accounting_accounts_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': "AccountingAccounts", + '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-accounting-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['ListAccountingAccountsRequest', 'ListAccountingAccountsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAccounts: + 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_accounting_accounts_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}/data/accounts', + 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/lending/src/codat_lending/api/financial_summary.py b/lending/src/codat_lending/api/financial_summary.py new file mode 100644 index 000000000..091cf0af6 --- /dev/null +++ b/lending/src/codat_lending/api/financial_summary.py @@ -0,0 +1,513 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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 Any, Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.financial_summary import FinancialSummary + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadCreditModelExcelRequestTypedDict(TypedDict): + """TypedDict variant of DownloadCreditModelExcelRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: NotRequired[Annotated[Optional[str], Field(description="The maximum age of report to fetch.")]] + + +class DownloadCreditModelExcelRequest(BaseModel): + """Request envelope for download_credit_model_excel.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: Annotated[Optional[str], Field(description="The maximum age of report to fetch.")] = 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 GetFinancialSummaryRequestTypedDict(TypedDict): + """TypedDict variant of GetFinancialSummaryRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + + +class GetFinancialSummaryRequest(BaseModel): + """Request envelope for get_financial_summary.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + + @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 FinancialSummary: + """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 download_credit_model_excel( + self, + *, + request: Union['DownloadCreditModelExcelRequest', 'DownloadCreditModelExcelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download credit model Excel""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadCreditModelExcelRequest.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._download_credit_model_excel_serialize( + company_id=request.company_id, + report_id=request.report_id, + max_age=request.max_age, + _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': "bytearray", + '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='download-credit-model-excel', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_credit_model_excel_async( + self, + *, + request: Union['DownloadCreditModelExcelRequest', 'DownloadCreditModelExcelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_credit_model_excel( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_credit_model_excel_serialize( + self, + company_id, + report_id, + max_age, + _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 report_id is not None: + _path_params['reportId'] = report_id + # process the query parameters + if max_age is not None: + + _query_params.append(('maxAge', max_age)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + if 'Accept' not in _header_params: + _header_params['Accept'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/reports/creditModel/{reportId}/excel', + 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_financial_summary( + self, + *, + request: Union['GetFinancialSummaryRequest', 'GetFinancialSummaryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[FinancialSummary]: + """Get financial summary insights""" # noqa: E501 + + if isinstance(request, dict): + request = GetFinancialSummaryRequest.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_financial_summary_serialize( + company_id=request.company_id, + report_id=request.report_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': "FinancialSummary", + '204': 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='get-financial-summary', + ) + 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_financial_summary_async( + self, + *, + request: Union['GetFinancialSummaryRequest', 'GetFinancialSummaryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Optional[FinancialSummary]: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_financial_summary( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_financial_summary_serialize( + self, + company_id, + report_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 report_id is not None: + _path_params['reportId'] = report_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}/reports/creditModel/{reportId}/financialSummary', + 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/lending/src/codat_lending/api/invoices.py b/lending/src/codat_lending/api/invoices.py new file mode 100644 index 000000000..25b3cd7cf --- /dev/null +++ b/lending/src/codat_lending/api/invoices.py @@ -0,0 +1,1657 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountinginvoice import AccountingInvoice +from codat_lending.models.shared.accountinginvoices import AccountingInvoices +from codat_lending.models.shared.attachments import Attachments +from codat_lending.models.shared.enhancedinvoicesreport import EnhancedInvoicesReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingInvoiceAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingInvoiceAttachmentRequest, 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.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingInvoiceAttachmentRequest(BaseModel): + """Request envelope for download_accounting_invoice_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 DownloadAccountingInvoicePdfRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingInvoicePdfRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + +class DownloadAccountingInvoicePdfRequest(BaseModel): + """Request envelope for download_accounting_invoice_pdf.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + @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 GetAccountingInvoiceRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingInvoiceRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + +class GetAccountingInvoiceRequest(BaseModel): + """Request envelope for get_accounting_invoice.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + @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 GetAccountingInvoiceAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingInvoiceAttachmentRequest, 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.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class GetAccountingInvoiceAttachmentRequest(BaseModel): + """Request envelope for get_accounting_invoice_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 ListAccountingInvoiceAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingInvoiceAttachmentsRequest, 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.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + +class ListAccountingInvoiceAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_invoice_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + invoice_id: Annotated[str, Field(description="Unique identifier for an invoice.")] + + @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 ListAccountingInvoicesRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingInvoicesRequest, 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 ListAccountingInvoicesRequest(BaseModel): + """Request envelope for list_accounting_invoices.""" + 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 ListReconciledInvoicesRequestTypedDict(TypedDict): + """TypedDict variant of ListReconciledInvoicesRequest, 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).")]] + + +class ListReconciledInvoicesRequest(BaseModel): + """Request envelope for list_reconciled_invoices.""" + 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 + + @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 Invoices: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingInvoiceAttachmentRequest', 'DownloadAccountingInvoiceAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download invoice attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingInvoiceAttachmentRequest.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._download_accounting_invoice_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + invoice_id=request.invoice_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-invoice-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingInvoiceAttachmentRequest', 'DownloadAccountingInvoiceAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_invoice_attachment_serialize( + self, + company_id, + connection_id, + invoice_id, + attachment_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 invoice_id is not None: + _path_params['invoiceId'] = invoice_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}/download', + 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 download_pdf( + self, + *, + request: Union['DownloadAccountingInvoicePdfRequest', 'DownloadAccountingInvoicePdfRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Get invoice as PDF""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingInvoicePdfRequest.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._download_accounting_invoice_pdf_serialize( + company_id=request.company_id, + invoice_id=request.invoice_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': "bytearray", + '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='download-accounting-invoice-pdf', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/pdf') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_pdf_async( + self, + *, + request: Union['DownloadAccountingInvoicePdfRequest', 'DownloadAccountingInvoicePdfRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_pdf( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_invoice_pdf_serialize( + self, + company_id, + invoice_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 invoice_id is not None: + _path_params['invoiceId'] = invoice_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'] = 'application/pdf' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/data/invoices/{invoiceId}/pdf', + 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['GetAccountingInvoiceRequest', 'GetAccountingInvoiceRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingInvoice: + """Get invoice""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingInvoiceRequest.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_accounting_invoice_serialize( + company_id=request.company_id, + invoice_id=request.invoice_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': "AccountingInvoice", + '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='get-accounting-invoice', + ) + 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['GetAccountingInvoiceRequest', 'GetAccountingInvoiceRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingInvoice: + 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_accounting_invoice_serialize( + self, + company_id, + invoice_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 invoice_id is not None: + _path_params['invoiceId'] = invoice_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}/data/invoices/{invoiceId}', + 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_attachment( + self, + *, + request: Union['GetAccountingInvoiceAttachmentRequest', 'GetAccountingInvoiceAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get invoice attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingInvoiceAttachmentRequest.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_accounting_invoice_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + invoice_id=request.invoice_id, + attachment_id=request.attachment_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': "AccountingAttachment", + '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-accounting-invoice-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingInvoiceAttachmentRequest', 'GetAccountingInvoiceAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_invoice_attachment_serialize( + self, + company_id, + connection_id, + invoice_id, + attachment_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 invoice_id is not None: + _path_params['invoiceId'] = invoice_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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}/data/invoices/{invoiceId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingInvoiceAttachmentsRequest', 'ListAccountingInvoiceAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List invoice attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingInvoiceAttachmentsRequest.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_accounting_invoice_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + invoice_id=request.invoice_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': "Attachments", + '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-accounting-invoice-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingInvoiceAttachmentsRequest', 'ListAccountingInvoiceAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_invoice_attachments_serialize( + self, + company_id, + connection_id, + invoice_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 invoice_id is not None: + _path_params['invoiceId'] = invoice_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}/data/invoices/{invoiceId}/attachments', + 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['ListAccountingInvoicesRequest', 'ListAccountingInvoicesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingInvoices: + """List invoices""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingInvoicesRequest.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_accounting_invoices_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': "AccountingInvoices", + '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-accounting-invoices', + ) + 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['ListAccountingInvoicesRequest', 'ListAccountingInvoicesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingInvoices: + 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_accounting_invoices_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}/data/invoices', + 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_reconciled( + self, + *, + request: Union['ListReconciledInvoicesRequest', 'ListReconciledInvoicesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedInvoicesReport: + """List reconciled invoices""" # noqa: E501 + + if isinstance(request, dict): + request = ListReconciledInvoicesRequest.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_reconciled_invoices_serialize( + company_id=request.company_id, + page=request.page, + page_size=request.page_size, + query=request.query, + _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': "EnhancedInvoicesReport", + '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-reconciled-invoices', + ) + 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_reconciled_async( + self, + *, + request: Union['ListReconciledInvoicesRequest', 'ListReconciledInvoicesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedInvoicesReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_reconciled( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_reconciled_invoices_serialize( + self, + company_id, + page, + page_size, + query, + _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)) + + # 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}/reports/enhancedInvoices', + 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/lending/src/codat_lending/api/journal_entries.py b/lending/src/codat_lending/api/journal_entries.py new file mode 100644 index 000000000..b5dc2b676 --- /dev/null +++ b/lending/src/codat_lending/api/journal_entries.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingjournalentries import AccountingJournalEntries +from codat_lending.models.shared.accountingjournalentry import AccountingJournalEntry + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingJournalEntryRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingJournalEntryRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + journal_entry_id: Annotated[str, Field(description="Unique identifier for a journal entry.")] + + +class GetAccountingJournalEntryRequest(BaseModel): + """Request envelope for get_accounting_journal_entry.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + journal_entry_id: Annotated[str, Field(description="Unique identifier for a journal entry.")] + + @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 ListAccountingJournalEntriesRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingJournalEntriesRequest, 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 ListAccountingJournalEntriesRequest(BaseModel): + """Request envelope for list_accounting_journal_entries.""" + 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 JournalEntries: + """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['GetAccountingJournalEntryRequest', 'GetAccountingJournalEntryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournalEntry: + """Get journal entry""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingJournalEntryRequest.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_accounting_journal_entry_serialize( + company_id=request.company_id, + journal_entry_id=request.journal_entry_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': "AccountingJournalEntry", + '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='get-accounting-journal-entry', + ) + 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['GetAccountingJournalEntryRequest', 'GetAccountingJournalEntryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournalEntry: + 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_accounting_journal_entry_serialize( + self, + company_id, + journal_entry_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 journal_entry_id is not None: + _path_params['journalEntryId'] = journal_entry_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}/data/journalEntries/{journalEntryId}', + 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['ListAccountingJournalEntriesRequest', 'ListAccountingJournalEntriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournalEntries: + """List journal entries""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingJournalEntriesRequest.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_accounting_journal_entries_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': "AccountingJournalEntries", + '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-accounting-journal-entries', + ) + 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['ListAccountingJournalEntriesRequest', 'ListAccountingJournalEntriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournalEntries: + 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_accounting_journal_entries_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}/data/journalEntries', + 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/lending/src/codat_lending/api/journals.py b/lending/src/codat_lending/api/journals.py new file mode 100644 index 000000000..ea7eeac13 --- /dev/null +++ b/lending/src/codat_lending/api/journals.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingjournal import AccountingJournal +from codat_lending.models.shared.accountingjournals import AccountingJournals + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingJournalRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingJournalRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + journal_id: Annotated[str, Field(description="Unique identifier for a journal.")] + + +class GetAccountingJournalRequest(BaseModel): + """Request envelope for get_accounting_journal.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + journal_id: Annotated[str, Field(description="Unique identifier for a journal.")] + + @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 ListAccountingJournalsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingJournalsRequest, 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 ListAccountingJournalsRequest(BaseModel): + """Request envelope for list_accounting_journals.""" + 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 Journals: + """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['GetAccountingJournalRequest', 'GetAccountingJournalRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournal: + """Get journal""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingJournalRequest.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_accounting_journal_serialize( + company_id=request.company_id, + journal_id=request.journal_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': "AccountingJournal", + '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='get-accounting-journal', + ) + 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['GetAccountingJournalRequest', 'GetAccountingJournalRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournal: + 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_accounting_journal_serialize( + self, + company_id, + journal_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 journal_id is not None: + _path_params['journalId'] = journal_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}/data/journals/{journalId}', + 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['ListAccountingJournalsRequest', 'ListAccountingJournalsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournals: + """List journals""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingJournalsRequest.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_accounting_journals_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': "AccountingJournals", + '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-accounting-journals', + ) + 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['ListAccountingJournalsRequest', 'ListAccountingJournalsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingJournals: + 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_accounting_journals_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}/data/journals', + 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/lending/src/codat_lending/api/liabilities.py b/lending/src/codat_lending/api/liabilities.py new file mode 100644 index 000000000..908fee181 --- /dev/null +++ b/lending/src/codat_lending/api/liabilities.py @@ -0,0 +1,922 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.loansummary import LoanSummary +from codat_lending.models.shared.loantransactions import LoanTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GenerateLoanSummaryRequestTypedDict(TypedDict): + """TypedDict variant of GenerateLoanSummaryRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + +class GenerateLoanSummaryRequest(BaseModel): + """Request envelope for generate_loan_summary.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + @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 GenerateLoanTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of GenerateLoanTransactionsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + +class GenerateLoanTransactionsRequest(BaseModel): + """Request envelope for generate_loan_transactions.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + @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 GetLoanSummaryRequestTypedDict(TypedDict): + """TypedDict variant of GetLoanSummaryRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + +class GetLoanSummaryRequest(BaseModel): + """Request envelope for get_loan_summary.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + @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 ListLoanTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of ListLoanTransactionsRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + +class ListLoanTransactionsRequest(BaseModel): + """Request envelope for list_loan_transactions.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + source_type: Annotated[str, Field(description="Data source type.")] + + @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 Liabilities: + """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 generate_loan_summary( + self, + *, + request: Union['GenerateLoanSummaryRequest', 'GenerateLoanSummaryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Generate loan summaries report""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateLoanSummaryRequest.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_loan_summary_serialize( + company_id=request.company_id, + source_type=request.source_type, + _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]] = { + '202': 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='generate-loan-summary', + ) + 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_loan_summary_async( + self, + *, + request: Union['GenerateLoanSummaryRequest', 'GenerateLoanSummaryRequestTypedDict'], + 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.generate_loan_summary( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_loan_summary_serialize( + self, + company_id, + source_type, + _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 source_type is not None: + + _query_params.append(('sourceType', source_type)) + + # 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}/reports/liabilities/loans', + 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_loan_transactions( + self, + *, + request: Union['GenerateLoanTransactionsRequest', 'GenerateLoanTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Generate loan transactions report""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateLoanTransactionsRequest.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_loan_transactions_serialize( + company_id=request.company_id, + source_type=request.source_type, + _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]] = { + '202': 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='generate-loan-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 generate_loan_transactions_async( + self, + *, + request: Union['GenerateLoanTransactionsRequest', 'GenerateLoanTransactionsRequestTypedDict'], + 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.generate_loan_transactions( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_loan_transactions_serialize( + self, + company_id, + source_type, + _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 source_type is not None: + + _query_params.append(('sourceType', source_type)) + + # 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}/reports/liabilities/loans/transactions', + 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_loan_summary( + self, + *, + request: Union['GetLoanSummaryRequest', 'GetLoanSummaryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> LoanSummary: + """Get loan summaries""" # noqa: E501 + + if isinstance(request, dict): + request = GetLoanSummaryRequest.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_loan_summary_serialize( + company_id=request.company_id, + source_type=request.source_type, + _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': "LoanSummary", + '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-loan-summary', + ) + 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_loan_summary_async( + self, + *, + request: Union['GetLoanSummaryRequest', 'GetLoanSummaryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> LoanSummary: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_loan_summary( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_loan_summary_serialize( + self, + company_id, + source_type, + _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 source_type is not None: + + _query_params.append(('sourceType', source_type)) + + # 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}/reports/liabilities/loans', + 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_loan_transactions( + self, + *, + request: Union['ListLoanTransactionsRequest', 'ListLoanTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> LoanTransactions: + """List loan transactions""" # noqa: E501 + + if isinstance(request, dict): + request = ListLoanTransactionsRequest.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_loan_transactions_serialize( + company_id=request.company_id, + source_type=request.source_type, + _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': "LoanTransactions", + '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-loan-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 list_loan_transactions_async( + self, + *, + request: Union['ListLoanTransactionsRequest', 'ListLoanTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> LoanTransactions: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_loan_transactions( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_loan_transactions_serialize( + self, + company_id, + source_type, + _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 source_type is not None: + + _query_params.append(('sourceType', source_type)) + + # 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}/reports/liabilities/loans/transactions', + 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/lending/src/codat_lending/api/loan_writeback.py b/lending/src/codat_lending/api/loan_writeback.py new file mode 100644 index 000000000..437e8e10f --- /dev/null +++ b/lending/src/codat_lending/api/loan_writeback.py @@ -0,0 +1,44 @@ +"""Generated wrapper exposing the loan-writeback sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.loan_writeback_accounts import LoanWritebackAccounts +from codat_lending.api.bank_accounts import BankAccounts +from codat_lending.api.bank_transactions import BankTransactions +from codat_lending.api.create_operations import CreateOperations +from codat_lending.api.direct_costs import DirectCosts +from codat_lending.api.loan_writeback_payments import LoanWritebackPayments +from codat_lending.api.source_accounts import SourceAccounts +from codat_lending.api.loan_writeback_suppliers import LoanWritebackSuppliers +from codat_lending.api.transfers import Transfers + + +class LoanWriteback: + accounts: LoanWritebackAccounts + bank_accounts: BankAccounts + bank_transactions: BankTransactions + create_operations: CreateOperations + direct_costs: DirectCosts + payments: LoanWritebackPayments + source_accounts: SourceAccounts + suppliers: LoanWritebackSuppliers + transfers: Transfers + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.accounts = LoanWritebackAccounts(api_client=self.api_client) + self.bank_accounts = BankAccounts(api_client=self.api_client) + self.bank_transactions = BankTransactions(api_client=self.api_client) + self.create_operations = CreateOperations(api_client=self.api_client) + self.direct_costs = DirectCosts(api_client=self.api_client) + self.payments = LoanWritebackPayments(api_client=self.api_client) + self.source_accounts = SourceAccounts(api_client=self.api_client) + self.suppliers = LoanWritebackSuppliers(api_client=self.api_client) + self.transfers = Transfers(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/loan_writeback_accounts.py b/lending/src/codat_lending/api/loan_writeback_accounts.py new file mode 100644 index 000000000..1bdfd9fef --- /dev/null +++ b/lending/src/codat_lending/api/loan_writeback_accounts.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountprototype import AccountPrototype +from codat_lending.models.shared.accountingcreateaccountresponse import AccountingCreateAccountResponse +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class CreateAccountRequestTypedDict(TypedDict): + """TypedDict variant of CreateAccountRequest, 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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + account_prototype: NotRequired[Optional[AccountPrototype]] + + +class CreateAccountRequest(BaseModel): + """Request envelope for create_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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + account_prototype: Optional[AccountPrototype] = 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 GetCreateChartOfAccountsModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateChartOfAccountsModelRequest, 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 GetCreateChartOfAccountsModelRequest(BaseModel): + """Request envelope for get_create_chart_of_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 LoanWritebackAccounts: + """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['CreateAccountRequest', 'CreateAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateAccountResponse: + """Create account""" # noqa: E501 + + if isinstance(request, dict): + request = CreateAccountRequest.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_account_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + account_prototype=request.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': "AccountingCreateAccountResponse", + '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-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['CreateAccountRequest', 'CreateAccountRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateAccountResponse: + 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_account_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + allow_sync_on_push_complete, + 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)) + + 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 account_prototype is not None: + _body_params = 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/accounts', + 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['GetCreateChartOfAccountsModelRequest', 'GetCreateChartOfAccountsModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create account model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateChartOfAccountsModelRequest.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_chart_of_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-chartOfAccounts-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['GetCreateChartOfAccountsModelRequest', 'GetCreateChartOfAccountsModelRequestTypedDict'], + 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_chart_of_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/chartOfAccounts', + 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/lending/src/codat_lending/api/loan_writeback_payments.py b/lending/src/codat_lending/api/loan_writeback_payments.py new file mode 100644 index 000000000..c088751d6 --- /dev/null +++ b/lending/src/codat_lending/api/loan_writeback_payments.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcreatepaymentresponse import AccountingCreatePaymentResponse +from codat_lending.models.shared.accountingpayment import AccountingPayment +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class CreatePaymentRequestTypedDict(TypedDict): + """TypedDict variant of CreatePaymentRequest, 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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + accounting_payment: NotRequired[Optional[AccountingPayment]] + + +class CreatePaymentRequest(BaseModel): + """Request envelope for create_payment.""" + 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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + accounting_payment: Optional[AccountingPayment] = 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 GetCreatePaymentModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreatePaymentModelRequest, 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 GetCreatePaymentModelRequest(BaseModel): + """Request envelope for get_create_payment_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 LoanWritebackPayments: + """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['CreatePaymentRequest', 'CreatePaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreatePaymentResponse: + """Create payment""" # noqa: E501 + + if isinstance(request, dict): + request = CreatePaymentRequest.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_payment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + accounting_payment=request.accounting_payment, + _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': "AccountingCreatePaymentResponse", + '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-payment', + ) + 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['CreatePaymentRequest', 'CreatePaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreatePaymentResponse: + 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_payment_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + allow_sync_on_push_complete, + accounting_payment, + _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)) + + 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 accounting_payment is not None: + _body_params = accounting_payment + + + 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/payments', + 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['GetCreatePaymentModelRequest', 'GetCreatePaymentModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create payment model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreatePaymentModelRequest.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_payment_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-payment-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['GetCreatePaymentModelRequest', 'GetCreatePaymentModelRequestTypedDict'], + 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_payment_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/payments', + 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/lending/src/codat_lending/api/loan_writeback_suppliers.py b/lending/src/codat_lending/api/loan_writeback_suppliers.py new file mode 100644 index 000000000..b243ea245 --- /dev/null +++ b/lending/src/codat_lending/api/loan_writeback_suppliers.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingcreatesupplierresponse import AccountingCreateSupplierResponse +from codat_lending.models.shared.accountingsupplier import AccountingSupplier +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class CreateSupplierRequestTypedDict(TypedDict): + """TypedDict variant of CreateSupplierRequest, 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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + accounting_supplier: NotRequired[Optional[AccountingSupplier]] + + +class CreateSupplierRequest(BaseModel): + """Request envelope for create_supplier.""" + 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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + accounting_supplier: Optional[AccountingSupplier] = 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 GetCreateUpdateSuppliersModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateUpdateSuppliersModelRequest, 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 GetCreateUpdateSuppliersModelRequest(BaseModel): + """Request envelope for get_create_update_suppliers_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 LoanWritebackSuppliers: + """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['CreateSupplierRequest', 'CreateSupplierRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateSupplierResponse: + """Create supplier""" # noqa: E501 + + if isinstance(request, dict): + request = CreateSupplierRequest.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_supplier_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + accounting_supplier=request.accounting_supplier, + _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': "AccountingCreateSupplierResponse", + '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-supplier', + ) + 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['CreateSupplierRequest', 'CreateSupplierRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateSupplierResponse: + 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_supplier_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + allow_sync_on_push_complete, + accounting_supplier, + _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)) + + 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 accounting_supplier is not None: + _body_params = accounting_supplier + + + 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/suppliers', + 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_update_model( + self, + *, + request: Union['GetCreateUpdateSuppliersModelRequest', 'GetCreateUpdateSuppliersModelRequestTypedDict'], + 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 supplier model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateUpdateSuppliersModelRequest.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_update_suppliers_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-update-suppliers-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_update_model_async( + self, + *, + request: Union['GetCreateUpdateSuppliersModelRequest', 'GetCreateUpdateSuppliersModelRequestTypedDict'], + 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_update_model( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_create_update_suppliers_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/suppliers', + 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/lending/src/codat_lending/api/locations.py b/lending/src/codat_lending/api/locations.py new file mode 100644 index 000000000..172a838e2 --- /dev/null +++ b/lending/src/codat_lending/api/locations.py @@ -0,0 +1,490 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercelocation import CommerceLocation +from codat_lending.models.shared.commercelocations import CommerceLocations + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceLocationRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceLocationRequest, 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.")] + location_id: Annotated[str, Field(description="Unique identifier for a location.")] + + +class GetCommerceLocationRequest(BaseModel): + """Request envelope for get_commerce_location.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + location_id: Annotated[str, Field(description="Unique identifier for a location.")] + + @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 ListCommerceLocationsRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceLocationsRequest, 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 ListCommerceLocationsRequest(BaseModel): + """Request envelope for list_commerce_locations.""" + 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 Locations: + """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['GetCommerceLocationRequest', 'GetCommerceLocationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceLocation: + """Get location""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceLocationRequest.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_commerce_location_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + location_id=request.location_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': "CommerceLocation", + '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='get-commerce-location', + ) + 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['GetCommerceLocationRequest', 'GetCommerceLocationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceLocation: + 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_commerce_location_serialize( + self, + company_id, + connection_id, + location_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 location_id is not None: + _path_params['locationId'] = location_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}/data/commerce-locations/{locationId}', + 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['ListCommerceLocationsRequest', 'ListCommerceLocationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceLocations: + """List locations""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceLocationsRequest.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_commerce_locations_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': "CommerceLocations", + '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-commerce-locations', + ) + 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['ListCommerceLocationsRequest', 'ListCommerceLocationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceLocations: + 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_commerce_locations_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}/data/commerce-locations', + 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/lending/src/codat_lending/api/manage_data.py b/lending/src/codat_lending/api/manage_data.py new file mode 100644 index 000000000..0ed3c15ce --- /dev/null +++ b/lending/src/codat_lending/api/manage_data.py @@ -0,0 +1,268 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 +# CODAT_GROUP_IMPORTS: ManageData +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.api.pull_operations import PullOperations +from codat_lending.api.refresh import Refresh + +from codat_lending.models.data_statuses import DataStatuses, GetDataStatusDataStatuses + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetDataStatusRequestTypedDict(TypedDict): + """TypedDict variant of GetDataStatusRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class GetDataStatusRequest(BaseModel): + """Request envelope for get_data_status.""" + 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 ManageData: + """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 + # CODAT_GROUP_CHILDREN_BEGIN: ManageData + self.pull_operations = PullOperations(api_client=self.api_client) + self.refresh = Refresh(api_client=self.api_client) + # CODAT_GROUP_CHILDREN_END: ManageData + + + @validate_call(config={"arbitrary_types_allowed": True}) + def get_status( + self, + *, + request: Union['GetDataStatusRequest', 'GetDataStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> GetDataStatusDataStatuses: + """Get data status""" # noqa: E501 + + if isinstance(request, dict): + request = GetDataStatusRequest.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_data_status_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': "DataStatuses", + '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-data-status', + ) + 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_status_async( + self, + *, + request: Union['GetDataStatusRequest', 'GetDataStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> GetDataStatusDataStatuses: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_status( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_data_status_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}/dataStatus', + 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/lending/src/codat_lending/api/manage_reports.py b/lending/src/codat_lending/api/manage_reports.py new file mode 100644 index 000000000..65868d648 --- /dev/null +++ b/lending/src/codat_lending/api/manage_reports.py @@ -0,0 +1,742 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing import Any, Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.reportoperation import ReportOperation +from codat_lending.models.shared.reports import Reports + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GenerateReportRequestTypedDict(TypedDict): + """TypedDict variant of GenerateReportRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[str, Field(description="The type of the report")] + + +class GenerateReportRequest(BaseModel): + """Request envelope for generate_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[str, Field(description="The type of the report")] + + @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 GetReportStatusRequestTypedDict(TypedDict): + """TypedDict variant of GetReportStatusRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[str, Field(description="The type of the report")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: NotRequired[Annotated[Optional[str], Field(description="The maximum age of report to fetch.")]] + + +class GetReportStatusRequest(BaseModel): + """Request envelope for get_report_status.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_type: Annotated[str, Field(description="The type of the report")] + report_id: Annotated[Any, Field(description="Unique identifier for a report, use either the Id of the report or `latest` for the most recently generate report.")] + max_age: Annotated[Optional[str], Field(description="The maximum age of report to fetch.")] = 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 ListReportsRequestTypedDict(TypedDict): + """TypedDict variant of ListReportsRequest, 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 ListReportsRequest(BaseModel): + """Request envelope for list_reports.""" + 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 ManageReports: + """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 generate_report( + self, + *, + request: Union['GenerateReportRequest', 'GenerateReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ReportOperation: + """Generate report""" # noqa: E501 + + if isinstance(request, dict): + request = GenerateReportRequest.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_report_serialize( + company_id=request.company_id, + report_type=request.report_type, + _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]] = { + '202': "ReportOperation", + '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='generate-report', + ) + 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_report_async( + self, + *, + request: Union['GenerateReportRequest', 'GenerateReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ReportOperation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.generate_report( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _generate_report_serialize( + self, + company_id, + report_type, + _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 report_type is not None: + _path_params['reportType'] = report_type + # 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}/reports/{reportType}', + 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_report_status( + self, + *, + request: Union['GetReportStatusRequest', 'GetReportStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ReportOperation: + """Get report status""" # noqa: E501 + + if isinstance(request, dict): + request = GetReportStatusRequest.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_report_status_serialize( + company_id=request.company_id, + report_type=request.report_type, + report_id=request.report_id, + max_age=request.max_age, + _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': "ReportOperation", + '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-report-status', + ) + 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_report_status_async( + self, + *, + request: Union['GetReportStatusRequest', 'GetReportStatusRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> ReportOperation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_report_status( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_report_status_serialize( + self, + company_id, + report_type, + report_id, + max_age, + _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 report_type is not None: + _path_params['reportType'] = report_type + if report_id is not None: + _path_params['reportId'] = report_id + # process the query parameters + if max_age is not None: + + _query_params.append(('maxAge', max_age)) + + # 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}/reports/{reportType}/{reportId}/status', + 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_reports( + self, + *, + request: Union['ListReportsRequest', 'ListReportsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Reports: + """List reports""" # noqa: E501 + + if isinstance(request, dict): + request = ListReportsRequest.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_reports_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': "Reports", + '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-reports', + ) + 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_reports_async( + self, + *, + request: Union['ListReportsRequest', 'ListReportsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Reports: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_reports( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_reports_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}/reports', + 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/lending/src/codat_lending/api/metrics.py b/lending/src/codat_lending/api/metrics.py new file mode 100644 index 000000000..2f456dd69 --- /dev/null +++ b/lending/src/codat_lending/api/metrics.py @@ -0,0 +1,820 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing import Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercereport import CommerceReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceCustomerRetentionMetricsRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceCustomerRetentionMetricsRequest, 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.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: NotRequired[Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")]] + + +class GetCommerceCustomerRetentionMetricsRequest(BaseModel): + """Request envelope for get_commerce_customer_retention_metrics.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")] = 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 GetCommerceLifetimeValueMetricsRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceLifetimeValueMetricsRequest, 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.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: NotRequired[Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")]] + + +class GetCommerceLifetimeValueMetricsRequest(BaseModel): + """Request envelope for get_commerce_lifetime_value_metrics.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")] = 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 GetCommerceRevenueMetricsRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceRevenueMetricsRequest, 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.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: NotRequired[Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")]] + + +class GetCommerceRevenueMetricsRequest(BaseModel): + """Request envelope for get_commerce_revenue_metrics.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")] = 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 Metrics: + """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_customer_retention( + self, + *, + request: Union['GetCommerceCustomerRetentionMetricsRequest', 'GetCommerceCustomerRetentionMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + """Get customer retention metrics""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceCustomerRetentionMetricsRequest.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_commerce_customer_retention_metrics_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + report_date=request.report_date, + period_length=request.period_length, + number_of_periods=request.number_of_periods, + period_unit=request.period_unit, + include_display_names=request.include_display_names, + _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': "CommerceReport", + '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-commerce-customer-retention-metrics', + ) + 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_customer_retention_async( + self, + *, + request: Union['GetCommerceCustomerRetentionMetricsRequest', 'GetCommerceCustomerRetentionMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_customer_retention( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_customer_retention_metrics_serialize( + self, + company_id, + connection_id, + report_date, + period_length, + number_of_periods, + period_unit, + include_display_names, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_unit is not None: + + _query_params.append(('periodUnit', period_unit)) + + if include_display_names is not None: + + _query_params.append(('includeDisplayNames', include_display_names)) + + # 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='/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/customerRetention', + 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_lifetime_value( + self, + *, + request: Union['GetCommerceLifetimeValueMetricsRequest', 'GetCommerceLifetimeValueMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + """Get lifetime value metrics""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceLifetimeValueMetricsRequest.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_commerce_lifetime_value_metrics_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + report_date=request.report_date, + period_length=request.period_length, + number_of_periods=request.number_of_periods, + period_unit=request.period_unit, + include_display_names=request.include_display_names, + _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': "CommerceReport", + '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-commerce-lifetime-value-metrics', + ) + 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_lifetime_value_async( + self, + *, + request: Union['GetCommerceLifetimeValueMetricsRequest', 'GetCommerceLifetimeValueMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_lifetime_value( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_lifetime_value_metrics_serialize( + self, + company_id, + connection_id, + report_date, + period_length, + number_of_periods, + period_unit, + include_display_names, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_unit is not None: + + _query_params.append(('periodUnit', period_unit)) + + if include_display_names is not None: + + _query_params.append(('includeDisplayNames', include_display_names)) + + # 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='/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/lifetimeValue', + 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_revenue( + self, + *, + request: Union['GetCommerceRevenueMetricsRequest', 'GetCommerceRevenueMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + """Get commerce revenue metrics""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceRevenueMetricsRequest.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_commerce_revenue_metrics_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + report_date=request.report_date, + period_length=request.period_length, + number_of_periods=request.number_of_periods, + period_unit=request.period_unit, + include_display_names=request.include_display_names, + _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': "CommerceReport", + '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-commerce-revenue-metrics', + ) + 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_revenue_async( + self, + *, + request: Union['GetCommerceRevenueMetricsRequest', 'GetCommerceRevenueMetricsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_revenue( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_revenue_metrics_serialize( + self, + company_id, + connection_id, + report_date, + period_length, + number_of_periods, + period_unit, + include_display_names, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_unit is not None: + + _query_params.append(('periodUnit', period_unit)) + + if include_display_names is not None: + + _query_params.append(('includeDisplayNames', include_display_names)) + + # 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='/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/revenue', + 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/lending/src/codat_lending/api/orders.py b/lending/src/codat_lending/api/orders.py new file mode 100644 index 000000000..125765447 --- /dev/null +++ b/lending/src/codat_lending/api/orders.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commerceorder import CommerceOrder +from codat_lending.models.shared.commerceorders import CommerceOrders + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceOrderRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceOrderRequest, 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.")] + order_id: Annotated[str, Field(description="Unique identifier for an order.")] + + +class GetCommerceOrderRequest(BaseModel): + """Request envelope for get_commerce_order.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + order_id: Annotated[str, Field(description="Unique identifier for an order.")] + + @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 ListCommerceOrdersRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceOrdersRequest, 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 ListCommerceOrdersRequest(BaseModel): + """Request envelope for list_commerce_orders.""" + 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 Orders: + """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['GetCommerceOrderRequest', 'GetCommerceOrderRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceOrder: + """Get order""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceOrderRequest.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_commerce_order_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + order_id=request.order_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': "CommerceOrder", + '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='get-commerce-order', + ) + 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['GetCommerceOrderRequest', 'GetCommerceOrderRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceOrder: + 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_commerce_order_serialize( + self, + company_id, + connection_id, + order_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 order_id is not None: + _path_params['orderId'] = order_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}/data/commerce-orders/{orderId}', + 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['ListCommerceOrdersRequest', 'ListCommerceOrdersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceOrders: + """List orders""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceOrdersRequest.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_commerce_orders_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': "CommerceOrders", + '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-commerce-orders', + ) + 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['ListCommerceOrdersRequest', 'ListCommerceOrdersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceOrders: + 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_commerce_orders_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/commerce-orders', + 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/lending/src/codat_lending/api/payment_methods.py b/lending/src/codat_lending/api/payment_methods.py new file mode 100644 index 000000000..2aafe2256 --- /dev/null +++ b/lending/src/codat_lending/api/payment_methods.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercepaymentmethod import CommercePaymentMethod +from codat_lending.models.shared.commercepaymentmethods import CommercePaymentMethods + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommercePaymentMethodRequestTypedDict(TypedDict): + """TypedDict variant of GetCommercePaymentMethodRequest, 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.")] + payment_method_id: Annotated[str, Field(description="Unique identifier for a payment method.")] + + +class GetCommercePaymentMethodRequest(BaseModel): + """Request envelope for get_commerce_payment_method.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + payment_method_id: Annotated[str, Field(description="Unique identifier for a payment method.")] + + @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 ListCommercePaymentMethodsRequestTypedDict(TypedDict): + """TypedDict variant of ListCommercePaymentMethodsRequest, 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 ListCommercePaymentMethodsRequest(BaseModel): + """Request envelope for list_commerce_payment_methods.""" + 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 PaymentMethods: + """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['GetCommercePaymentMethodRequest', 'GetCommercePaymentMethodRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePaymentMethod: + """Get payment method""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommercePaymentMethodRequest.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_commerce_payment_method_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + payment_method_id=request.payment_method_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': "CommercePaymentMethod", + '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='get-commerce-payment-method', + ) + 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['GetCommercePaymentMethodRequest', 'GetCommercePaymentMethodRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePaymentMethod: + 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_commerce_payment_method_serialize( + self, + company_id, + connection_id, + payment_method_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 payment_method_id is not None: + _path_params['paymentMethodId'] = payment_method_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}/data/commerce-paymentMethods/{paymentMethodId}', + 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['ListCommercePaymentMethodsRequest', 'ListCommercePaymentMethodsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePaymentMethods: + """List payment methods""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommercePaymentMethodsRequest.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_commerce_payment_methods_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': "CommercePaymentMethods", + '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-commerce-payment-methods', + ) + 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['ListCommercePaymentMethodsRequest', 'ListCommercePaymentMethodsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePaymentMethods: + 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_commerce_payment_methods_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/commerce-paymentMethods', + 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/lending/src/codat_lending/api/payments.py b/lending/src/codat_lending/api/payments.py new file mode 100644 index 000000000..ea3cc7d45 --- /dev/null +++ b/lending/src/codat_lending/api/payments.py @@ -0,0 +1,512 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingpayment import AccountingPayment +from codat_lending.models.shared.accountingpayments import AccountingPayments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingPaymentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingPaymentRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + payment_id: Annotated[str, Field(description="Unique identifier for a payment.")] + + +class GetAccountingPaymentRequest(BaseModel): + """Request envelope for get_accounting_payment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + payment_id: Annotated[str, Field(description="Unique identifier for a payment.")] + + @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 ListAccountingPaymentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingPaymentsRequest, 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 ListAccountingPaymentsRequest(BaseModel): + """Request envelope for list_accounting_payments.""" + 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 Payments: + """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['GetAccountingPaymentRequest', 'GetAccountingPaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingPayment: + """Get payment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingPaymentRequest.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_accounting_payment_serialize( + company_id=request.company_id, + payment_id=request.payment_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': "AccountingPayment", + '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='get-accounting-payment', + ) + 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['GetAccountingPaymentRequest', 'GetAccountingPaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingPayment: + 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_accounting_payment_serialize( + self, + company_id, + payment_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 payment_id is not None: + _path_params['paymentId'] = payment_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}/data/payments/{paymentId}', + 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['ListAccountingPaymentsRequest', 'ListAccountingPaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingPayments: + """List payments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingPaymentsRequest.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_accounting_payments_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': "AccountingPayments", + '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-accounting-payments', + ) + 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['ListAccountingPaymentsRequest', 'ListAccountingPaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingPayments: + 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_accounting_payments_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}/data/payments', + 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/lending/src/codat_lending/api/product_categories.py b/lending/src/codat_lending/api/product_categories.py new file mode 100644 index 000000000..377af0967 --- /dev/null +++ b/lending/src/codat_lending/api/product_categories.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commerceproductcategories import CommerceProductCategories +from codat_lending.models.shared.commerceproductcategory import CommerceProductCategory + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceProductCategoryRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceProductCategoryRequest, 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.")] + product_id: Annotated[str, Field(description="Unique identifier for a product.")] + + +class GetCommerceProductCategoryRequest(BaseModel): + """Request envelope for get_commerce_product_category.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + product_id: Annotated[str, Field(description="Unique identifier for a product.")] + + @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 ListCommerceProductCategoriesRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceProductCategoriesRequest, 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 ListCommerceProductCategoriesRequest(BaseModel): + """Request envelope for list_commerce_product_categories.""" + 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 ProductCategories: + """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['GetCommerceProductCategoryRequest', 'GetCommerceProductCategoryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProductCategory: + """Get product category""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceProductCategoryRequest.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_commerce_product_category_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + product_id=request.product_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': "CommerceProductCategory", + '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='get-commerce-product-category', + ) + 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['GetCommerceProductCategoryRequest', 'GetCommerceProductCategoryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProductCategory: + 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_commerce_product_category_serialize( + self, + company_id, + connection_id, + product_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 product_id is not None: + _path_params['productId'] = product_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}/data/commerce-productCategories/{productId}', + 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['ListCommerceProductCategoriesRequest', 'ListCommerceProductCategoriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProductCategories: + """List product categories""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceProductCategoriesRequest.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_commerce_product_categories_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': "CommerceProductCategories", + '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-commerce-product-categories', + ) + 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['ListCommerceProductCategoriesRequest', 'ListCommerceProductCategoriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProductCategories: + 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_commerce_product_categories_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/commerce-productCategories', + 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/lending/src/codat_lending/api/products.py b/lending/src/codat_lending/api/products.py new file mode 100644 index 000000000..9fcd6c7f5 --- /dev/null +++ b/lending/src/codat_lending/api/products.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commerceproduct import CommerceProduct +from codat_lending.models.shared.commerceproducts import CommerceProducts + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceProductRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceProductRequest, 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.")] + product_id: Annotated[str, Field(description="Unique identifier for a product.")] + + +class GetCommerceProductRequest(BaseModel): + """Request envelope for get_commerce_product.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + product_id: Annotated[str, Field(description="Unique identifier for a product.")] + + @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 ListCommerceProductsRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceProductsRequest, 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 ListCommerceProductsRequest(BaseModel): + """Request envelope for list_commerce_products.""" + 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 Products: + """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['GetCommerceProductRequest', 'GetCommerceProductRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProduct: + """Get product""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceProductRequest.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_commerce_product_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + product_id=request.product_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': "CommerceProduct", + '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='get-commerce-product', + ) + 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['GetCommerceProductRequest', 'GetCommerceProductRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProduct: + 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_commerce_product_serialize( + self, + company_id, + connection_id, + product_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 product_id is not None: + _path_params['productId'] = product_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}/data/commerce-products/{productId}', + 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['ListCommerceProductsRequest', 'ListCommerceProductsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProducts: + """List products""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceProductsRequest.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_commerce_products_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': "CommerceProducts", + '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-commerce-products', + ) + 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['ListCommerceProductsRequest', 'ListCommerceProductsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceProducts: + 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_commerce_products_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/commerce-products', + 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/lending/src/codat_lending/api/profit_and_loss.py b/lending/src/codat_lending/api/profit_and_loss.py new file mode 100644 index 000000000..b63d21e17 --- /dev/null +++ b/lending/src/codat_lending/api/profit_and_loss.py @@ -0,0 +1,513 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingprofitandlossreport import AccountingProfitAndLossReport +from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingProfitAndLossRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingProfitAndLossRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: NotRequired[Annotated[Optional[str], Field(description="The month the report starts from.")]] + + +class GetAccountingProfitAndLossRequest(BaseModel): + """Request envelope for get_accounting_profit_and_loss.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + period_length: Annotated[int, Field(description="Number of months defining the period of interest.")] + periods_to_compare: Annotated[int, Field(description="Number of periods with `periodLength` to compare.")] + start_month: Annotated[Optional[str], Field(description="The month the report starts from.")] = 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 GetCategorizedProfitAndLossStatementRequestTypedDict(TypedDict): + """TypedDict variant of GetCategorizedProfitAndLossStatementRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: NotRequired[Annotated[Optional[str], Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")]] + number_of_periods: NotRequired[Annotated[Optional[int], Field(description="The number of periods to return. If not provided, 12 periods will be used as the default value.")]] + + +class GetCategorizedProfitAndLossStatementRequest(BaseModel): + """Request envelope for get_categorized_profit_and_loss_statement.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: Annotated[Optional[str], Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] = None + number_of_periods: Annotated[Optional[int], Field(description="The number of periods to return. If not provided, 12 periods will be used as the default value.")] = 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 ProfitAndLoss: + """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['GetAccountingProfitAndLossRequest', 'GetAccountingProfitAndLossRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingProfitAndLossReport: + """Get profit and loss""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingProfitAndLossRequest.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_accounting_profit_and_loss_serialize( + company_id=request.company_id, + period_length=request.period_length, + periods_to_compare=request.periods_to_compare, + start_month=request.start_month, + _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': "AccountingProfitAndLossReport", + '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='get-accounting-profit-and-loss', + ) + 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['GetAccountingProfitAndLossRequest', 'GetAccountingProfitAndLossRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingProfitAndLossReport: + 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_accounting_profit_and_loss_serialize( + self, + company_id, + period_length, + periods_to_compare, + start_month, + _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 period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if periods_to_compare is not None: + + _query_params.append(('periodsToCompare', periods_to_compare)) + + if start_month is not None: + + _query_params.append(('startMonth', start_month)) + + # 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}/data/financials/profitAndLoss', + 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_categorized_accounts( + self, + *, + request: Union['GetCategorizedProfitAndLossStatementRequest', 'GetCategorizedProfitAndLossStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedFinancialReport: + """Get categorized profit and loss statement""" # noqa: E501 + + if isinstance(request, dict): + request = GetCategorizedProfitAndLossStatementRequest.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_categorized_profit_and_loss_statement_serialize( + company_id=request.company_id, + report_date=request.report_date, + number_of_periods=request.number_of_periods, + _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': "EnhancedFinancialReport", + '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-categorized-profit-and-loss-statement', + ) + 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_categorized_accounts_async( + self, + *, + request: Union['GetCategorizedProfitAndLossStatementRequest', 'GetCategorizedProfitAndLossStatementRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> EnhancedFinancialReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_categorized_accounts( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_categorized_profit_and_loss_statement_serialize( + self, + company_id, + report_date, + number_of_periods, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + # 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}/reports/enhancedProfitAndLoss/accounts', + 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/lending/src/codat_lending/api/pull_operations.py b/lending/src/codat_lending/api/pull_operations.py new file mode 100644 index 000000000..9ff8bad79 --- /dev/null +++ b/lending/src/codat_lending/api/pull_operations.py @@ -0,0 +1,510 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.pulloperation import PullOperation +from codat_lending.models.shared.pulloperations import PullOperations + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetPullOperationRequestTypedDict(TypedDict): + """TypedDict variant of GetPullOperationRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its sync.")] + + +class GetPullOperationRequest(BaseModel): + """Request envelope for get_pull_operation.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + dataset_id: Annotated[str, Field(description="Unique identifier for the dataset that completed its 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 ListPullOperationsRequestTypedDict(TypedDict): + """TypedDict variant of ListPullOperationsRequest, 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 ListPullOperationsRequest(BaseModel): + """Request envelope for list_pull_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 PullOperations: + """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['GetPullOperationRequest', 'GetPullOperationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + """Get pull operation""" # noqa: E501 + + if isinstance(request, dict): + request = GetPullOperationRequest.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_pull_operation_serialize( + company_id=request.company_id, + dataset_id=request.dataset_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': "PullOperation", + '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-pull-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_async( + self, + *, + request: Union['GetPullOperationRequest', 'GetPullOperationRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + 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_pull_operation_serialize( + self, + company_id, + dataset_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 dataset_id is not None: + _path_params['datasetId'] = dataset_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}/data/history/{datasetId}', + 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['ListPullOperationsRequest', 'ListPullOperationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperations: + """List pull operations""" # noqa: E501 + + if isinstance(request, dict): + request = ListPullOperationsRequest.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_pull_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': "PullOperations", + '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-pull-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_async( + self, + *, + request: Union['ListPullOperationsRequest', 'ListPullOperationsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperations: + 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_pull_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}/data/history', + 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/lending/src/codat_lending/api/refresh.py b/lending/src/codat_lending/api/refresh.py new file mode 100644 index 000000000..eff13b4b6 --- /dev/null +++ b/lending/src/codat_lending/api/refresh.py @@ -0,0 +1,488 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing import Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.datatype import DataType +from codat_lending.models.shared.pulloperation import PullOperation + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +from codat_lending.models._compat.schema_datatype import SchemaDataType +class RefreshAllDataTypesRequestTypedDict(TypedDict): + """TypedDict variant of RefreshAllDataTypesRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class RefreshAllDataTypesRequest(BaseModel): + """Request envelope for refresh_all_data_types.""" + 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 RefreshDataTypeRequestTypedDict(TypedDict): + """TypedDict variant of RefreshDataTypeRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[SchemaDataType, Field(description="A key for a Codat data type.")] + connection_id: NotRequired[Annotated[Optional[str], Field(description="Optionally, provide a data connection id to only queue pull operations on that connection.")]] + + +class RefreshDataTypeRequest(BaseModel): + """Request envelope for refresh_data_type.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + data_type: Annotated[SchemaDataType, Field(description="A key for a Codat data type.")] + connection_id: Annotated[Optional[str], Field(description="Optionally, provide a data connection id to only queue pull operations on that connection.")] = 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 Refresh: + """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 all_data_types( + self, + *, + request: Union['RefreshAllDataTypesRequest', 'RefreshAllDataTypesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> None: + """Refresh all data""" # noqa: E501 + + if isinstance(request, dict): + request = RefreshAllDataTypesRequest.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._refresh_all_data_types_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, + '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='refresh-all-data-types', + ) + 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 all_data_types_async( + self, + *, + request: Union['RefreshAllDataTypesRequest', 'RefreshAllDataTypesRequestTypedDict'], + 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.all_data_types( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _refresh_all_data_types_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='POST', + resource_path='/companies/{companyId}/data/all', + 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 data_type( + self, + *, + request: Union['RefreshDataTypeRequest', 'RefreshDataTypeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + """Refresh data type""" # noqa: E501 + + if isinstance(request, dict): + request = RefreshDataTypeRequest.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._refresh_data_type_serialize( + company_id=request.company_id, + data_type=request.data_type, + 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': "PullOperation", + '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='refresh-data-type', + ) + 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 data_type_async( + self, + *, + request: Union['RefreshDataTypeRequest', 'RefreshDataTypeRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PullOperation: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.data_type( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _refresh_data_type_serialize( + self, + company_id, + data_type, + 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 data_type is not None: + _path_params['dataType'] = data_type + # process the query parameters + if connection_id is not None: + + _query_params.append(('connectionId', connection_id)) + + # 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}/data/queue/{dataType}', + 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/lending/src/codat_lending/api/reports.py b/lending/src/codat_lending/api/reports.py new file mode 100644 index 000000000..235457881 --- /dev/null +++ b/lending/src/codat_lending/api/reports.py @@ -0,0 +1,956 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 datetime import date +from pydantic import Field +from typing import Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingagedcreditorreport import AccountingAgedCreditorReport +from codat_lending.models.shared.accountingageddebtorreport import AccountingAgedDebtorReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingAgedCreditorsReportRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingAgedCreditorsReportRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: NotRequired[Annotated[Optional[date], Field(description="Date the report is generated up to.")]] + number_of_periods: NotRequired[Annotated[Optional[int], Field(description="Number of periods to include in the report.")]] + period_length_days: NotRequired[Annotated[Optional[int], Field(description="The length of period in days.")]] + + +class GetAccountingAgedCreditorsReportRequest(BaseModel): + """Request envelope for get_accounting_aged_creditors_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: Annotated[Optional[date], Field(description="Date the report is generated up to.")] = None + number_of_periods: Annotated[Optional[int], Field(description="Number of periods to include in the report.")] = None + period_length_days: Annotated[Optional[int], Field(description="The length of period in days.")] = 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 GetAccountingAgedDebtorsReportRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingAgedDebtorsReportRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: NotRequired[Annotated[Optional[date], Field(description="Date the report is generated up to.")]] + number_of_periods: NotRequired[Annotated[Optional[int], Field(description="Number of periods to include in the report.")]] + period_length_days: NotRequired[Annotated[Optional[int], Field(description="The length of period in days.")]] + + +class GetAccountingAgedDebtorsReportRequest(BaseModel): + """Request envelope for get_accounting_aged_debtors_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + report_date: Annotated[Optional[date], Field(description="Date the report is generated up to.")] = None + number_of_periods: Annotated[Optional[int], Field(description="Number of periods to include in the report.")] = None + period_length_days: Annotated[Optional[int], Field(description="The length of period in days.")] = 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 IsAgedCreditorsReportAvailableRequestTypedDict(TypedDict): + """TypedDict variant of IsAgedCreditorsReportAvailableRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class IsAgedCreditorsReportAvailableRequest(BaseModel): + """Request envelope for is_aged_creditors_report_available.""" + 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 IsAgedDebtorsReportAvailableRequestTypedDict(TypedDict): + """TypedDict variant of IsAgedDebtorsReportAvailableRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + + +class IsAgedDebtorsReportAvailableRequest(BaseModel): + """Request envelope for is_aged_debtors_report_available.""" + 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 Reports: + """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_aged_creditors( + self, + *, + request: Union['GetAccountingAgedCreditorsReportRequest', 'GetAccountingAgedCreditorsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAgedCreditorReport: + """Aged creditors report""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingAgedCreditorsReportRequest.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_accounting_aged_creditors_report_serialize( + company_id=request.company_id, + report_date=request.report_date, + number_of_periods=request.number_of_periods, + period_length_days=request.period_length_days, + _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': "AccountingAgedCreditorReport", + '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-accounting-aged-creditors-report', + ) + 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_aged_creditors_async( + self, + *, + request: Union['GetAccountingAgedCreditorsReportRequest', 'GetAccountingAgedCreditorsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAgedCreditorReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_aged_creditors( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_aged_creditors_report_serialize( + self, + company_id, + report_date, + number_of_periods, + period_length_days, + _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 report_date is not None: + if isinstance(report_date, date): + _query_params.append( + ( + 'reportDate', + report_date.strftime( + self.api_client.configuration.date_format + ) + ) + ) + else: + _query_params.append(('reportDate', report_date)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_length_days is not None: + + _query_params.append(('periodLengthDays', period_length_days)) + + # 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}/reports/agedCreditor', + 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_aged_debtors( + self, + *, + request: Union['GetAccountingAgedDebtorsReportRequest', 'GetAccountingAgedDebtorsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAgedDebtorReport: + """Aged debtors report""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingAgedDebtorsReportRequest.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_accounting_aged_debtors_report_serialize( + company_id=request.company_id, + report_date=request.report_date, + number_of_periods=request.number_of_periods, + period_length_days=request.period_length_days, + _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': "AccountingAgedDebtorReport", + '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-accounting-aged-debtors-report', + ) + 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_aged_debtors_async( + self, + *, + request: Union['GetAccountingAgedDebtorsReportRequest', 'GetAccountingAgedDebtorsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAgedDebtorReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_aged_debtors( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_aged_debtors_report_serialize( + self, + company_id, + report_date, + number_of_periods, + period_length_days, + _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 report_date is not None: + if isinstance(report_date, date): + _query_params.append( + ( + 'reportDate', + report_date.strftime( + self.api_client.configuration.date_format + ) + ) + ) + else: + _query_params.append(('reportDate', report_date)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_length_days is not None: + + _query_params.append(('periodLengthDays', period_length_days)) + + # 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}/reports/agedDebtor', + 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 is_aged_creditors_available( + self, + *, + request: Union['IsAgedCreditorsReportAvailableRequest', 'IsAgedCreditorsReportAvailableRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bool: + """Aged creditors report available""" # noqa: E501 + + if isinstance(request, dict): + request = IsAgedCreditorsReportAvailableRequest.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._is_aged_creditors_report_available_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': "bool", + '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='is-aged-creditors-report-available', + ) + 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 is_aged_creditors_available_async( + self, + *, + request: Union['IsAgedCreditorsReportAvailableRequest', 'IsAgedCreditorsReportAvailableRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bool: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.is_aged_creditors_available( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _is_aged_creditors_report_available_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}/reports/agedCreditor/available', + 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 is_aged_debtors_available( + self, + *, + request: Union['IsAgedDebtorsReportAvailableRequest', 'IsAgedDebtorsReportAvailableRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bool: + """Aged debtors report available""" # noqa: E501 + + if isinstance(request, dict): + request = IsAgedDebtorsReportAvailableRequest.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._is_aged_debtors_report_available_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': "bool", + '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='is-aged-debtors-report-available', + ) + 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 is_aged_debtors_available_async( + self, + *, + request: Union['IsAgedDebtorsReportAvailableRequest', 'IsAgedDebtorsReportAvailableRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> bool: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.is_aged_debtors_available( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _is_aged_debtors_report_available_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}/reports/agedDebtor/available', + 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/lending/src/codat_lending/api/sales.py b/lending/src/codat_lending/api/sales.py new file mode 100644 index 000000000..bf2fa17be --- /dev/null +++ b/lending/src/codat_lending/api/sales.py @@ -0,0 +1,50 @@ +"""Generated wrapper exposing the sales sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.sales_customers import SalesCustomers +from codat_lending.api.disputes import Disputes +from codat_lending.api.locations import Locations +from codat_lending.api.metrics import Metrics +from codat_lending.api.orders import Orders +from codat_lending.api.payment_methods import PaymentMethods +from codat_lending.api.sales_payments import SalesPayments +from codat_lending.api.product_categories import ProductCategories +from codat_lending.api.products import Products +from codat_lending.api.sales_reports import SalesReports +from codat_lending.api.sales_transactions import SalesTransactions + + +class Sales: + customers: SalesCustomers + disputes: Disputes + locations: Locations + metrics: Metrics + orders: Orders + payment_methods: PaymentMethods + payments: SalesPayments + product_categories: ProductCategories + products: Products + reports: SalesReports + transactions: SalesTransactions + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.customers = SalesCustomers(api_client=self.api_client) + self.disputes = Disputes(api_client=self.api_client) + self.locations = Locations(api_client=self.api_client) + self.metrics = Metrics(api_client=self.api_client) + self.orders = Orders(api_client=self.api_client) + self.payment_methods = PaymentMethods(api_client=self.api_client) + self.payments = SalesPayments(api_client=self.api_client) + self.product_categories = ProductCategories(api_client=self.api_client) + self.products = Products(api_client=self.api_client) + self.reports = SalesReports(api_client=self.api_client) + self.transactions = SalesTransactions(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/sales_customers.py b/lending/src/codat_lending/api/sales_customers.py new file mode 100644 index 000000000..259748af8 --- /dev/null +++ b/lending/src/codat_lending/api/sales_customers.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercecustomer import CommerceCustomer +from codat_lending.models.shared.commercecustomers import CommerceCustomers + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceCustomerRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceCustomerRequest, 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.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + +class GetCommerceCustomerRequest(BaseModel): + """Request envelope for get_commerce_customer.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + customer_id: Annotated[str, Field(description="Unique identifier for a customer.")] + + @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 ListCommerceCustomersRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceCustomersRequest, 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 ListCommerceCustomersRequest(BaseModel): + """Request envelope for list_commerce_customers.""" + 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 SalesCustomers: + """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['GetCommerceCustomerRequest', 'GetCommerceCustomerRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCustomer: + """Get customer""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceCustomerRequest.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_commerce_customer_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + customer_id=request.customer_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': "CommerceCustomer", + '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='get-commerce-customer', + ) + 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['GetCommerceCustomerRequest', 'GetCommerceCustomerRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCustomer: + 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_commerce_customer_serialize( + self, + company_id, + connection_id, + customer_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 customer_id is not None: + _path_params['customerId'] = customer_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}/data/commerce-customers/{customerId}', + 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['ListCommerceCustomersRequest', 'ListCommerceCustomersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCustomers: + """List customers""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceCustomersRequest.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_commerce_customers_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': "CommerceCustomers", + '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-commerce-customers', + ) + 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['ListCommerceCustomersRequest', 'ListCommerceCustomersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceCustomers: + 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_commerce_customers_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/commerce-customers', + 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/lending/src/codat_lending/api/sales_payments.py b/lending/src/codat_lending/api/sales_payments.py new file mode 100644 index 000000000..73636abe8 --- /dev/null +++ b/lending/src/codat_lending/api/sales_payments.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercepayment import CommercePayment +from codat_lending.models.shared.commercepayments import CommercePayments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommercePaymentRequestTypedDict(TypedDict): + """TypedDict variant of GetCommercePaymentRequest, 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.")] + payment_id: Annotated[str, Field(description="Unique identifier for a payment.")] + + +class GetCommercePaymentRequest(BaseModel): + """Request envelope for get_commerce_payment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + payment_id: Annotated[str, Field(description="Unique identifier for a payment.")] + + @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 ListCommercePaymentsRequestTypedDict(TypedDict): + """TypedDict variant of ListCommercePaymentsRequest, 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 ListCommercePaymentsRequest(BaseModel): + """Request envelope for list_commerce_payments.""" + 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 SalesPayments: + """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['GetCommercePaymentRequest', 'GetCommercePaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePayment: + """Get payment""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommercePaymentRequest.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_commerce_payment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + payment_id=request.payment_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': "CommercePayment", + '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='get-commerce-payment', + ) + 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['GetCommercePaymentRequest', 'GetCommercePaymentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePayment: + 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_commerce_payment_serialize( + self, + company_id, + connection_id, + payment_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 payment_id is not None: + _path_params['paymentId'] = payment_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}/data/commerce-payments/{paymentId}', + 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['ListCommercePaymentsRequest', 'ListCommercePaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePayments: + """List payments""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommercePaymentsRequest.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_commerce_payments_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': "CommercePayments", + '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-commerce-payments', + ) + 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['ListCommercePaymentsRequest', 'ListCommercePaymentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommercePayments: + 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_commerce_payments_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/commerce-payments', + 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/lending/src/codat_lending/api/sales_reports.py b/lending/src/codat_lending/api/sales_reports.py new file mode 100644 index 000000000..f07146827 --- /dev/null +++ b/lending/src/codat_lending/api/sales_reports.py @@ -0,0 +1,564 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, field_validator +from typing import Optional +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercereport import CommerceReport + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceOrdersReportRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceOrdersReportRequest, 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.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: NotRequired[Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")]] + + +class GetCommerceOrdersReportRequest(BaseModel): + """Request envelope for get_commerce_orders_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")] = 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 GetCommerceRefundsReportRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceRefundsReportRequest, 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.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: NotRequired[Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")]] + + +class GetCommerceRefundsReportRequest(BaseModel): + """Request envelope for get_commerce_refunds_report.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + report_date: Annotated[str, Field(description="The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.")] + period_length: Annotated[int, Field(description="The number of months per period. E.g. 2 = 2 months per period.")] + number_of_periods: Annotated[int, Field(description="The number of periods to return. There will be no pagination as a query parameter.")] + period_unit: Annotated[str, Field(description="The period unit of time returned.")] + include_display_names: Annotated[Optional[bool], Field(description="Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.")] = 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 SalesReports: + """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_orders( + self, + *, + request: Union['GetCommerceOrdersReportRequest', 'GetCommerceOrdersReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + """Get orders report""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceOrdersReportRequest.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_commerce_orders_report_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + report_date=request.report_date, + period_length=request.period_length, + number_of_periods=request.number_of_periods, + period_unit=request.period_unit, + include_display_names=request.include_display_names, + _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': "CommerceReport", + '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-commerce-orders-report', + ) + 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_orders_async( + self, + *, + request: Union['GetCommerceOrdersReportRequest', 'GetCommerceOrdersReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_orders( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_orders_report_serialize( + self, + company_id, + connection_id, + report_date, + period_length, + number_of_periods, + period_unit, + include_display_names, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_unit is not None: + + _query_params.append(('periodUnit', period_unit)) + + if include_display_names is not None: + + _query_params.append(('includeDisplayNames', include_display_names)) + + # 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='/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/orders', + 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_refunds( + self, + *, + request: Union['GetCommerceRefundsReportRequest', 'GetCommerceRefundsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + """Get refunds report""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceRefundsReportRequest.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_commerce_refunds_report_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + report_date=request.report_date, + period_length=request.period_length, + number_of_periods=request.number_of_periods, + period_unit=request.period_unit, + include_display_names=request.include_display_names, + _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': "CommerceReport", + '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-commerce-refunds-report', + ) + 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_refunds_async( + self, + *, + request: Union['GetCommerceRefundsReportRequest', 'GetCommerceRefundsReportRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceReport: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_refunds( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_commerce_refunds_report_serialize( + self, + company_id, + connection_id, + report_date, + period_length, + number_of_periods, + period_unit, + include_display_names, + _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 report_date is not None: + + _query_params.append(('reportDate', report_date)) + + if period_length is not None: + + _query_params.append(('periodLength', period_length)) + + if number_of_periods is not None: + + _query_params.append(('numberOfPeriods', number_of_periods)) + + if period_unit is not None: + + _query_params.append(('periodUnit', period_unit)) + + if include_display_names is not None: + + _query_params.append(('includeDisplayNames', include_display_names)) + + # 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='/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/refunds', + 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/lending/src/codat_lending/api/sales_transactions.py b/lending/src/codat_lending/api/sales_transactions.py new file mode 100644 index 000000000..4b9db78d5 --- /dev/null +++ b/lending/src/codat_lending/api/sales_transactions.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.commercetransaction import CommerceTransaction +from codat_lending.models.shared.commercetransactions import CommerceTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetCommerceTransactionRequestTypedDict(TypedDict): + """TypedDict variant of GetCommerceTransactionRequest, 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.")] + transaction_id: Annotated[str, Field(description="Unique identifier for a transaction.")] + + +class GetCommerceTransactionRequest(BaseModel): + """Request envelope for get_commerce_transaction.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + transaction_id: Annotated[str, Field(description="Unique identifier for a transaction.")] + + @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 ListCommerceTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of ListCommerceTransactionsRequest, 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 ListCommerceTransactionsRequest(BaseModel): + """Request envelope for list_commerce_transactions.""" + 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 SalesTransactions: + """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['GetCommerceTransactionRequest', 'GetCommerceTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceTransaction: + """Get transaction""" # noqa: E501 + + if isinstance(request, dict): + request = GetCommerceTransactionRequest.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_commerce_transaction_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + transaction_id=request.transaction_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': "CommerceTransaction", + '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='get-commerce-transaction', + ) + 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['GetCommerceTransactionRequest', 'GetCommerceTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceTransaction: + 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_commerce_transaction_serialize( + self, + company_id, + connection_id, + transaction_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 transaction_id is not None: + _path_params['transactionId'] = transaction_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}/data/commerce-transactions/{transactionId}', + 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['ListCommerceTransactionsRequest', 'ListCommerceTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceTransactions: + """List transactions""" # noqa: E501 + + if isinstance(request, dict): + request = ListCommerceTransactionsRequest.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_commerce_transactions_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': "CommerceTransactions", + '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-commerce-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 list_async( + self, + *, + request: Union['ListCommerceTransactionsRequest', 'ListCommerceTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> CommerceTransactions: + 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_commerce_transactions_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/commerce-transactions', + 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/lending/src/codat_lending/api/source_accounts.py b/lending/src/codat_lending/api/source_accounts.py new file mode 100644 index 000000000..470a90c65 --- /dev/null +++ b/lending/src/codat_lending/api/source_accounts.py @@ -0,0 +1,751 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankfeedbankaccountmapping import BankFeedBankAccountMapping +from codat_lending.models.shared.bankfeedbankaccountmappingresponse import BankFeedBankAccountMappingResponse +from codat_lending.models.shared.bankfeedmapping import BankFeedMapping +from codat_lending.models.create_source_account200_response import CreateSourceAccount200Response + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_lending.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from typing import Any, List, Union +from typing_extensions import TypeAliasType +from codat_lending.models.shared.sourceaccount import SourceAccount +from codat_lending.models.source_account_v2 import SourceAccountV2 +CreateSourceAccountResponseBody = TypeAliasType("CreateSourceAccountResponseBody", Union[SourceAccount, SourceAccountV2]) +CreateSourceAccountRequestBody = TypeAliasType("CreateSourceAccountRequestBody", Union[SourceAccountPrototype, SourceAccountV2Prototype]) + + +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_bank_account_mapping: NotRequired[Optional[BankFeedBankAccountMapping]] + + +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_bank_account_mapping: Optional[BankFeedBankAccountMapping] = 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 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 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_mapping( + 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, + ) -> BankFeedBankAccountMappingResponse: + """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_bank_account_mapping=request.bank_feed_bank_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': "BankFeedBankAccountMappingResponse", + '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_mapping_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, + ) -> BankFeedBankAccountMappingResponse: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.create_mapping( + 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_bank_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_bank_account_mapping is not None: + _body_params = bank_feed_bank_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 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 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 list_mappings( + 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 account mappings""" # 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 list_mappings_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.list_mappings( + 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/lending/src/codat_lending/api/suppliers.py b/lending/src/codat_lending/api/suppliers.py new file mode 100644 index 000000000..1d886499b --- /dev/null +++ b/lending/src/codat_lending/api/suppliers.py @@ -0,0 +1,1210 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingsupplier import AccountingSupplier +from codat_lending.models.shared.accountingsuppliers import AccountingSuppliers +from codat_lending.models.shared.attachments import Attachments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingSupplierAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingSupplierAttachmentRequest, 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.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingSupplierAttachmentRequest(BaseModel): + """Request envelope for download_accounting_supplier_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 GetAccountingSupplierRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingSupplierRequest, for dict-literal request inputs.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + + +class GetAccountingSupplierRequest(BaseModel): + """Request envelope for get_accounting_supplier.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + + @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 GetAccountingSupplierAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingSupplierAttachmentRequest, 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.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class GetAccountingSupplierAttachmentRequest(BaseModel): + """Request envelope for get_accounting_supplier_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 ListAccountingSupplierAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingSupplierAttachmentsRequest, 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.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + + +class ListAccountingSupplierAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_supplier_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + supplier_id: Annotated[str, Field(description="Unique identifier for a supplier.")] + + @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 ListAccountingSuppliersRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingSuppliersRequest, 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 ListAccountingSuppliersRequest(BaseModel): + """Request envelope for list_accounting_suppliers.""" + 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 Suppliers: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingSupplierAttachmentRequest', 'DownloadAccountingSupplierAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download supplier attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingSupplierAttachmentRequest.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._download_accounting_supplier_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + supplier_id=request.supplier_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-supplier-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingSupplierAttachmentRequest', 'DownloadAccountingSupplierAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_supplier_attachment_serialize( + self, + company_id, + connection_id, + supplier_id, + attachment_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 supplier_id is not None: + _path_params['supplierId'] = supplier_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments/{attachmentId}/download', + 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['GetAccountingSupplierRequest', 'GetAccountingSupplierRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingSupplier: + """Get supplier""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingSupplierRequest.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_accounting_supplier_serialize( + company_id=request.company_id, + supplier_id=request.supplier_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': "AccountingSupplier", + '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='get-accounting-supplier', + ) + 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['GetAccountingSupplierRequest', 'GetAccountingSupplierRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingSupplier: + 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_accounting_supplier_serialize( + self, + company_id, + supplier_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 supplier_id is not None: + _path_params['supplierId'] = supplier_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}/data/suppliers/{supplierId}', + 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_attachment( + self, + *, + request: Union['GetAccountingSupplierAttachmentRequest', 'GetAccountingSupplierAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get supplier attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingSupplierAttachmentRequest.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_accounting_supplier_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + supplier_id=request.supplier_id, + attachment_id=request.attachment_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': "AccountingAttachment", + '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-accounting-supplier-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingSupplierAttachmentRequest', 'GetAccountingSupplierAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_supplier_attachment_serialize( + self, + company_id, + connection_id, + supplier_id, + attachment_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 supplier_id is not None: + _path_params['supplierId'] = supplier_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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}/data/suppliers/{supplierId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingSupplierAttachmentsRequest', 'ListAccountingSupplierAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List supplier attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingSupplierAttachmentsRequest.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_accounting_supplier_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + supplier_id=request.supplier_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': "Attachments", + '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-accounting-supplier-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingSupplierAttachmentsRequest', 'ListAccountingSupplierAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_supplier_attachments_serialize( + self, + company_id, + connection_id, + supplier_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 supplier_id is not None: + _path_params['supplierId'] = supplier_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}/data/suppliers/{supplierId}/attachments', + 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['ListAccountingSuppliersRequest', 'ListAccountingSuppliersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingSuppliers: + """List suppliers""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingSuppliersRequest.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_accounting_suppliers_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': "AccountingSuppliers", + '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-accounting-suppliers', + ) + 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['ListAccountingSuppliersRequest', 'ListAccountingSuppliersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingSuppliers: + 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_accounting_suppliers_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}/data/suppliers', + 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/lending/src/codat_lending/api/transaction_categories.py b/lending/src/codat_lending/api/transaction_categories.py new file mode 100644 index 000000000..d8d57fd8a --- /dev/null +++ b/lending/src/codat_lending/api/transaction_categories.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankingtransactioncategories import BankingTransactionCategories +from codat_lending.models.shared.bankingtransactioncategory import BankingTransactionCategory + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetBankingTransactionCategoryRequestTypedDict(TypedDict): + """TypedDict variant of GetBankingTransactionCategoryRequest, 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.")] + transaction_category_id: Annotated[str, Field(description="The unique identifier for a banking transaction category")] + + +class GetBankingTransactionCategoryRequest(BaseModel): + """Request envelope for get_banking_transaction_category.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + transaction_category_id: Annotated[str, Field(description="The unique identifier for a banking transaction category")] + + @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 ListBankingTransactionCategoriesRequestTypedDict(TypedDict): + """TypedDict variant of ListBankingTransactionCategoriesRequest, 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 ListBankingTransactionCategoriesRequest(BaseModel): + """Request envelope for list_banking_transaction_categories.""" + 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 TransactionCategories: + """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['GetBankingTransactionCategoryRequest', 'GetBankingTransactionCategoryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactionCategory: + """Get transaction category""" # noqa: E501 + + if isinstance(request, dict): + request = GetBankingTransactionCategoryRequest.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_banking_transaction_category_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + transaction_category_id=request.transaction_category_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': "BankingTransactionCategory", + '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='get-banking-transaction-category', + ) + 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['GetBankingTransactionCategoryRequest', 'GetBankingTransactionCategoryRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactionCategory: + 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_banking_transaction_category_serialize( + self, + company_id, + connection_id, + transaction_category_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 transaction_category_id is not None: + _path_params['transactionCategoryId'] = transaction_category_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}/data/banking-transactionCategories/{transactionCategoryId}', + 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['ListBankingTransactionCategoriesRequest', 'ListBankingTransactionCategoriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactionCategories: + """List transaction categories""" # noqa: E501 + + if isinstance(request, dict): + request = ListBankingTransactionCategoriesRequest.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_banking_transaction_categories_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': "BankingTransactionCategories", + '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-banking-transaction-categories', + ) + 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['ListBankingTransactionCategoriesRequest', 'ListBankingTransactionCategoriesRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactionCategories: + 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_banking_transaction_categories_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/banking-transactionCategories', + 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/lending/src/codat_lending/api/transactions.py b/lending/src/codat_lending/api/transactions.py new file mode 100644 index 000000000..a17126efd --- /dev/null +++ b/lending/src/codat_lending/api/transactions.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.bankingtransaction import BankingTransaction +from codat_lending.models.shared.bankingtransactions import BankingTransactions + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetBankingTransactionRequestTypedDict(TypedDict): + """TypedDict variant of GetBankingTransactionRequest, 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.")] + transaction_id: Annotated[str, Field(description="The unique identifier for a transaction")] + + +class GetBankingTransactionRequest(BaseModel): + """Request envelope for get_banking_transaction.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + transaction_id: Annotated[str, Field(description="The unique identifier for a transaction")] + + @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 ListBankingTransactionsRequestTypedDict(TypedDict): + """TypedDict variant of ListBankingTransactionsRequest, 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 ListBankingTransactionsRequest(BaseModel): + """Request envelope for list_banking_transactions.""" + 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 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 get( + self, + *, + request: Union['GetBankingTransactionRequest', 'GetBankingTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransaction: + """Get bank transaction""" # noqa: E501 + + if isinstance(request, dict): + request = GetBankingTransactionRequest.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_banking_transaction_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + transaction_id=request.transaction_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': "BankingTransaction", + '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='get-banking-transaction', + ) + 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['GetBankingTransactionRequest', 'GetBankingTransactionRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransaction: + 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_banking_transaction_serialize( + self, + company_id, + connection_id, + transaction_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 transaction_id is not None: + _path_params['transactionId'] = transaction_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}/data/banking-transactions/{transactionId}', + 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['ListBankingTransactionsRequest', 'ListBankingTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactions: + """List transactions""" # noqa: E501 + + if isinstance(request, dict): + request = ListBankingTransactionsRequest.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_banking_transactions_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': "BankingTransactions", + '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-banking-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 list_async( + self, + *, + request: Union['ListBankingTransactionsRequest', 'ListBankingTransactionsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> BankingTransactions: + 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_banking_transactions_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/banking-transactions', + 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/lending/src/codat_lending/api/transactions_direct_costs.py b/lending/src/codat_lending/api/transactions_direct_costs.py new file mode 100644 index 000000000..8208fe973 --- /dev/null +++ b/lending/src/codat_lending/api/transactions_direct_costs.py @@ -0,0 +1,1222 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 httpx +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, Tuple, Union +from typing_extensions import Annotated +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingdirectcost import AccountingDirectCost +from codat_lending.models.shared.accountingdirectcosts import AccountingDirectCosts +from codat_lending.models.shared.attachments import Attachments + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + + + +def _wrap_binary_to_httpx_response(data, content_type=None): + """Wrap raw binary response data into an httpx.Response so callers + can rely on .status_code / .headers / .content / .read() as they + would with the Speakeasy SDK. The data we get from OAG is the + decoded body bytes — status code is 200 by construction (errors + raised earlier as SDKError). content_type is the op's 2xx media + type, set as the response Content-Type header so a consumer reading + it gets the media type Speakeasy carries. + """ + if isinstance(data, httpx.Response): + return data + if data is None: + content = b'' + elif isinstance(data, (bytes, bytearray, memoryview)): + content = bytes(data) + else: + content = bytes(str(data), 'utf-8') + headers = {'content-type': content_type} if content_type else None + return httpx.Response(status_code=200, content=content, headers=headers) + + +class DownloadAccountingDirectCostAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of DownloadAccountingDirectCostAttachmentRequest, 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.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class DownloadAccountingDirectCostAttachmentRequest(BaseModel): + """Request envelope for download_accounting_direct_cost_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 GetAccountingDirectCostRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingDirectCostRequest, 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.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + + +class GetAccountingDirectCostRequest(BaseModel): + """Request envelope for get_accounting_direct_cost.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + + @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 GetAccountingDirectCostAttachmentRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingDirectCostAttachmentRequest, 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.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + +class GetAccountingDirectCostAttachmentRequest(BaseModel): + """Request envelope for get_accounting_direct_cost_attachment.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + attachment_id: Annotated[str, Field(description="Unique identifier for an attachment.")] + + @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 ListAccountingDirectCostAttachmentsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingDirectCostAttachmentsRequest, 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.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + + +class ListAccountingDirectCostAttachmentsRequest(BaseModel): + """Request envelope for list_accounting_direct_cost_attachments.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + direct_cost_id: Annotated[str, Field(description="Unique identifier for a direct cost.")] + + @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 ListAccountingDirectCostsRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingDirectCostsRequest, 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 ListAccountingDirectCostsRequest(BaseModel): + """Request envelope for list_accounting_direct_costs.""" + 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 TransactionsDirectCosts: + """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 download_attachment( + self, + *, + request: Union['DownloadAccountingDirectCostAttachmentRequest', 'DownloadAccountingDirectCostAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + """Download direct cost attachment""" # noqa: E501 + + if isinstance(request, dict): + request = DownloadAccountingDirectCostAttachmentRequest.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._download_accounting_direct_cost_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_cost_id=request.direct_cost_id, + attachment_id=request.attachment_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': "bytearray", + '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='download-accounting-direct-cost-attachment', + ) + 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 _wrap_binary_to_httpx_response(execute_with_retries(_do_call, _effective_retries), 'application/octet-stream') + + + @validate_call(config={"arbitrary_types_allowed": True}) + async def download_attachment_async( + self, + *, + request: Union['DownloadAccountingDirectCostAttachmentRequest', 'DownloadAccountingDirectCostAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> httpx.Response: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.download_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _download_accounting_direct_cost_attachment_serialize( + self, + company_id, + connection_id, + direct_cost_id, + attachment_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 direct_cost_id is not None: + _path_params['directCostId'] = direct_cost_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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'] = 'application/octet-stream' + + + _auth_settings: List[str] = [ + 'auth_header' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments/{attachmentId}/download', + 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['GetAccountingDirectCostRequest', 'GetAccountingDirectCostRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectCost: + """Get direct cost""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingDirectCostRequest.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_accounting_direct_cost_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_cost_id=request.direct_cost_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': "AccountingDirectCost", + '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='get-accounting-direct-cost', + ) + 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['GetAccountingDirectCostRequest', 'GetAccountingDirectCostRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectCost: + 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_accounting_direct_cost_serialize( + self, + company_id, + connection_id, + direct_cost_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 direct_cost_id is not None: + _path_params['directCostId'] = direct_cost_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}/data/directCosts/{directCostId}', + 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_attachment( + self, + *, + request: Union['GetAccountingDirectCostAttachmentRequest', 'GetAccountingDirectCostAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + """Get direct cost attachment""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingDirectCostAttachmentRequest.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_accounting_direct_cost_attachment_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_cost_id=request.direct_cost_id, + attachment_id=request.attachment_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': "AccountingAttachment", + '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-accounting-direct-cost-attachment', + ) + 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_attachment_async( + self, + *, + request: Union['GetAccountingDirectCostAttachmentRequest', 'GetAccountingDirectCostAttachmentRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingAttachment: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.get_attachment( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _get_accounting_direct_cost_attachment_serialize( + self, + company_id, + connection_id, + direct_cost_id, + attachment_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 direct_cost_id is not None: + _path_params['directCostId'] = direct_cost_id + if attachment_id is not None: + _path_params['attachmentId'] = attachment_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}/data/directCosts/{directCostId}/attachments/{attachmentId}', + 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_attachments( + self, + *, + request: Union['ListAccountingDirectCostAttachmentsRequest', 'ListAccountingDirectCostAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + """List direct cost attachments""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingDirectCostAttachmentsRequest.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_accounting_direct_cost_attachments_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + direct_cost_id=request.direct_cost_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': "Attachments", + '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-accounting-direct-cost-attachments', + ) + 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_attachments_async( + self, + *, + request: Union['ListAccountingDirectCostAttachmentsRequest', 'ListAccountingDirectCostAttachmentsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> Attachments: + return await asyncio.get_event_loop().run_in_executor( + None, + lambda: self.list_attachments( + request=request, + retries=retries, + server_url=server_url, + timeout_ms=timeout_ms, + http_headers=http_headers, + ), + ) + + + def _list_accounting_direct_cost_attachments_serialize( + self, + company_id, + connection_id, + direct_cost_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 direct_cost_id is not None: + _path_params['directCostId'] = direct_cost_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}/data/directCosts/{directCostId}/attachments', + 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['ListAccountingDirectCostsRequest', 'ListAccountingDirectCostsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectCosts: + """List direct costs""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingDirectCostsRequest.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_accounting_direct_costs_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': "AccountingDirectCosts", + '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-accounting-direct-costs', + ) + 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['ListAccountingDirectCostsRequest', 'ListAccountingDirectCostsRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingDirectCosts: + 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_accounting_direct_costs_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/directCosts', + 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/lending/src/codat_lending/api/transactions_group.py b/lending/src/codat_lending/api/transactions_group.py new file mode 100644 index 000000000..49ecd1fa9 --- /dev/null +++ b/lending/src/codat_lending/api/transactions_group.py @@ -0,0 +1,32 @@ +"""Generated wrapper exposing the transactions sub-method-groups. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" + +from __future__ import annotations + +from codat_lending.api_client import ApiClient + +from codat_lending.api.account_transactions import AccountTransactions +from codat_lending.api.transactions_direct_costs import TransactionsDirectCosts +from codat_lending.api.journal_entries import JournalEntries +from codat_lending.api.journals import Journals +from codat_lending.api.transactions_transfers import TransactionsTransfers + + +class TransactionsGroup: + account_transactions: AccountTransactions + direct_costs: TransactionsDirectCosts + journal_entries: JournalEntries + journals: Journals + transfers: TransactionsTransfers + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + self.account_transactions = AccountTransactions(api_client=self.api_client) + self.direct_costs = TransactionsDirectCosts(api_client=self.api_client) + self.journal_entries = JournalEntries(api_client=self.api_client) + self.journals = Journals(api_client=self.api_client) + self.transfers = TransactionsTransfers(api_client=self.api_client) diff --git a/lending/src/codat_lending/api/transactions_transfers.py b/lending/src/codat_lending/api/transactions_transfers.py new file mode 100644 index 000000000..32da2b43a --- /dev/null +++ b/lending/src/codat_lending/api/transactions_transfers.py @@ -0,0 +1,524 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.shared.accountingtransfer import AccountingTransfer +from codat_lending.models.shared.accountingtransfers import AccountingTransfers + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class GetAccountingTransferRequestTypedDict(TypedDict): + """TypedDict variant of GetAccountingTransferRequest, 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.")] + transfer_id: Annotated[str, Field(description="Unique identifier for a transfer.")] + + +class GetAccountingTransferRequest(BaseModel): + """Request envelope for get_accounting_transfer.""" + company_id: Annotated[str, Field(description="Unique identifier for a company.")] + connection_id: Annotated[str, Field(description="Unique identifier for a connection.")] + transfer_id: Annotated[str, Field(description="Unique identifier for a transfer.")] + + @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 ListAccountingTransfersRequestTypedDict(TypedDict): + """TypedDict variant of ListAccountingTransfersRequest, 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 ListAccountingTransfersRequest(BaseModel): + """Request envelope for list_accounting_transfers.""" + 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 TransactionsTransfers: + """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['GetAccountingTransferRequest', 'GetAccountingTransferRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingTransfer: + """Get transfer""" # noqa: E501 + + if isinstance(request, dict): + request = GetAccountingTransferRequest.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_accounting_transfer_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + transfer_id=request.transfer_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': "AccountingTransfer", + '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='get-accounting-transfer', + ) + 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['GetAccountingTransferRequest', 'GetAccountingTransferRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingTransfer: + 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_accounting_transfer_serialize( + self, + company_id, + connection_id, + transfer_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 transfer_id is not None: + _path_params['transferId'] = transfer_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}/data/transfers/{transferId}', + 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['ListAccountingTransfersRequest', 'ListAccountingTransfersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingTransfers: + """List transfers""" # noqa: E501 + + if isinstance(request, dict): + request = ListAccountingTransfersRequest.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_accounting_transfers_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': "AccountingTransfers", + '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-accounting-transfers', + ) + 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['ListAccountingTransfersRequest', 'ListAccountingTransfersRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingTransfers: + 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_accounting_transfers_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/transfers', + 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/lending/src/codat_lending/api/transfers.py b/lending/src/codat_lending/api/transfers.py new file mode 100644 index 000000000..3138728b9 --- /dev/null +++ b/lending/src/codat_lending/api/transfers.py @@ -0,0 +1,519 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.shared.file import File +from codat_lending.models.accounting_create_transfer_response import AccountingCreateTransferResponse +from codat_lending.models.shared.accountingtransfer import AccountingTransfer +from codat_lending.models.shared.pushoption import PushOption + +from codat_lending.api_client import ApiClient, RequestSerialized +from codat_lending.api_response import ApiResponse +from codat_lending.exceptions import ApiException +from codat_lending.models.errors import ErrorMessage, SDKError +from codat_lending.models.errors.errormessage import ErrorMessageData as _ErrorMessageDataSchema +from codat_lending.rest import RESTResponseType +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig, execute_with_retries + + +class CreateTransferRequestTypedDict(TypedDict): + """TypedDict variant of CreateTransferRequest, 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.")]] + allow_sync_on_push_complete: NotRequired[Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")]] + accounting_transfer: NotRequired[Optional[AccountingTransfer]] + + +class CreateTransferRequest(BaseModel): + """Request envelope for create_transfer.""" + 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 + allow_sync_on_push_complete: Annotated[Optional[bool], Field(description="Allow a sync upon push completion.")] = True + accounting_transfer: Optional[AccountingTransfer] = 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 GetCreateTransfersModelRequestTypedDict(TypedDict): + """TypedDict variant of GetCreateTransfersModelRequest, 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 GetCreateTransfersModelRequest(BaseModel): + """Request envelope for get_create_transfers_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 Transfers: + """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['CreateTransferRequest', 'CreateTransferRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateTransferResponse: + """Create transfer""" # noqa: E501 + + if isinstance(request, dict): + request = CreateTransferRequest.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_transfer_serialize( + company_id=request.company_id, + connection_id=request.connection_id, + timeout_in_minutes=request.timeout_in_minutes, + allow_sync_on_push_complete=request.allow_sync_on_push_complete, + accounting_transfer=request.accounting_transfer, + _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': "AccountingCreateTransferResponse", + '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-transfer', + ) + 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['CreateTransferRequest', 'CreateTransferRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> AccountingCreateTransferResponse: + 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_transfer_serialize( + self, + company_id, + connection_id, + timeout_in_minutes, + allow_sync_on_push_complete, + accounting_transfer, + _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)) + + 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 accounting_transfer is not None: + _body_params = accounting_transfer + + + 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/transfers', + 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['GetCreateTransfersModelRequest', 'GetCreateTransfersModelRequestTypedDict'], + retries: OptionalNullable[RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> PushOption: + """Get create transfer model""" # noqa: E501 + + if isinstance(request, dict): + request = GetCreateTransfersModelRequest.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_transfers_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-transfers-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['GetCreateTransfersModelRequest', 'GetCreateTransfersModelRequestTypedDict'], + 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_transfers_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/transfers', + 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/lending/src/codat_lending/api_client.py b/lending/src/codat_lending/api_client.py new file mode 100644 index 000000000..9065b42a9 --- /dev/null +++ b/lending/src/codat_lending/api_client.py @@ -0,0 +1,803 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.configuration import Configuration +from codat_lending.api_response import ApiResponse, T as ApiResponseT +import codat_lending.models +from codat_lending import rest +from codat_lending.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_lending.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/lending/src/codat_lending/api_response.py b/lending/src/codat_lending/api_response.py new file mode 100644 index 000000000..8a1236a62 --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/balance_sheet.py b/lending/src/codat_lending/balance_sheet.py index b51b239a1..67eb57fd2 100644 --- a/lending/src/codat_lending/balance_sheet.py +++ b/lending/src/codat_lending/balance_sheet.py @@ -1,415 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.balance_sheet — re-export of the balance_sheet method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BalanceSheet(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingBalanceSheetRequest, - operations.GetAccountingBalanceSheetRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBalanceSheet: - r"""Get balance sheet - - Gets the latest balance sheet 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.GetAccountingBalanceSheetRequest - ) - request = cast(operations.GetAccountingBalanceSheetRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/financials/balanceSheet", - 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-accounting-balance-sheet", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBalanceSheet, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingBalanceSheetRequest, - operations.GetAccountingBalanceSheetRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBalanceSheet: - r"""Get balance sheet - - Gets the latest balance sheet 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.GetAccountingBalanceSheetRequest - ) - request = cast(operations.GetAccountingBalanceSheetRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/financials/balanceSheet", - 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-accounting-balance-sheet", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBalanceSheet, http_res) - if utils.match_response( - http_res, ["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) - - def get_categorized_accounts( - self, - *, - request: Union[ - operations.GetCategorizedBalanceSheetStatementRequest, - operations.GetCategorizedBalanceSheetStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedFinancialReport: - r"""Get categorized balance sheet statement - - The *Get categorized balance sheet statement* endpoint returns a list of categorized accounts that appear on a company’s Balance Sheet along with a balance per financial statement date. - - Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - - :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.GetCategorizedBalanceSheetStatementRequest - ) - request = cast(operations.GetCategorizedBalanceSheetStatementRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/enhancedBalanceSheet/accounts", - 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-categorized-balance-sheet-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedFinancialReport, 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_categorized_accounts_async( - self, - *, - request: Union[ - operations.GetCategorizedBalanceSheetStatementRequest, - operations.GetCategorizedBalanceSheetStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedFinancialReport: - r"""Get categorized balance sheet statement - - The *Get categorized balance sheet statement* endpoint returns a list of categorized accounts that appear on a company’s Balance Sheet along with a balance per financial statement date. - - Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - - :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.GetCategorizedBalanceSheetStatementRequest - ) - request = cast(operations.GetCategorizedBalanceSheetStatementRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/enhancedBalanceSheet/accounts", - 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-categorized-balance-sheet-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedFinancialReport, 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_lending.api.balance_sheet import BalanceSheet diff --git a/lending/src/codat_lending/bank_accounts.py b/lending/src/codat_lending/bank_accounts.py index 043772858..cc7fd3ba7 100644 --- a/lending/src/codat_lending/bank_accounts.py +++ b/lending/src/codat_lending/bank_accounts.py @@ -1,451 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bank_accounts — re-export of the bank_accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BankAccounts(BaseSDK): - 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.AccountingCreateBankAccountResponse: - r"""Create bank account - - The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/lending-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.accounting_bank_account if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingBankAccount], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateBankAccountResponse, 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.AccountingCreateBankAccountResponse: - r"""Create bank account - - The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/lending-api#/schemas/BankAccount) for a given company's connection. - - [Bank accounts](https://docs.codat.io/lending-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/lending-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.accounting_bank_account if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingBankAccount], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateBankAccountResponse, 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_update_model( - self, - *, - request: Union[ - operations.GetCreateUpdateBankAccountsModelRequest, - operations.GetCreateUpdateBankAccountsModelRequestTypedDict, - ], - 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/lending-api#/schemas/BankAccount) for a given company and integration. - - [Bank accounts](https://docs.codat.io/lending-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.GetCreateUpdateBankAccountsModelRequest - ) - request = cast(operations.GetCreateUpdateBankAccountsModelRequest, 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-update-bankAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_update_model_async( - self, - *, - request: Union[ - operations.GetCreateUpdateBankAccountsModelRequest, - operations.GetCreateUpdateBankAccountsModelRequestTypedDict, - ], - 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/lending-api#/schemas/BankAccount) for a given company and integration. - - [Bank accounts](https://docs.codat.io/lending-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.GetCreateUpdateBankAccountsModelRequest - ) - request = cast(operations.GetCreateUpdateBankAccountsModelRequest, 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-update-bankAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.bank_accounts import BankAccounts diff --git a/lending/src/codat_lending/bank_statements.py b/lending/src/codat_lending/bank_statements.py index e1e9e74f9..65aa589c9 100644 --- a/lending/src/codat_lending/bank_statements.py +++ b/lending/src/codat_lending/bank_statements.py @@ -1,1113 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bank_statements — re-export of the bank_statements method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BankStatements(BaseSDK): - r"""Retrieve banking data from linked bank accounts.""" - - def end_upload_session( - self, - *, - request: Union[ - operations.EndBankStatementUploadSessionRequest, - operations.EndBankStatementUploadSessionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""End upload session - - Use the *End upload session* endpoint to finalize a bank statement upload session. Include a `status` in the request body to indicate if you want to cancel the processing of the dataset or trigger the ingestion and enrichment of the data. - - A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - - :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.EndBankStatementUploadSessionRequest - ) - request = cast(operations.EndBankStatementUploadSessionRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/dataset/{datasetId}/endSession", - 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.end_upload_session_request if request is not None else None, - False, - True, - "json", - Optional[shared.EndUploadSessionRequest], - ), - 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="end-bank-statement-upload-session", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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 end_upload_session_async( - self, - *, - request: Union[ - operations.EndBankStatementUploadSessionRequest, - operations.EndBankStatementUploadSessionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""End upload session - - Use the *End upload session* endpoint to finalize a bank statement upload session. Include a `status` in the request body to indicate if you want to cancel the processing of the dataset or trigger the ingestion and enrichment of the data. - - A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - - :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.EndBankStatementUploadSessionRequest - ) - request = cast(operations.EndBankStatementUploadSessionRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/dataset/{datasetId}/endSession", - 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.end_upload_session_request if request is not None else None, - False, - True, - "json", - Optional[shared.EndUploadSessionRequest], - ), - 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="end-bank-statement-upload-session", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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_upload_configuration( - self, - *, - request: Union[ - operations.GetBankStatementUploadConfigurationRequest, - operations.GetBankStatementUploadConfigurationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankStatementUploadConfiguration: - r"""Get upload configuration - - Use the *Get upload configuration* endpoint to view the existing bank statement upload configuration for the specified data connection. - - With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - - When you use the [*Upload data*](https://docs.codat.io/lending-api#/operations/upload-bank-statement-data) endpoint next, you must upload the data for the account you configured. - - :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.GetBankStatementUploadConfigurationRequest - ) - request = cast(operations.GetBankStatementUploadConfigurationRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/configuration", - 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-statement-upload-configuration", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankStatementUploadConfiguration, 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_upload_configuration_async( - self, - *, - request: Union[ - operations.GetBankStatementUploadConfigurationRequest, - operations.GetBankStatementUploadConfigurationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankStatementUploadConfiguration: - r"""Get upload configuration - - Use the *Get upload configuration* endpoint to view the existing bank statement upload configuration for the specified data connection. - - With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - - When you use the [*Upload data*](https://docs.codat.io/lending-api#/operations/upload-bank-statement-data) endpoint next, you must upload the data for the account you configured. - - :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.GetBankStatementUploadConfigurationRequest - ) - request = cast(operations.GetBankStatementUploadConfigurationRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/configuration", - 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-statement-upload-configuration", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankStatementUploadConfiguration, 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 set_upload_configuration( - self, - *, - request: Union[ - operations.SetBankStatementUploadConfigurationRequest, - operations.SetBankStatementUploadConfigurationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankStatementUploadConfiguration: - r"""Set upload configuration - - Use the *Set upload configuration* endpoint to create bank statement upload configuration for the specified data connection. - - With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - - Each data connection can only have one configuration for each company and external account ID combination. You will receive a Bad Request response if you try to set it again. - - :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.SetBankStatementUploadConfigurationRequest - ) - request = cast(operations.SetBankStatementUploadConfigurationRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/configuration", - 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_statement_upload_configuration - if request is not None - else None, - False, - True, - "json", - Optional[shared.BankStatementUploadConfiguration], - ), - 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="set-bank-statement-upload-configuration", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankStatementUploadConfiguration, 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 set_upload_configuration_async( - self, - *, - request: Union[ - operations.SetBankStatementUploadConfigurationRequest, - operations.SetBankStatementUploadConfigurationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankStatementUploadConfiguration: - r"""Set upload configuration - - Use the *Set upload configuration* endpoint to create bank statement upload configuration for the specified data connection. - - With this configuration, you set the source of the data you plan to upload, the ID of the account in third-party banking platform, and a provider ID, if required. This lets us determine the expected format of the data and any source-specific requirements. - - Each data connection can only have one configuration for each company and external account ID combination. You will receive a Bad Request response if you try to set it again. - - :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.SetBankStatementUploadConfigurationRequest - ) - request = cast(operations.SetBankStatementUploadConfigurationRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/configuration", - 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_statement_upload_configuration - if request is not None - else None, - False, - True, - "json", - Optional[shared.BankStatementUploadConfiguration], - ), - 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="set-bank-statement-upload-configuration", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankStatementUploadConfiguration, 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 start_upload_session( - self, - *, - request: Union[ - operations.StartBankStatementUploadSessionRequest, - operations.StartBankStatementUploadSessionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Start upload session - - Use the *Start upload session* endpoint to initiate a bank statement upload session for a given company. - - A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - - You can only have one active session per data type at a time. You can complete or cancel a session using the [*End upload session*](https://docs.codat.io/lending-api#/operations/end-bank-statement-upload-session) endpoint. - - :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.StartBankStatementUploadSessionRequest - ) - request = cast(operations.StartBankStatementUploadSessionRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/startSession", - 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.start_upload_session_request if request is not None else None, - False, - True, - "json", - Optional[shared.StartUploadSessionRequest], - ), - 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="start-bank-statement-upload-session", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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 start_upload_session_async( - self, - *, - request: Union[ - operations.StartBankStatementUploadSessionRequest, - operations.StartBankStatementUploadSessionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Start upload session - - Use the *Start upload session* endpoint to initiate a bank statement upload session for a given company. - - A session is a one-time process that enables you to upload bank statements to Codat. It will time out after 90 minutes if no data is uploaded. - - You can only have one active session per data type at a time. You can complete or cancel a session using the [*End upload session*](https://docs.codat.io/lending-api#/operations/end-bank-statement-upload-session) endpoint. - - :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.StartBankStatementUploadSessionRequest - ) - request = cast(operations.StartBankStatementUploadSessionRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/startSession", - 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.start_upload_session_request if request is not None else None, - False, - True, - "json", - Optional[shared.StartUploadSessionRequest], - ), - 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="start-bank-statement-upload-session", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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 upload_bank_statement_data( - self, - *, - request: Union[ - operations.UploadBankStatementDataRequest, - operations.UploadBankStatementDataRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Upload data - - During an active session, use the **Upload data* endpoint to uploads a page of bank accounts or bank transactions data to the session. - - Make sure you created configuration for the account using the [*Set upload configuration*](https://docs.codat.io/lending-api#/operations/set-bank-statement-upload-configuration) endpoint before attempting an upload. - - :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.UploadBankStatementDataRequest - ) - request = cast(operations.UploadBankStatementDataRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/dataset/{datasetId}/upload", - 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", - operations.UploadBankStatementDataRequestBody, - ), - 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="upload-bank-statement-data", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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 upload_bank_statement_data_async( - self, - *, - request: Union[ - operations.UploadBankStatementDataRequest, - operations.UploadBankStatementDataRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Upload data - - During an active session, use the **Upload data* endpoint to uploads a page of bank accounts or bank transactions data to the session. - - Make sure you created configuration for the account using the [*Set upload configuration*](https://docs.codat.io/lending-api#/operations/set-bank-statement-upload-configuration) endpoint before attempting an upload. - - :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.UploadBankStatementDataRequest - ) - request = cast(operations.UploadBankStatementDataRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/bankStatements/upload/dataset/{datasetId}/upload", - 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", - operations.UploadBankStatementDataRequestBody, - ), - 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="upload-bank-statement-data", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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_lending.api.bank_statements import BankStatements diff --git a/lending/src/codat_lending/bank_transactions.py b/lending/src/codat_lending/bank_transactions.py index e9020c738..ad59c5144 100644 --- a/lending/src/codat_lending/bank_transactions.py +++ b/lending/src/codat_lending/bank_transactions.py @@ -1,455 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bank_transactions — re-export of the bank_transactions method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BankTransactions(BaseSDK): - 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.AccountingCreateBankTransactionsResponse: - r"""Create bank account transactions - - The *Create bank account transactions* endpoint creates new [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - - [Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create bank transaction model](https://docs.codat.io/lending-api#/operations/get-create-bankTransactions-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.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.accounting_create_bank_transactions - if request is not None - else None, - False, - True, - "json", - Optional[shared.AccountingCreateBankTransactions], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateBankTransactionsResponse, 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.AccountingCreateBankTransactionsResponse: - r"""Create bank account transactions - - The *Create bank account transactions* endpoint creates new [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - - [Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create bank transaction model](https://docs.codat.io/lending-api#/operations/get-create-bankTransactions-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.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.accounting_create_bank_transactions - if request is not None - else None, - False, - True, - "json", - Optional[shared.AccountingCreateBankTransactions], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateBankTransactionsResponse, 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 account 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/lending-api#/schemas/BankTransactions) for a given company and integration. - - [Bank account transactions](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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 account 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/lending-api#/schemas/BankTransactions) for a given company and integration. - - [Bank account transactions](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.bank_transactions import BankTransactions diff --git a/lending/src/codat_lending/banking.py b/lending/src/codat_lending/banking.py index 22e7e77b5..051080f5a 100644 --- a/lending/src/codat_lending/banking.py +++ b/lending/src/codat_lending/banking.py @@ -1,44 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.banking — re-export of the banking method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.account_balances import AccountBalances -from codat_lending.categorized_statement import CategorizedStatement -from codat_lending.codatlending_accounts import CodatLendingAccounts -from codat_lending.codatlending_banking_transactions import ( - CodatLendingBankingTransactions, -) -from codat_lending.transaction_categories import TransactionCategories -from typing import Optional - - -class Banking(BaseSDK): - account_balances: AccountBalances - accounts: CodatLendingAccounts - transaction_categories: TransactionCategories - transactions: CodatLendingBankingTransactions - categorized_statement: CategorizedStatement - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.account_balances = AccountBalances( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.accounts = CodatLendingAccounts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.transaction_categories = TransactionCategories( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.transactions = CodatLendingBankingTransactions( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.categorized_statement = CategorizedStatement( - self.sdk_configuration, parent_ref=self.parent_ref - ) +from codat_lending.api.banking import Banking diff --git a/lending/src/codat_lending/basesdk.py b/lending/src/codat_lending/basesdk.py deleted file mode 100644 index 6b6845dde..000000000 --- a/lending/src/codat_lending/basesdk.py +++ /dev/null @@ -1,393 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .sdkconfiguration import SDKConfiguration -from codat_lending import utils -from codat_lending._hooks import ( - AfterErrorContext, - AfterSuccessContext, - BeforeRequestContext, - HookContext, -) -from codat_lending.models import errors -from codat_lending.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: HookContext, - request: httpx.Request, - is_error_status_code: Callable[[int], bool], - stream: bool = 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, - ) - - 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 is_error_status_code(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) - else: - http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res) - - return http_res - - async def do_request_async( - self, - hook_ctx: HookContext, - request: httpx.Request, - is_error_status_code: Callable[[int], bool], - stream: bool = 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, - ) - - 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 is_error_status_code(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) - else: - http_res = await run_sync_in_thread( - hooks.after_success, AfterSuccessContext(hook_ctx), http_res - ) - - return http_res diff --git a/lending/src/codat_lending/bill_credit_notes.py b/lending/src/codat_lending/bill_credit_notes.py index fc0100fb4..ed40fbd9f 100644 --- a/lending/src/codat_lending/bill_credit_notes.py +++ b/lending/src/codat_lending/bill_credit_notes.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bill_credit_notes — re-export of the bill_credit_notes method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BillCreditNotes(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingBillCreditNoteRequest, - operations.GetAccountingBillCreditNoteRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillCreditNote: - r"""Get bill credit note - - The *Get bill credit note* endpoint returns a single bill credit note for a given billCreditNoteId. - - [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingBillCreditNoteRequest - ) - request = cast(operations.GetAccountingBillCreditNoteRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/billCreditNotes/{billCreditNoteId}", - 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-accounting-bill-credit-note", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillCreditNote, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingBillCreditNoteRequest, - operations.GetAccountingBillCreditNoteRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillCreditNote: - r"""Get bill credit note - - The *Get bill credit note* endpoint returns a single bill credit note for a given billCreditNoteId. - - [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingBillCreditNoteRequest - ) - request = cast(operations.GetAccountingBillCreditNoteRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/billCreditNotes/{billCreditNoteId}", - 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-accounting-bill-credit-note", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillCreditNote, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingBillCreditNotesRequest, - operations.ListAccountingBillCreditNotesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillCreditNotes: - r"""List bill credit notes - - The *List bill credit notes* endpoint returns a list of [bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) for a given company's connection. - - [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBillCreditNotesRequest - ) - request = cast(operations.ListAccountingBillCreditNotesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/billCreditNotes", - 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-accounting-bill-credit-notes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillCreditNotes, 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.ListAccountingBillCreditNotesRequest, - operations.ListAccountingBillCreditNotesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillCreditNotes: - r"""List bill credit notes - - The *List bill credit notes* endpoint returns a list of [bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) for a given company's connection. - - [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote) are issued by a supplier for the purpose of recording credit. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBillCreditNotesRequest - ) - request = cast(operations.ListAccountingBillCreditNotesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/billCreditNotes", - 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-accounting-bill-credit-notes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillCreditNotes, 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_lending.api.bill_credit_notes import BillCreditNotes diff --git a/lending/src/codat_lending/bill_payments.py b/lending/src/codat_lending/bill_payments.py index 4e447a7de..5df739ed6 100644 --- a/lending/src/codat_lending/bill_payments.py +++ b/lending/src/codat_lending/bill_payments.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bill_payments — re-export of the bill_payments method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class BillPayments(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingBillPaymentRequest, - operations.GetAccountingBillPaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillPayment: - r"""Get bill payment - - The *Get bill payment* endpoint returns a single bill payment for a given billPaymentId. - - [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingBillPaymentRequest - ) - request = cast(operations.GetAccountingBillPaymentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/billPayments/{billPaymentId}", - 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-accounting-bill-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillPayment, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingBillPaymentRequest, - operations.GetAccountingBillPaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillPayment: - r"""Get bill payment - - The *Get bill payment* endpoint returns a single bill payment for a given billPaymentId. - - [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingBillPaymentRequest - ) - request = cast(operations.GetAccountingBillPaymentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/billPayments/{billPaymentId}", - 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-accounting-bill-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillPayment, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingBillPaymentsRequest, - operations.ListAccountingBillPaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillPayments: - r"""List bill payments - - The *List bill payments* endpoint returns a list of [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) for a given company's connection. - - [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBillPaymentsRequest - ) - request = cast(operations.ListAccountingBillPaymentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/billPayments", - 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-accounting-bill-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillPayments, 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.ListAccountingBillPaymentsRequest, - operations.ListAccountingBillPaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBillPayments: - r"""List bill payments - - The *List bill payments* endpoint returns a list of [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) for a given company's connection. - - [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment) are an allocation of money within any customer accounts payable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBillPaymentsRequest - ) - request = cast(operations.ListAccountingBillPaymentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/billPayments", - 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-accounting-bill-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBillPayments, 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_lending.api.bill_payments import BillPayments diff --git a/lending/src/codat_lending/bills.py b/lending/src/codat_lending/bills.py index ad5b0b845..7ff3437f5 100644 --- a/lending/src/codat_lending/bills.py +++ b/lending/src/codat_lending/bills.py @@ -1,1074 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.bills — re-export of the bills method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class Bills(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingBillAttachmentRequest, - operations.DownloadAccountingBillAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download bill attachment - - The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.DownloadAccountingBillAttachmentRequest - ) - request = cast(operations.DownloadAccountingBillAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-bill-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingBillAttachmentRequest, - operations.DownloadAccountingBillAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download bill attachment - - The *Download bill attachment* endpoint downloads a specific attachment for a given `billId` and `attachmentId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.DownloadAccountingBillAttachmentRequest - ) - request = cast(operations.DownloadAccountingBillAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-bill-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingBillRequest, - operations.GetAccountingBillRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBill: - r"""Get bill - - The *Get bill* endpoint returns a single bill for a given billId. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - - :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.GetAccountingBillRequest) - request = cast(operations.GetAccountingBillRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/bills/{billId}", - 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-accounting-bill", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBill, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingBillRequest, - operations.GetAccountingBillRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBill: - r"""Get bill - - The *Get bill* endpoint returns a single bill for a given billId. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - - :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.GetAccountingBillRequest) - request = cast(operations.GetAccountingBillRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/bills/{billId}", - 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-accounting-bill", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBill, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingBillAttachmentRequest, - operations.GetAccountingBillAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get bill attachment - - The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.GetAccountingBillAttachmentRequest - ) - request = cast(operations.GetAccountingBillAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}", - 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-accounting-bill-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingBillAttachmentRequest, - operations.GetAccountingBillAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get bill attachment - - The *Get bill attachment* endpoint returns a specific attachment for a given `billId` and `attachmentId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.GetAccountingBillAttachmentRequest - ) - request = cast(operations.GetAccountingBillAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments/{attachmentId}", - 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-accounting-bill-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingBillsRequest, - operations.ListAccountingBillsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBills: - r"""List bills - - The *List bills* endpoint returns a list of [bills](https://docs.codat.io/lending-api#/schemas/Bill) for a given company's connection. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - - :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.ListAccountingBillsRequest) - request = cast(operations.ListAccountingBillsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/bills", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-bills", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBills, 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.ListAccountingBillsRequest, - operations.ListAccountingBillsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBills: - r"""List bills - - The *List bills* endpoint returns a list of [bills](https://docs.codat.io/lending-api#/schemas/Bill) for a given company's connection. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `billPayments` data type is queued and cached in Codat before retrieving `bills` from Codat's cache. - - - :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.ListAccountingBillsRequest) - request = cast(operations.ListAccountingBillsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/bills", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-bills", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBills, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingBillAttachmentsRequest, - operations.ListAccountingBillAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List bill attachments - - The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.ListAccountingBillAttachmentsRequest - ) - request = cast(operations.ListAccountingBillAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-bill-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingBillAttachmentsRequest, - operations.ListAccountingBillAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List bill attachments - - The *List bill attachments* endpoint returns a list of attachments available to download for a given `billId`. - - [Bills](https://docs.codat.io/lending-api#/schemas/Bill) are invoices that represent the SMB's financial obligations to their supplier for a purchase of goods or services. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.ListAccountingBillAttachmentsRequest - ) - request = cast(operations.ListAccountingBillAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/bills/{billId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-bill-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_lending.api.bills import Bills diff --git a/lending/src/codat_lending/cash_flow.py b/lending/src/codat_lending/cash_flow.py index 8b71ef5b4..bfb9a0ae5 100644 --- a/lending/src/codat_lending/cash_flow.py +++ b/lending/src/codat_lending/cash_flow.py @@ -1,211 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.cash_flow — re-export of the cash_flow method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CashFlow(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingCashFlowStatementRequest, - operations.GetAccountingCashFlowStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCashFlowStatement: - r"""Get cash flow statement - - Gets the latest cash flow statement 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.GetAccountingCashFlowStatementRequest - ) - request = cast(operations.GetAccountingCashFlowStatementRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/financials/cashFlowStatement", - 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-accounting-cash-flow-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCashFlowStatement, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingCashFlowStatementRequest, - operations.GetAccountingCashFlowStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCashFlowStatement: - r"""Get cash flow statement - - Gets the latest cash flow statement 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.GetAccountingCashFlowStatementRequest - ) - request = cast(operations.GetAccountingCashFlowStatementRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/financials/cashFlowStatement", - 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-accounting-cash-flow-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCashFlowStatement, http_res) - if utils.match_response( - http_res, ["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_lending.api.cash_flow import CashFlow diff --git a/lending/src/codat_lending/categorized_statement.py b/lending/src/codat_lending/categorized_statement.py index 748f78133..04d0545a3 100644 --- a/lending/src/codat_lending/categorized_statement.py +++ b/lending/src/codat_lending/categorized_statement.py @@ -1,223 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.categorized_statement — re-export of the categorized_statement method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CategorizedStatement(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCategorizedBankStatementRequest, - operations.GetCategorizedBankStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedCashFlowTransactions: - r"""Get categorized bank statement - - > **Categorization engine** - > - > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. - - The _Get categorized bank statement_ endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. - - :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.GetCategorizedBankStatementRequest - ) - request = cast(operations.GetCategorizedBankStatementRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/enhancedCashFlow/transactions", - 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-categorized-bank-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.EnhancedCashFlowTransactions, 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.GetCategorizedBankStatementRequest, - operations.GetCategorizedBankStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedCashFlowTransactions: - r"""Get categorized bank statement - - > **Categorization engine** - > - > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. - - The _Get categorized bank statement_ endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. - - :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.GetCategorizedBankStatementRequest - ) - request = cast(operations.GetCategorizedBankStatementRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/enhancedCashFlow/transactions", - 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-categorized-bank-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.EnhancedCashFlowTransactions, 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_lending.api.categorized_statement import CategorizedStatement diff --git a/lending/src/codat_lending/codatlending_accounting_bank_data.py b/lending/src/codat_lending/codatlending_accounting_bank_data.py index e5c1ade26..511cd47ad 100644 --- a/lending/src/codat_lending/codatlending_accounting_bank_data.py +++ b/lending/src/codat_lending/codatlending_accounting_bank_data.py @@ -1,241 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_accounting_bank_data — re-export of the codatlending_accounting_bank_data method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.accounts import Accounts -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingAccountingBankData(BaseSDK): - r"""Access bank transactions from an accounting software.""" - - accounts: Accounts - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.accounts = Accounts(self.sdk_configuration, parent_ref=self.parent_ref) - - def list_transactions( - self, - *, - request: Union[ - operations.ListAccountingBankAccountTransactionsRequest, - operations.ListAccountingBankAccountTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankTransactions: - r"""List bank account transactions - - The *List account bank transactions* endpoint returns a list of [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - - [Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBankAccountTransactionsRequest - ) - request = cast(operations.ListAccountingBankAccountTransactionsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/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="list-accounting-bank-account-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankTransactions, 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_transactions_async( - self, - *, - request: Union[ - operations.ListAccountingBankAccountTransactionsRequest, - operations.ListAccountingBankAccountTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingBankTransactions: - r"""List bank account transactions - - The *List account bank transactions* endpoint returns a list of [bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) for a given company's connection. - - [Bank account transactions](https://docs.codat.io/lending-api#/schemas/BankTransactions) are records of money that has moved in and out of an SMB's bank account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingBankAccountTransactionsRequest - ) - request = cast(operations.ListAccountingBankAccountTransactionsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/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="list-accounting-bank-account-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingBankTransactions, 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_lending.api.accounting_bank_data import AccountingBankData as CodatLendingAccountingBankData diff --git a/lending/src/codat_lending/codatlending_accounts.py b/lending/src/codat_lending/codatlending_accounts.py index dbca68ed5..2191532f1 100644 --- a/lending/src/codat_lending/codatlending_accounts.py +++ b/lending/src/codat_lending/codatlending_accounts.py @@ -1,425 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_accounts — re-export of the codatlending_accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingAccounts(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetBankingAccountRequest, - operations.GetBankingAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccount: - r"""Get account - - The *Get account* endpoint returns a single account for a given accountId. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-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.GetBankingAccountRequest) - request = cast(operations.GetBankingAccountRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accounts/{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="get-banking-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccount, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetBankingAccountRequest, - operations.GetBankingAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccount: - r"""Get account - - The *Get account* endpoint returns a single account for a given accountId. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-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.GetBankingAccountRequest) - request = cast(operations.GetBankingAccountRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accounts/{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="get-banking-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccount, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListBankingAccountsRequest, - operations.ListBankingAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccounts: - r"""List accounts - - The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-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.ListBankingAccountsRequest) - request = cast(operations.ListBankingAccountsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accounts", - 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-banking-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccounts, 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.ListBankingAccountsRequest, - operations.ListBankingAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingAccounts: - r"""List accounts - - The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) 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/lending-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.ListBankingAccountsRequest) - request = cast(operations.ListBankingAccountsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-accounts", - 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-banking-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingAccounts, 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_lending.api.banking_accounts import BankingAccounts as CodatLendingAccounts diff --git a/lending/src/codat_lending/codatlending_banking_transactions.py b/lending/src/codat_lending/codatlending_banking_transactions.py index 0f47add7f..fbe3dac05 100644 --- a/lending/src/codat_lending/codatlending_banking_transactions.py +++ b/lending/src/codat_lending/codatlending_banking_transactions.py @@ -1,431 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_banking_transactions — re-export of the codatlending_banking_transactions method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingBankingTransactions(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetBankingTransactionRequest, - operations.GetBankingTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransaction: - r"""Get bank transaction - - The *Get transaction* endpoint returns a single transaction for a given transactionId. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetBankingTransactionRequest) - request = cast(operations.GetBankingTransactionRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactions/{transactionId}", - 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-banking-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransaction, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetBankingTransactionRequest, - operations.GetBankingTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransaction: - r"""Get bank transaction - - The *Get transaction* endpoint returns a single transaction for a given transactionId. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetBankingTransactionRequest) - request = cast(operations.GetBankingTransactionRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactions/{transactionId}", - 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-banking-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransaction, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListBankingTransactionsRequest, - operations.ListBankingTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactions: - r"""List transactions - - The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingTransactionsRequest - ) - request = cast(operations.ListBankingTransactionsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactions", - 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-banking-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransactions, 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.ListBankingTransactionsRequest, - operations.ListBankingTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactions: - r"""List transactions - - The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) provide an immutable source of up-to-date information on income and expenditure. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingTransactionsRequest - ) - request = cast(operations.ListBankingTransactionsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactions", - 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-banking-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransactions, 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_lending.api.transactions import Transactions as CodatLendingBankingTransactions diff --git a/lending/src/codat_lending/codatlending_customers.py b/lending/src/codat_lending/codatlending_customers.py index 810601a45..96d1d76a3 100644 --- a/lending/src/codat_lending/codatlending_customers.py +++ b/lending/src/codat_lending/codatlending_customers.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_customers — re-export of the codatlending_customers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingCustomers(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceCustomerRequest, - operations.GetCommerceCustomerRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCustomer: - r"""Get customer - - The *Get customer* endpoint returns a single customer for a given customerId. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and receive goods and/or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceCustomerRequest) - request = cast(operations.GetCommerceCustomerRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId}", - 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-commerce-customer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCustomer, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceCustomerRequest, - operations.GetCommerceCustomerRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCustomer: - r"""Get customer - - The *Get customer* endpoint returns a single customer for a given customerId. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and receive goods and/or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceCustomerRequest) - request = cast(operations.GetCommerceCustomerRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-customers/{customerId}", - 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-commerce-customer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCustomer, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceCustomersRequest, - operations.ListCommerceCustomersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCustomers: - r"""List customers - - The *List customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and recieve goods and/or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceCustomersRequest) - request = cast(operations.ListCommerceCustomersRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-customers", - 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-commerce-customers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCustomers, 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.ListCommerceCustomersRequest, - operations.ListCommerceCustomersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCustomers: - r"""List customers - - The *List customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that place orders, make payments and recieve goods and/or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceCustomersRequest) - request = cast(operations.ListCommerceCustomersRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-customers", - 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-commerce-customers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCustomers, 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_lending.api.sales_customers import SalesCustomers as CodatLendingCustomers diff --git a/lending/src/codat_lending/codatlending_direct_costs.py b/lending/src/codat_lending/codatlending_direct_costs.py index a4c2be21f..a10c534eb 100644 --- a/lending/src/codat_lending/codatlending_direct_costs.py +++ b/lending/src/codat_lending/codatlending_direct_costs.py @@ -1,1072 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_direct_costs — re-export of the codatlending_direct_costs method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingDirectCosts(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingDirectCostAttachmentRequest, - operations.DownloadAccountingDirectCostAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download direct cost attachment - - The *Download direct cost attachment* endpoint downloads a specific attachment for a given `directCostId` and `attachmentId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - - :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.DownloadAccountingDirectCostAttachmentRequest - ) - request = cast( - operations.DownloadAccountingDirectCostAttachmentRequest, request - ) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-direct-cost-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingDirectCostAttachmentRequest, - operations.DownloadAccountingDirectCostAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download direct cost attachment - - The *Download direct cost attachment* endpoint downloads a specific attachment for a given `directCostId` and `attachmentId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - - :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.DownloadAccountingDirectCostAttachmentRequest - ) - request = cast( - operations.DownloadAccountingDirectCostAttachmentRequest, request - ) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-direct-cost-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingDirectCostRequest, - operations.GetAccountingDirectCostRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectCost: - r"""Get direct cost - - The *Get direct cost* endpoint returns a single direct cost for a given directCostId. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingDirectCostRequest - ) - request = cast(operations.GetAccountingDirectCostRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}", - 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-accounting-direct-cost", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectCost, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingDirectCostRequest, - operations.GetAccountingDirectCostRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectCost: - r"""Get direct cost - - The *Get direct cost* endpoint returns a single direct cost for a given directCostId. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingDirectCostRequest - ) - request = cast(operations.GetAccountingDirectCostRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}", - 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-accounting-direct-cost", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectCost, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingDirectCostAttachmentRequest, - operations.GetAccountingDirectCostAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get direct cost attachment - - The *Get direct cost attachment* endpoint returns a specific attachment for a given `directCostId` and `attachmentId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - :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.GetAccountingDirectCostAttachmentRequest - ) - request = cast(operations.GetAccountingDirectCostAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments/{attachmentId}", - 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-accounting-direct-cost-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingDirectCostAttachmentRequest, - operations.GetAccountingDirectCostAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get direct cost attachment - - The *Get direct cost attachment* endpoint returns a specific attachment for a given `directCostId` and `attachmentId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - :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.GetAccountingDirectCostAttachmentRequest - ) - request = cast(operations.GetAccountingDirectCostAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments/{attachmentId}", - 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-accounting-direct-cost-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingDirectCostsRequest, - operations.ListAccountingDirectCostsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectCosts: - r"""List direct costs - - The *List direct costs* endpoint returns a list of [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingDirectCostsRequest - ) - request = cast(operations.ListAccountingDirectCostsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts", - 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-accounting-direct-costs", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectCosts, 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.ListAccountingDirectCostsRequest, - operations.ListAccountingDirectCostsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectCosts: - r"""List direct costs - - The *List direct costs* endpoint returns a list of [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingDirectCostsRequest - ) - request = cast(operations.ListAccountingDirectCostsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts", - 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-accounting-direct-costs", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectCosts, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingDirectCostAttachmentsRequest, - operations.ListAccountingDirectCostAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List direct cost attachments - - The *List direct cost attachments* endpoint returns a list of attachments available to download for given `directCostId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - - :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.ListAccountingDirectCostAttachmentsRequest - ) - request = cast(operations.ListAccountingDirectCostAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-direct-cost-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingDirectCostAttachmentsRequest, - operations.ListAccountingDirectCostAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List direct cost attachments - - The *List direct cost attachments* endpoint returns a list of attachments available to download for given `directCostId`. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - - :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.ListAccountingDirectCostAttachmentsRequest - ) - request = cast(operations.ListAccountingDirectCostAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directCosts/{directCostId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-direct-cost-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_lending.api.transactions_direct_costs import TransactionsDirectCosts as CodatLendingDirectCosts diff --git a/lending/src/codat_lending/codatlending_financial_statements_accounts.py b/lending/src/codat_lending/codatlending_financial_statements_accounts.py index 7896e1614..c6c918052 100644 --- a/lending/src/codat_lending/codatlending_financial_statements_accounts.py +++ b/lending/src/codat_lending/codatlending_financial_statements_accounts.py @@ -1,425 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_financial_statements_accounts — re-export of the codatlending_financial_statements_accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingFinancialStatementsAccounts(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingAccountRequest, - operations.GetAccountingAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccount: - r"""Get account - - The *Get account* endpoint returns a single account for a given accountId. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingAccountRequest) - request = cast(operations.GetAccountingAccountRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/accounts/{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="get-accounting-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAccount, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingAccountRequest, - operations.GetAccountingAccountRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccount: - r"""Get account - - The *Get account* endpoint returns a single account for a given accountId. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingAccountRequest) - request = cast(operations.GetAccountingAccountRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/accounts/{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="get-accounting-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAccount, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingAccountsRequest, - operations.ListAccountingAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccounts: - r"""List accounts - - The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingAccountsRequest) - request = cast(operations.ListAccountingAccountsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/accounts", - 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-accounting-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAccounts, 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.ListAccountingAccountsRequest, - operations.ListAccountingAccountsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAccounts: - r"""List accounts - - The *List accounts* endpoint returns a list of [accounts](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingAccountsRequest) - request = cast(operations.ListAccountingAccountsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/accounts", - 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-accounting-accounts", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAccounts, 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_lending.api.financial_statements_accounts import FinancialStatementsAccounts as CodatLendingFinancialStatementsAccounts diff --git a/lending/src/codat_lending/codatlending_loan_writeback_accounts.py b/lending/src/codat_lending/codatlending_loan_writeback_accounts.py index 0ed636fbb..165d8e0a3 100644 --- a/lending/src/codat_lending/codatlending_loan_writeback_accounts.py +++ b/lending/src/codat_lending/codatlending_loan_writeback_accounts.py @@ -1,447 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_loan_writeback_accounts — re-export of the codatlending_loan_writeback_accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingLoanWritebackAccounts(BaseSDK): - def create( - self, - *, - request: Union[ - operations.CreateAccountRequest, operations.CreateAccountRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateAccountResponse: - r"""Create account - - The *Create account* endpoint creates a new [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-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.CreateAccountRequest) - request = cast(operations.CreateAccountRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/accounts", - 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.account_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.AccountPrototype], - ), - 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-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateAccountResponse, 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.CreateAccountRequest, operations.CreateAccountRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateAccountResponse: - r"""Create account - - The *Create account* endpoint creates a new [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company's connection. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-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.CreateAccountRequest) - request = cast(operations.CreateAccountRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/accounts", - 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.account_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.AccountPrototype], - ), - 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-account", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateAccountResponse, 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.GetCreateChartOfAccountsModelRequest, - operations.GetCreateChartOfAccountsModelRequestTypedDict, - ], - 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 account model - - The *Get create account model* endpoint returns the expected data for the request payload when creating an [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company and integration. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - **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.GetCreateChartOfAccountsModelRequest - ) - request = cast(operations.GetCreateChartOfAccountsModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts", - 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-chartOfAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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.GetCreateChartOfAccountsModelRequest, - operations.GetCreateChartOfAccountsModelRequestTypedDict, - ], - 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 account model - - The *Get create account model* endpoint returns the expected data for the request payload when creating an [account](https://docs.codat.io/lending-api#/schemas/Account) for a given company and integration. - - [Accounts](https://docs.codat.io/lending-api#/schemas/Account) are the categories a business uses to record accounting transactions. - - **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.GetCreateChartOfAccountsModelRequest - ) - request = cast(operations.GetCreateChartOfAccountsModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts", - 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-chartOfAccounts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.loan_writeback_accounts import LoanWritebackAccounts as CodatLendingLoanWritebackAccounts diff --git a/lending/src/codat_lending/codatlending_payments.py b/lending/src/codat_lending/codatlending_payments.py index 4220a23e4..69ff8e37a 100644 --- a/lending/src/codat_lending/codatlending_payments.py +++ b/lending/src/codat_lending/codatlending_payments.py @@ -1,443 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_payments — re-export of the codatlending_payments method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingPayments(BaseSDK): - def create( - self, - *, - request: Union[ - operations.CreatePaymentRequest, operations.CreatePaymentRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreatePaymentResponse: - r"""Create payment - - The *Create payment* endpoint creates a new [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create payment model](https://docs.codat.io/lending-api#/operations/get-create-payments-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.CreatePaymentRequest) - request = cast(operations.CreatePaymentRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.accounting_payment if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingPayment], - ), - 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-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreatePaymentResponse, 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.CreatePaymentRequest, operations.CreatePaymentRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreatePaymentResponse: - r"""Create payment - - The *Create payment* endpoint creates a new [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create payment model](https://docs.codat.io/lending-api#/operations/get-create-payments-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.CreatePaymentRequest) - request = cast(operations.CreatePaymentRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.accounting_payment if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingPayment], - ), - 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-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreatePaymentResponse, 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.GetCreatePaymentModelRequest, - operations.GetCreatePaymentModelRequestTypedDict, - ], - 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 payment model - - The *Get create payment model* endpoint returns the expected data for the request payload when creating a [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company and integration. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable 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.GetCreatePaymentModelRequest) - request = cast(operations.GetCreatePaymentModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-payment-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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.GetCreatePaymentModelRequest, - operations.GetCreatePaymentModelRequestTypedDict, - ], - 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 payment model - - The *Get create payment model* endpoint returns the expected data for the request payload when creating a [payment](https://docs.codat.io/lending-api#/schemas/Payment) for a given company and integration. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable 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.GetCreatePaymentModelRequest) - request = cast(operations.GetCreatePaymentModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-payment-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.loan_writeback_payments import LoanWritebackPayments as CodatLendingPayments diff --git a/lending/src/codat_lending/codatlending_reports.py b/lending/src/codat_lending/codatlending_reports.py index 69799ba06..f65c95640 100644 --- a/lending/src/codat_lending/codatlending_reports.py +++ b/lending/src/codat_lending/codatlending_reports.py @@ -1,497 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_reports — re-export of the codatlending_reports method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingReports(BaseSDK): - def get_orders( - self, - *, - request: Union[ - operations.GetCommerceOrdersReportRequest, - operations.GetCommerceOrdersReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get orders report - - The *Get orders report* endpoint returns the number of orders, total value, and average order value for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the order metrics. - - #### Response structure - - The Orders report's dimensions and measures are: - - | Index | Dimensions | - |---------------|----------------| - | `index` = 0 | Period | - | `index` = 1 | Order metrics | - - | Index | Measures | - |---------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Value | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceOrdersReportRequest - ) - request = cast(operations.GetCommerceOrdersReportRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/orders", - 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-commerce-orders-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_orders_async( - self, - *, - request: Union[ - operations.GetCommerceOrdersReportRequest, - operations.GetCommerceOrdersReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get orders report - - The *Get orders report* endpoint returns the number of orders, total value, and average order value for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the order metrics. - - #### Response structure - - The Orders report's dimensions and measures are: - - | Index | Dimensions | - |---------------|----------------| - | `index` = 0 | Period | - | `index` = 1 | Order metrics | - - | Index | Measures | - |---------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Value | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceOrdersReportRequest - ) - request = cast(operations.GetCommerceOrdersReportRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/orders", - 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-commerce-orders-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_refunds( - self, - *, - request: Union[ - operations.GetCommerceRefundsReportRequest, - operations.GetCommerceRefundsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get refunds report - - The *Get refunds report* endpoint returns the number and total value of refunds and the refund rate for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the refunds metrics. - - #### Response structure - - The Refunds report's dimensions and measures are: - - | Index | Dimensions | - |----------------|----------------| - | `index` = 0 | Period | - | `index` = 1 | Refund metrics | - - | Index | Measures | - |----------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Value | - | `index` = 2 | Percentage | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceRefundsReportRequest - ) - request = cast(operations.GetCommerceRefundsReportRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/refunds", - 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-commerce-refunds-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_refunds_async( - self, - *, - request: Union[ - operations.GetCommerceRefundsReportRequest, - operations.GetCommerceRefundsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get refunds report - - The *Get refunds report* endpoint returns the number and total value of refunds and the refund rate for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the refunds metrics. - - #### Response structure - - The Refunds report's dimensions and measures are: - - | Index | Dimensions | - |----------------|----------------| - | `index` = 0 | Period | - | `index` = 1 | Refund metrics | - - | Index | Measures | - |----------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Value | - | `index` = 2 | Percentage | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceRefundsReportRequest - ) - request = cast(operations.GetCommerceRefundsReportRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/refunds", - 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-commerce-refunds-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_lending.api.sales_reports import SalesReports as CodatLendingReports diff --git a/lending/src/codat_lending/codatlending_sales_payments.py b/lending/src/codat_lending/codatlending_sales_payments.py index e91b91c4e..508499f9f 100644 --- a/lending/src/codat_lending/codatlending_sales_payments.py +++ b/lending/src/codat_lending/codatlending_sales_payments.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_sales_payments — re-export of the codatlending_sales_payments method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingSalesPayments(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommercePaymentRequest, - operations.GetCommercePaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePayment: - r"""Get payment - - The *Get payment* endpoint returns a single payment for a given paymentId. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommercePaymentRequest) - request = cast(operations.GetCommercePaymentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId}", - 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-commerce-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePayment, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommercePaymentRequest, - operations.GetCommercePaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePayment: - r"""Get payment - - The *Get payment* endpoint returns a single payment for a given paymentId. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommercePaymentRequest) - request = cast(operations.GetCommercePaymentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-payments/{paymentId}", - 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-commerce-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePayment, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommercePaymentsRequest, - operations.ListCommercePaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePayments: - r"""List payments - - The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommercePaymentsRequest) - request = cast(operations.ListCommercePaymentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-commerce-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePayments, 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.ListCommercePaymentsRequest, - operations.ListCommercePaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePayments: - r"""List payments - - The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) contain details of all payments made by customers to the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommercePaymentsRequest) - request = cast(operations.ListCommercePaymentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-commerce-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePayments, 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_lending.api.sales_payments import SalesPayments as CodatLendingSalesPayments diff --git a/lending/src/codat_lending/codatlending_suppliers.py b/lending/src/codat_lending/codatlending_suppliers.py index 27dc4629d..ca2ba5935 100644 --- a/lending/src/codat_lending/codatlending_suppliers.py +++ b/lending/src/codat_lending/codatlending_suppliers.py @@ -1,451 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_suppliers — re-export of the codatlending_suppliers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingSuppliers(BaseSDK): - def create( - self, - *, - request: Union[ - operations.CreateSupplierRequest, operations.CreateSupplierRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateSupplierResponse: - r"""Create supplier - - The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create/update supplier model](https://docs.codat.io/lending-api#/operations/get-create-update-suppliers-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.CreateSupplierRequest) - request = cast(operations.CreateSupplierRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.accounting_supplier if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingSupplier], - ), - 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-supplier", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateSupplierResponse, 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.CreateSupplierRequest, operations.CreateSupplierRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateSupplierResponse: - r"""Create supplier - - The *Create supplier* endpoint creates a new [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create/update supplier model](https://docs.codat.io/lending-api#/operations/get-create-update-suppliers-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.CreateSupplierRequest) - request = cast(operations.CreateSupplierRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.accounting_supplier if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingSupplier], - ), - 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-supplier", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateSupplierResponse, 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_update_model( - self, - *, - request: Union[ - operations.GetCreateUpdateSuppliersModelRequest, - operations.GetCreateUpdateSuppliersModelRequestTypedDict, - ], - 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 supplier model - - The *Get create/update supplier model* endpoint returns the expected data for the request payload when creating and updating a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company and integration. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - **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.GetCreateUpdateSuppliersModelRequest - ) - request = cast(operations.GetCreateUpdateSuppliersModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-update-suppliers-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_update_model_async( - self, - *, - request: Union[ - operations.GetCreateUpdateSuppliersModelRequest, - operations.GetCreateUpdateSuppliersModelRequestTypedDict, - ], - 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 supplier model - - The *Get create/update supplier model* endpoint returns the expected data for the request payload when creating and updating a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company and integration. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - **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.GetCreateUpdateSuppliersModelRequest - ) - request = cast(operations.GetCreateUpdateSuppliersModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-update-suppliers-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.loan_writeback_suppliers import LoanWritebackSuppliers as CodatLendingSuppliers diff --git a/lending/src/codat_lending/codatlending_transactions.py b/lending/src/codat_lending/codatlending_transactions.py index e2057d578..d43c902d8 100644 --- a/lending/src/codat_lending/codatlending_transactions.py +++ b/lending/src/codat_lending/codatlending_transactions.py @@ -1,431 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_transactions — re-export of the codatlending_transactions method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingTransactions(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceTransactionRequest, - operations.GetCommerceTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceTransaction: - r"""Get transaction - - The *Get transaction* endpoint returns a single transaction for a given transactionId. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceTransactionRequest) - request = cast(operations.GetCommerceTransactionRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-transactions/{transactionId}", - 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-commerce-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceTransaction, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceTransactionRequest, - operations.GetCommerceTransactionRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceTransaction: - r"""Get transaction - - The *Get transaction* endpoint returns a single transaction for a given transactionId. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceTransactionRequest) - request = cast(operations.GetCommerceTransactionRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-transactions/{transactionId}", - 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-commerce-transaction", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceTransaction, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceTransactionsRequest, - operations.ListCommerceTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceTransactions: - r"""List transactions - - The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceTransactionsRequest - ) - request = cast(operations.ListCommerceTransactionsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-transactions", - 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-commerce-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceTransactions, 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.ListCommerceTransactionsRequest, - operations.ListCommerceTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceTransactions: - r"""List transactions - - The *List transactions* endpoint returns a list of [transactions](https://docs.codat.io/lending-api#/schemas/Transaction) for a given company's connection. - - [Transactions](https://docs.codat.io/lending-api#/schemas/Transaction) detail all financial affairs recorded in the commerce or point of sale system. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceTransactionsRequest - ) - request = cast(operations.ListCommerceTransactionsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-transactions", - 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-commerce-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceTransactions, 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_lending.api.sales_transactions import SalesTransactions as CodatLendingTransactions diff --git a/lending/src/codat_lending/codatlending_transfers.py b/lending/src/codat_lending/codatlending_transfers.py index f2d729e36..9e12dccaf 100644 --- a/lending/src/codat_lending/codatlending_transfers.py +++ b/lending/src/codat_lending/codatlending_transfers.py @@ -1,431 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.codatlending_transfers — re-export of the codatlending_transfers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CodatLendingTransfers(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingTransferRequest, - operations.GetAccountingTransferRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingTransfer: - r"""Get transfer - - The *Get transfer* endpoint returns a single transfer for a given transferId. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingTransferRequest) - request = cast(operations.GetAccountingTransferRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/transfers/{transferId}", - 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-accounting-transfer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingTransfer, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingTransferRequest, - operations.GetAccountingTransferRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingTransfer: - r"""Get transfer - - The *Get transfer* endpoint returns a single transfer for a given transferId. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingTransferRequest) - request = cast(operations.GetAccountingTransferRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/transfers/{transferId}", - 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-accounting-transfer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingTransfer, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingTransfersRequest, - operations.ListAccountingTransfersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingTransfers: - r"""List transfers - - The *List transfers* endpoint returns a list of [transfers](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingTransfersRequest - ) - request = cast(operations.ListAccountingTransfersRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/transfers", - 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-accounting-transfers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingTransfers, 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.ListAccountingTransfersRequest, - operations.ListAccountingTransfersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingTransfers: - r"""List transfers - - The *List transfers* endpoint returns a list of [transfers](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingTransfersRequest - ) - request = cast(operations.ListAccountingTransfersRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/transfers", - 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-accounting-transfers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingTransfers, 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_lending.api.transactions_transfers import TransactionsTransfers as CodatLendingTransfers diff --git a/lending/src/codat_lending/companies.py b/lending/src/codat_lending/companies.py index a859bc919..1f5a7d883 100644 --- a/lending/src/codat_lending/companies.py +++ b/lending/src/codat_lending/companies.py @@ -1,1283 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.companies — re-export of the companies method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.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/lending-api#/schemas/Company) that represents your customer in Codat. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) that represents your customer in Codat. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company), its [connections](https://docs.codat.io/lending-api#/schemas/Connection) and any cached data. This operation is irreversible. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company), its [connections](https://docs.codat.io/lending-api#/schemas/Connection) and any cached data. This operation is irreversible. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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 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/lending-api#/schemas/Company) associated to your instances. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) associated to your instances. - - A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-api#/schemas/Company) represents a business sharing access to their data. - Each company can have multiple [connections](https://docs.codat.io/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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/lending-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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_lending.api.companies import Companies diff --git a/lending/src/codat_lending/company_info.py b/lending/src/codat_lending/company_info.py index dba83d66d..21ba1626c 100644 --- a/lending/src/codat_lending/company_info.py +++ b/lending/src/codat_lending/company_info.py @@ -1,413 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.company_info — re-export of the company_info method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CompanyInfo(BaseSDK): - r"""View company information fetched from the source platform.""" - - def get_accounting_profile( - self, - *, - request: Union[ - operations.GetAccountingProfileRequest, - operations.GetAccountingProfileRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCompanyInfo: - r"""Get company accounting profile - - Gets the latest basic info 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.GetAccountingProfileRequest) - request = cast(operations.GetAccountingProfileRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/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-accounting-profile", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCompanyInfo, http_res) - if utils.match_response( - http_res, ["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 get_accounting_profile_async( - self, - *, - request: Union[ - operations.GetAccountingProfileRequest, - operations.GetAccountingProfileRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCompanyInfo: - r"""Get company accounting profile - - Gets the latest basic info 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.GetAccountingProfileRequest) - request = cast(operations.GetAccountingProfileRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/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-accounting-profile", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCompanyInfo, http_res) - if utils.match_response( - http_res, ["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) - - def get_commerce_profile( - self, - *, - request: Union[ - operations.GetCommerceProfileRequest, - operations.GetCommerceProfileRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCompanyInfo: - r"""Get company commerce profile - - Retrieve information about the company, as seen in the commerce - platform. - - This may include information like addresses, tax registration details and - social media or website 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.GetCommerceProfileRequest) - request = cast(operations.GetCommerceProfileRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-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-commerce-profile", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCompanyInfo, http_res) - if utils.match_response( - http_res, ["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 get_commerce_profile_async( - self, - *, - request: Union[ - operations.GetCommerceProfileRequest, - operations.GetCommerceProfileRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceCompanyInfo: - r"""Get company commerce profile - - Retrieve information about the company, as seen in the commerce - platform. - - This may include information like addresses, tax registration details and - social media or website 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.GetCommerceProfileRequest) - request = cast(operations.GetCommerceProfileRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-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-commerce-profile", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceCompanyInfo, http_res) - if utils.match_response( - http_res, ["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_lending.api.company_info import CompanyInfo diff --git a/lending/src/codat_lending/configuration.py b/lending/src/codat_lending/configuration.py new file mode 100644 index 000000000..d059ff145 --- /dev/null +++ b/lending/src/codat_lending/configuration.py @@ -0,0 +1,596 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending") + 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/lending/src/codat_lending/connections.py b/lending/src/codat_lending/connections.py index a757e4021..8f3164262 100644 --- a/lending/src/codat_lending/connections.py +++ b/lending/src/codat_lending/connections.py @@ -1,1025 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.connections — re-export of the connections method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_lending.api.connections import Connections diff --git a/lending/src/codat_lending/create_operations.py b/lending/src/codat_lending/create_operations.py index 6bcc12689..00024beea 100644 --- a/lending/src/codat_lending/create_operations.py +++ b/lending/src/codat_lending/create_operations.py @@ -1,403 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.create_operations — re-export of the create_operations method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CreateOperations(BaseSDK): - def get( - 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 - - Retrieve create operation. - - :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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_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 - - Retrieve create operation. - - :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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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( - 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 - - List create operations. - - :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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_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 - - List create operations. - - :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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_lending.api.create_operations import CreateOperations diff --git a/lending/src/codat_lending/credit_notes.py b/lending/src/codat_lending/credit_notes.py index 6a05557ea..f41123544 100644 --- a/lending/src/codat_lending/credit_notes.py +++ b/lending/src/codat_lending/credit_notes.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.credit_notes — re-export of the credit_notes method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class CreditNotes(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingCreditNoteRequest, - operations.GetAccountingCreditNoteRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreditNote: - r"""Get credit note - - The *Get credit note* endpoint returns a single credit note for a given creditNoteId. - - [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingCreditNoteRequest - ) - request = cast(operations.GetAccountingCreditNoteRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/creditNotes/{creditNoteId}", - 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-accounting-credit-note", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCreditNote, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingCreditNoteRequest, - operations.GetAccountingCreditNoteRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreditNote: - r"""Get credit note - - The *Get credit note* endpoint returns a single credit note for a given creditNoteId. - - [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingCreditNoteRequest - ) - request = cast(operations.GetAccountingCreditNoteRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/creditNotes/{creditNoteId}", - 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-accounting-credit-note", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCreditNote, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingCreditNotesRequest, - operations.ListAccountingCreditNotesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreditNotes: - r"""List credit notes - - The *List credit notes* endpoint returns a list of [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) for a given company's connection. - - [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingCreditNotesRequest - ) - request = cast(operations.ListAccountingCreditNotesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/creditNotes", - 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-accounting-credit-notes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCreditNotes, 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.ListAccountingCreditNotesRequest, - operations.ListAccountingCreditNotesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreditNotes: - r"""List credit notes - - The *List credit notes* endpoint returns a list of [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) for a given company's connection. - - [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingCreditNotesRequest - ) - request = cast(operations.ListAccountingCreditNotesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/creditNotes", - 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-accounting-credit-notes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCreditNotes, 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_lending.api.credit_notes import CreditNotes diff --git a/lending/src/codat_lending/customers.py b/lending/src/codat_lending/customers.py index d775c4b59..a579fe80a 100644 --- a/lending/src/codat_lending/customers.py +++ b/lending/src/codat_lending/customers.py @@ -1,1062 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.customers — re-export of the customers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class Customers(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingCustomerAttachmentRequest, - operations.DownloadAccountingCustomerAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download customer attachment - - The *Download customer attachment* endpoint downloads a specific attachment for a given `customerId` and `attachmentId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - :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.DownloadAccountingCustomerAttachmentRequest - ) - request = cast(operations.DownloadAccountingCustomerAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-customer-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingCustomerAttachmentRequest, - operations.DownloadAccountingCustomerAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download customer attachment - - The *Download customer attachment* endpoint downloads a specific attachment for a given `customerId` and `attachmentId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - :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.DownloadAccountingCustomerAttachmentRequest - ) - request = cast(operations.DownloadAccountingCustomerAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-customer-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingCustomerRequest, - operations.GetAccountingCustomerRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCustomer: - r"""Get customer - - The *Get customer* endpoint returns a single customer for a given customerId. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingCustomerRequest) - request = cast(operations.GetAccountingCustomerRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/customers/{customerId}", - 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-accounting-customer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCustomer, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingCustomerRequest, - operations.GetAccountingCustomerRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCustomer: - r"""Get customer - - The *Get customer* endpoint returns a single customer for a given customerId. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingCustomerRequest) - request = cast(operations.GetAccountingCustomerRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/customers/{customerId}", - 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-accounting-customer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCustomer, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingCustomerAttachmentRequest, - operations.GetAccountingCustomerAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get customer attachment - - The *Get customer attachment* endpoint returns a specific attachment for a given `customerId` and `attachmentId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - - :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.GetAccountingCustomerAttachmentRequest - ) - request = cast(operations.GetAccountingCustomerAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}", - 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-accounting-customer-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingCustomerAttachmentRequest, - operations.GetAccountingCustomerAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get customer attachment - - The *Get customer attachment* endpoint returns a specific attachment for a given `customerId` and `attachmentId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - - :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.GetAccountingCustomerAttachmentRequest - ) - request = cast(operations.GetAccountingCustomerAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}", - 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-accounting-customer-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingCustomersRequest, - operations.ListAccountingCustomersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCustomers: - r"""List customers - - The *List customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingCustomersRequest - ) - request = cast(operations.ListAccountingCustomersRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/customers", - 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-accounting-customers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCustomers, 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.ListAccountingCustomersRequest, - operations.ListAccountingCustomersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCustomers: - r"""List customers - - The *List customers* endpoint returns a list of [customers](https://docs.codat.io/lending-api#/schemas/Customer) for a given company's connection. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingCustomersRequest - ) - request = cast(operations.ListAccountingCustomersRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/customers", - 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-accounting-customers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingCustomers, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingCustomerAttachmentsRequest, - operations.ListAccountingCustomerAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List customer attachments - - The *List customer attachments* endpoint returns a list of attachments avialable to download for given `customerId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - :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.ListAccountingCustomerAttachmentsRequest - ) - request = cast(operations.ListAccountingCustomerAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-customer-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingCustomerAttachmentsRequest, - operations.ListAccountingCustomerAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List customer attachments - - The *List customer attachments* endpoint returns a list of attachments avialable to download for given `customerId`. - - [Customers](https://docs.codat.io/lending-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB. - - :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.ListAccountingCustomerAttachmentsRequest - ) - request = cast(operations.ListAccountingCustomerAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-customer-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_lending.api.customers import Customers diff --git a/lending/src/codat_lending/data_integrity.py b/lending/src/codat_lending/data_integrity.py index 97eec0533..792b685c6 100644 --- a/lending/src/codat_lending/data_integrity.py +++ b/lending/src/codat_lending/data_integrity.py @@ -1,635 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.data_integrity — re-export of the data_integrity method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class DataIntegrity(BaseSDK): - r"""Match mutable accounting data with immutable banking data to increase confidence in financial data.""" - - def details( - self, - *, - request: Union[ - operations.ListDataIntegrityDetailsRequest, - operations.ListDataIntegrityDetailsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegrityDetails: - r"""List data integrity details - - The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results. - - The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints. - - :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.ListDataIntegrityDetailsRequest - ) - request = cast(operations.ListDataIntegrityDetailsRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/details", - 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-data-integrity-details", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegrityDetails, 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 details_async( - self, - *, - request: Union[ - operations.ListDataIntegrityDetailsRequest, - operations.ListDataIntegrityDetailsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegrityDetails: - r"""List data integrity details - - The *List data integrity details* endpoint returns the match result record by record for a given data type, filtered based on a query string in the same way as summary results. - - The [details](https://docs.codat.io/lending-api#/schemas/DataIntegrityDetail) are paginated and support ordering, following the same conventions as our other data endpoints. - - :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.ListDataIntegrityDetailsRequest - ) - request = cast(operations.ListDataIntegrityDetailsRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/details", - 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-data-integrity-details", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegrityDetails, 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 status( - self, - *, - request: Union[ - operations.GetDataIntegrityStatusRequest, - operations.GetDataIntegrityStatusRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegrityStatuses: - r"""Get data integrity status - - The *Get data integrity status* endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/DataIntegrityStatus) for the company’s match results between the data type provided in the URL and other data types that Data Integrity uses to support matching. - This endpoint helps you understand whether match data is available and, if so, how to usefully query it. - - The response tells you: - - - Whether match results are available. - - When the results were generated, and their status. - - The connection IDs, amounts, and dates involved to support useful querying. - - :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.GetDataIntegrityStatusRequest) - request = cast(operations.GetDataIntegrityStatusRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/status", - 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-data-integrity-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegrityStatuses, 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 status_async( - self, - *, - request: Union[ - operations.GetDataIntegrityStatusRequest, - operations.GetDataIntegrityStatusRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegrityStatuses: - r"""Get data integrity status - - The *Get data integrity status* endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/DataIntegrityStatus) for the company’s match results between the data type provided in the URL and other data types that Data Integrity uses to support matching. - This endpoint helps you understand whether match data is available and, if so, how to usefully query it. - - The response tells you: - - - Whether match results are available. - - When the results were generated, and their status. - - The connection IDs, amounts, and dates involved to support useful querying. - - :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.GetDataIntegrityStatusRequest) - request = cast(operations.GetDataIntegrityStatusRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/status", - 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-data-integrity-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegrityStatuses, 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 summaries( - self, - *, - request: Union[ - operations.GetDataIntegritySummariesRequest, - operations.GetDataIntegritySummariesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegritySummaries: - r"""Get data integrity summaries - - The *Get data integrity summary* endpoint returns a [summary](https://docs.codat.io/lending-api#/schemas/DataIntegritySummary) of match results for a given data type filtered by a query string in the [Codat query language](https://docs.codat.io/using-the-api/querying). - - For example, if you wanted to see summary match results only for transactions after 1 December 2020, you could include a query parameter of `query=date>2020-12-01`. - - The endpoint response includes only the summary results, not transactions. To view match data for transactions, use the [List data integrity details](https://docs.codat.io/lending-api#/operations/get-data-integrity-summaries) endpoint. - - :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.GetDataIntegritySummariesRequest - ) - request = cast(operations.GetDataIntegritySummariesRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/summaries", - 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-data-integrity-summaries", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegritySummaries, 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 summaries_async( - self, - *, - request: Union[ - operations.GetDataIntegritySummariesRequest, - operations.GetDataIntegritySummariesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.DataIntegritySummaries: - r"""Get data integrity summaries - - The *Get data integrity summary* endpoint returns a [summary](https://docs.codat.io/lending-api#/schemas/DataIntegritySummary) of match results for a given data type filtered by a query string in the [Codat query language](https://docs.codat.io/using-the-api/querying). - - For example, if you wanted to see summary match results only for transactions after 1 December 2020, you could include a query parameter of `query=date>2020-12-01`. - - The endpoint response includes only the summary results, not transactions. To view match data for transactions, use the [List data integrity details](https://docs.codat.io/lending-api#/operations/get-data-integrity-summaries) endpoint. - - :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.GetDataIntegritySummariesRequest - ) - request = cast(operations.GetDataIntegritySummariesRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/assess/dataTypes/{dataType}/dataIntegrity/summaries", - 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-data-integrity-summaries", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.DataIntegritySummaries, 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_lending.api.data_integrity import DataIntegrity diff --git a/lending/src/codat_lending/direct_costs.py b/lending/src/codat_lending/direct_costs.py index cd2e58f35..c6c38d5fb 100644 --- a/lending/src/codat_lending/direct_costs.py +++ b/lending/src/codat_lending/direct_costs.py @@ -1,451 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.direct_costs — re-export of the direct_costs method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class DirectCosts(BaseSDK): - def create( - self, - *, - request: Union[ - operations.CreateDirectCostRequest, - operations.CreateDirectCostRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateDirectCostResponse: - r"""Create direct cost - - The *Create direct cost* endpoint creates a new [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create direct cost model](https://docs.codat.io/lending-api#/operations/get-create-directCosts-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.CreateDirectCostRequest) - request = cast(operations.CreateDirectCostRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/directCosts", - 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.direct_cost_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.DirectCostPrototype], - ), - 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-direct-cost", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateDirectCostResponse, 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.CreateDirectCostRequest, - operations.CreateDirectCostRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateDirectCostResponse: - r"""Create direct cost - - The *Create direct cost* endpoint creates a new [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company's connection. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create direct cost model](https://docs.codat.io/lending-api#/operations/get-create-directCosts-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.CreateDirectCostRequest) - request = cast(operations.CreateDirectCostRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/directCosts", - 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.direct_cost_prototype if request is not None else None, - False, - True, - "json", - Optional[shared.DirectCostPrototype], - ), - 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-direct-cost", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateDirectCostResponse, 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.GetCreateDirectCostsModelRequest, - operations.GetCreateDirectCostsModelRequestTypedDict, - ], - 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 direct cost model - - The *Get create direct cost model* endpoint returns the expected data for the request payload when creating a [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company and integration. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - **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.GetCreateDirectCostsModelRequest - ) - request = cast(operations.GetCreateDirectCostsModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/directCosts", - 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-directCosts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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.GetCreateDirectCostsModelRequest, - operations.GetCreateDirectCostsModelRequestTypedDict, - ], - 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 direct cost model - - The *Get create direct cost model* endpoint returns the expected data for the request payload when creating a [direct cost](https://docs.codat.io/lending-api#/schemas/DirectCost) for a given company and integration. - - [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) are business expenses that don't impact Accounts Payable. - - **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.GetCreateDirectCostsModelRequest - ) - request = cast(operations.GetCreateDirectCostsModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/directCosts", - 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-directCosts-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.direct_costs import DirectCosts diff --git a/lending/src/codat_lending/direct_incomes.py b/lending/src/codat_lending/direct_incomes.py index 4b0586c83..3ccfc3430 100644 --- a/lending/src/codat_lending/direct_incomes.py +++ b/lending/src/codat_lending/direct_incomes.py @@ -1,1068 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.direct_incomes — re-export of the direct_incomes method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class DirectIncomes(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingDirectIncomeAttachmentRequest, - operations.DownloadAccountingDirectIncomeAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download direct income attachment - - The *Download direct income attachment* endpoint downloads a specific attachment for a given `directIncomeId` and `attachmentId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.DownloadAccountingDirectIncomeAttachmentRequest - ) - request = cast( - operations.DownloadAccountingDirectIncomeAttachmentRequest, request - ) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-direct-income-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingDirectIncomeAttachmentRequest, - operations.DownloadAccountingDirectIncomeAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download direct income attachment - - The *Download direct income attachment* endpoint downloads a specific attachment for a given `directIncomeId` and `attachmentId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.DownloadAccountingDirectIncomeAttachmentRequest - ) - request = cast( - operations.DownloadAccountingDirectIncomeAttachmentRequest, request - ) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-direct-income-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingDirectIncomeRequest, - operations.GetAccountingDirectIncomeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectIncome: - r"""Get direct income - - The *Get direct income* endpoint returns a single direct income for a given directIncomeId. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingDirectIncomeRequest - ) - request = cast(operations.GetAccountingDirectIncomeRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}", - 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-accounting-direct-income", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectIncome, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingDirectIncomeRequest, - operations.GetAccountingDirectIncomeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectIncome: - r"""Get direct income - - The *Get direct income* endpoint returns a single direct income for a given directIncomeId. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingDirectIncomeRequest - ) - request = cast(operations.GetAccountingDirectIncomeRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}", - 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-accounting-direct-income", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectIncome, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingDirectIncomeAttachmentRequest, - operations.GetAccountingDirectIncomeAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get direct income attachment - - The *Get direct income attachment* endpoint returns a specific attachment for a given `directIncomeId` and `attachmentId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.GetAccountingDirectIncomeAttachmentRequest - ) - request = cast(operations.GetAccountingDirectIncomeAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}", - 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-accounting-direct-income-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingDirectIncomeAttachmentRequest, - operations.GetAccountingDirectIncomeAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get direct income attachment - - The *Get direct income attachment* endpoint returns a specific attachment for a given `directIncomeId` and `attachmentId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.GetAccountingDirectIncomeAttachmentRequest - ) - request = cast(operations.GetAccountingDirectIncomeAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}", - 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-accounting-direct-income-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingDirectIncomesRequest, - operations.ListAccountingDirectIncomesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectIncomes: - r"""List direct incomes - - The *List direct incomes* endpoint returns a list of [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) for a given company's connection. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingDirectIncomesRequest - ) - request = cast(operations.ListAccountingDirectIncomesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes", - 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-accounting-direct-incomes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectIncomes, 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.ListAccountingDirectIncomesRequest, - operations.ListAccountingDirectIncomesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingDirectIncomes: - r"""List direct incomes - - The *List direct incomes* endpoint returns a list of [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) for a given company's connection. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingDirectIncomesRequest - ) - request = cast(operations.ListAccountingDirectIncomesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes", - 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-accounting-direct-incomes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingDirectIncomes, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingDirectIncomeAttachmentsRequest, - operations.ListAccountingDirectIncomeAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List direct income attachments - - The *List direct income attachments* endpoint returns a list of attachments available to download for given `directIncomeId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.ListAccountingDirectIncomeAttachmentsRequest - ) - request = cast(operations.ListAccountingDirectIncomeAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-direct-income-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingDirectIncomeAttachmentsRequest, - operations.ListAccountingDirectIncomeAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List direct income attachments - - The *List direct income attachments* endpoint returns a list of attachments available to download for given `directIncomeId`. - - [Direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome) are incomes received directly from the business' operations at the point of the sale. - - :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.ListAccountingDirectIncomeAttachmentsRequest - ) - request = cast(operations.ListAccountingDirectIncomeAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-direct-income-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_lending.api.direct_incomes import DirectIncomes diff --git a/lending/src/codat_lending/disputes.py b/lending/src/codat_lending/disputes.py index b5e6ea9ff..913db7828 100644 --- a/lending/src/codat_lending/disputes.py +++ b/lending/src/codat_lending/disputes.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.disputes — re-export of the disputes method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Disputes(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceDisputeRequest, - operations.GetCommerceDisputeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceDispute: - r"""Get dispute - - The *Get dispute* endpoint returns a single dispute for a given disputeId. - - [Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceDisputeRequest) - request = cast(operations.GetCommerceDisputeRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-disputes/{disputeId}", - 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-commerce-dispute", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceDispute, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceDisputeRequest, - operations.GetCommerceDisputeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceDispute: - r"""Get dispute - - The *Get dispute* endpoint returns a single dispute for a given disputeId. - - [Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceDisputeRequest) - request = cast(operations.GetCommerceDisputeRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-disputes/{disputeId}", - 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-commerce-dispute", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceDispute, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceDisputesRequest, - operations.ListCommerceDisputesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceDisputes: - r"""List disputes - - The *List disputes* endpoint returns a list of [disputes](https://docs.codat.io/lending-api#/schemas/Dispute) for a given company's connection. - - [Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceDisputesRequest) - request = cast(operations.ListCommerceDisputesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-disputes", - 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-commerce-disputes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceDisputes, 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.ListCommerceDisputesRequest, - operations.ListCommerceDisputesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceDisputes: - r"""List disputes - - The *List disputes* endpoint returns a list of [disputes](https://docs.codat.io/lending-api#/schemas/Dispute) for a given company's connection. - - [Disputes](https://docs.codat.io/lending-api#/schemas/Dispute) are created when a customer is unsatisfied with their purchase or believe they have been charged incorrectly. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceDisputesRequest) - request = cast(operations.ListCommerceDisputesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-disputes", - 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-commerce-disputes", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceDisputes, 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_lending.api.disputes import Disputes diff --git a/lending/src/codat_lending/excel_reports.py b/lending/src/codat_lending/excel_reports.py index 39a9908e8..8e1ac780a 100644 --- a/lending/src/codat_lending/excel_reports.py +++ b/lending/src/codat_lending/excel_reports.py @@ -1,655 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.excel_reports — re-export of the excel_reports method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ExcelReports(BaseSDK): - r"""Download reports in Excel format.""" - - def download( - self, - *, - request: Union[ - operations.DownloadExcelReportRequest, - operations.DownloadExcelReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bytes: - r"""Download Excel report - - The *Download Excel report* endpoint downloads the latest successfully generated Excel report of a specified report type for a given company. - - The downloadable Excel file is returned in the response. You can save it to your local machine. - - You can [learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - - :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.DownloadExcelReportRequest) - request = cast(operations.DownloadExcelReportRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/assess/excel/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-excel-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - http_res_bytes = utils.stream_to_bytes(http_res) - return http_res_bytes - 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 download_async( - self, - *, - request: Union[ - operations.DownloadExcelReportRequest, - operations.DownloadExcelReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bytes: - r"""Download Excel report - - The *Download Excel report* endpoint downloads the latest successfully generated Excel report of a specified report type for a given company. - - The downloadable Excel file is returned in the response. You can save it to your local machine. - - You can [learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - - :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.DownloadExcelReportRequest) - request = cast(operations.DownloadExcelReportRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/assess/excel/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-excel-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - http_res_bytes = await utils.stream_to_bytes_async(http_res) - return http_res_bytes - 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 generate( - self, - *, - request: Union[ - operations.GenerateExcelReportRequest, - operations.GenerateExcelReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ExcelStatus: - r"""Generate Excel report - - The *Generate Excel report* endpoint requests the production of a downloadable Excel file for a report type specified in the `reportType` query parameter. - - In response, the endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/ExcelStatus) detailing the current state of the report generation request. - - ### Report types - - | reportType | Description | - |--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| - | `audit` | Identifies inaccurate or out-of-date accounts, helping you to make decisions with confidence. || [audit](https://docs.codat.io/lending/excel/audit-report) | Identify inaccurate or out-of-date accounts, helping you to make decisions with confidence. | - | `enhancedCashFlow` | Provides a fully categorized list of bank transactions for a company, allowing lenders to accurately forecast a company's cash flow. | - | `enhancedFinancials` | Supports decision-making using fully categorized financial statements to allow lenders to automate their underwriting processes. | - | `enhancedInvoices` | Helps verify that payments have been made against historic invoices. Great for invoice finance lenders. | - - [Learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - - - - - :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.GenerateExcelReportRequest) - request = cast(operations.GenerateExcelReportRequest, request) - - req = self._build_request( - method="POST", - path="/data/companies/{companyId}/assess/excel", - 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-excel-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.ExcelStatus, 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_async( - self, - *, - request: Union[ - operations.GenerateExcelReportRequest, - operations.GenerateExcelReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ExcelStatus: - r"""Generate Excel report - - The *Generate Excel report* endpoint requests the production of a downloadable Excel file for a report type specified in the `reportType` query parameter. - - In response, the endpoint returns the [status](https://docs.codat.io/lending-api#/schemas/ExcelStatus) detailing the current state of the report generation request. - - ### Report types - - | reportType | Description | - |--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------| - | `audit` | Identifies inaccurate or out-of-date accounts, helping you to make decisions with confidence. || [audit](https://docs.codat.io/lending/excel/audit-report) | Identify inaccurate or out-of-date accounts, helping you to make decisions with confidence. | - | `enhancedCashFlow` | Provides a fully categorized list of bank transactions for a company, allowing lenders to accurately forecast a company's cash flow. | - | `enhancedFinancials` | Supports decision-making using fully categorized financial statements to allow lenders to automate their underwriting processes. | - | `enhancedInvoices` | Helps verify that payments have been made against historic invoices. Great for invoice finance lenders. | - - [Learn more](https://docs.codat.io/lending/features/excel-download-overview#feature-components) about valid Excel report types. - - - - - :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.GenerateExcelReportRequest) - request = cast(operations.GenerateExcelReportRequest, request) - - req = self._build_request_async( - method="POST", - path="/data/companies/{companyId}/assess/excel", - 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-excel-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.ExcelStatus, 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_status( - self, - *, - request: Union[ - operations.GetExcelReportGenerationStatusRequest, - operations.GetExcelReportGenerationStatusRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ExcelStatus: - r"""Get Excel report status - - The *Get Excel report status* returns the status of the report mostly recently requested for Excel generation. It does not return the status of any historical report requests. - - Poll this endpoint to check the progress of the report once you have requested its generation. This will not affect the generation of the report. - - When the report generation completes successfully, the `inProgress` property will be marked as `false` and the `success` field will be marked as `true`. - - :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.GetExcelReportGenerationStatusRequest - ) - request = cast(operations.GetExcelReportGenerationStatusRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/assess/excel", - 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-excel-report-generation-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.ExcelStatus, 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_status_async( - self, - *, - request: Union[ - operations.GetExcelReportGenerationStatusRequest, - operations.GetExcelReportGenerationStatusRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ExcelStatus: - r"""Get Excel report status - - The *Get Excel report status* returns the status of the report mostly recently requested for Excel generation. It does not return the status of any historical report requests. - - Poll this endpoint to check the progress of the report once you have requested its generation. This will not affect the generation of the report. - - When the report generation completes successfully, the `inProgress` property will be marked as `false` and the `success` field will be marked as `true`. - - :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.GetExcelReportGenerationStatusRequest - ) - request = cast(operations.GetExcelReportGenerationStatusRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/assess/excel", - 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-excel-report-generation-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.ExcelStatus, 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_lending.api.excel_reports import ExcelReports diff --git a/lending/src/codat_lending/exceptions.py b/lending/src/codat_lending/exceptions.py new file mode 100644 index 000000000..989635cbb --- /dev/null +++ b/lending/src/codat_lending/exceptions.py @@ -0,0 +1,200 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/file_upload.py b/lending/src/codat_lending/file_upload.py index 43afe1118..505f85d67 100644 --- a/lending/src/codat_lending/file_upload.py +++ b/lending/src/codat_lending/file_upload.py @@ -1,638 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.file_upload — re-export of the file_upload method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, List, Mapping, Optional, Union, cast - - -class FileUpload(BaseSDK): - r"""Endpoints to manage uploaded files.""" - - def download( - self, - *, - request: Union[ - operations.DownloadFilesRequest, operations.DownloadFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download all files for a company - - The *Download files* endpoint downloads all files that have been uploaded by to SMB to Codat. A `date` may be specified to download any files uploaded on the date provided. - - :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.DownloadFilesRequest) - request = cast(operations.DownloadFilesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/files/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_async( - self, - *, - request: Union[ - operations.DownloadFilesRequest, operations.DownloadFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download all files for a company - - The *Download files* endpoint downloads all files that have been uploaded by to SMB to Codat. A `date` may be specified to download any files uploaded on the date provided. - - :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.DownloadFilesRequest) - request = cast(operations.DownloadFilesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/files/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["400", "401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def list_uploaded( - self, - *, - request: Union[ - operations.ListFilesRequest, operations.ListFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> List[shared.File]: - r"""List all files uploaded by a company - - The *List files* endpoint returns a list of all files uploaded to Codat by the SMB. - - :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.ListFilesRequest) - request = cast(operations.ListFilesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/files", - 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-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(List[shared.File], 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_uploaded_async( - self, - *, - request: Union[ - operations.ListFilesRequest, operations.ListFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> List[shared.File]: - r"""List all files uploaded by a company - - The *List files* endpoint returns a list of all files uploaded to Codat by the SMB. - - :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.ListFilesRequest) - request = cast(operations.ListFilesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/files", - 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-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(List[shared.File], 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 upload( - self, - *, - request: Union[ - operations.UploadFilesRequest, operations.UploadFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Upload files for a company - - The *Upload files* endpoint uploads multiple files provided by the SMB to Codat. This may include personal identity documents, pitch decks, contracts, or files with accounting and banking data. - - Uploaded files must meet the following requirements: - - - Up to 20 files can be uploaded at a time. - - PDF, XLS, XLSX, XLSB, CSV, DOC, DOCX, PPT, PPTX, JPEG, JPG, and PNG files can be uploaded. - - Each file can be up to 10MB in size. - - :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.UploadFilesRequest) - request = cast(operations.UploadFilesRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/files", - 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.file_upload if request is not None else None, - False, - True, - "multipart", - Optional[shared.FileUpload], - ), - 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="upload-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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 upload_async( - self, - *, - request: Union[ - operations.UploadFilesRequest, operations.UploadFilesRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Upload files for a company - - The *Upload files* endpoint uploads multiple files provided by the SMB to Codat. This may include personal identity documents, pitch decks, contracts, or files with accounting and banking data. - - Uploaded files must meet the following requirements: - - - Up to 20 files can be uploaded at a time. - - PDF, XLS, XLSX, XLSB, CSV, DOC, DOCX, PPT, PPTX, JPEG, JPG, and PNG files can be uploaded. - - Each file can be up to 10MB in size. - - :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.UploadFilesRequest) - request = cast(operations.UploadFilesRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/files", - 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.file_upload if request is not None else None, - False, - True, - "multipart", - Optional[shared.FileUpload], - ), - 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="upload-files", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "*"): - return - 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_lending.api.file_upload import FileUpload diff --git a/lending/src/codat_lending/financial_statements.py b/lending/src/codat_lending/financial_statements.py index 1e120da9a..132dbb429 100644 --- a/lending/src/codat_lending/financial_statements.py +++ b/lending/src/codat_lending/financial_statements.py @@ -1,37 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.financial_statements — re-export of the financial_statements method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.balance_sheet import BalanceSheet -from codat_lending.cash_flow import CashFlow -from codat_lending.codatlending_financial_statements_accounts import ( - CodatLendingFinancialStatementsAccounts, -) -from codat_lending.profit_and_loss import ProfitAndLoss -from typing import Optional - - -class FinancialStatements(BaseSDK): - accounts: CodatLendingFinancialStatementsAccounts - balance_sheet: BalanceSheet - cash_flow: CashFlow - profit_and_loss: ProfitAndLoss - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.accounts = CodatLendingFinancialStatementsAccounts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.balance_sheet = BalanceSheet( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.cash_flow = CashFlow(self.sdk_configuration, parent_ref=self.parent_ref) - self.profit_and_loss = ProfitAndLoss( - self.sdk_configuration, parent_ref=self.parent_ref - ) +from codat_lending.api.financial_statements import FinancialStatements diff --git a/lending/src/codat_lending/invoices.py b/lending/src/codat_lending/invoices.py index 8565778ec..f0e828810 100644 --- a/lending/src/codat_lending/invoices.py +++ b/lending/src/codat_lending/invoices.py @@ -1,1502 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.invoices — re-export of the invoices method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class Invoices(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingInvoiceAttachmentRequest, - operations.DownloadAccountingInvoiceAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download invoice attachment - - The *Download invoice attachment* endpoint downloads a specific attachment for a given `invoiceId` and `attachmentId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - - :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.DownloadAccountingInvoiceAttachmentRequest - ) - request = cast(operations.DownloadAccountingInvoiceAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-invoice-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingInvoiceAttachmentRequest, - operations.DownloadAccountingInvoiceAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download invoice attachment - - The *Download invoice attachment* endpoint downloads a specific attachment for a given `invoiceId` and `attachmentId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - - :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.DownloadAccountingInvoiceAttachmentRequest - ) - request = cast(operations.DownloadAccountingInvoiceAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-invoice-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def download_pdf( - self, - *, - request: Union[ - operations.DownloadAccountingInvoicePdfRequest, - operations.DownloadAccountingInvoicePdfRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Get invoice as PDF - - Download invoice as a pdf. - - :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.DownloadAccountingInvoicePdfRequest - ) - request = cast(operations.DownloadAccountingInvoicePdfRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/invoices/{invoiceId}/pdf", - 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/pdf", - 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="download-accounting-invoice-pdf", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/pdf"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "409", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_pdf_async( - self, - *, - request: Union[ - operations.DownloadAccountingInvoicePdfRequest, - operations.DownloadAccountingInvoicePdfRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Get invoice as PDF - - Download invoice as a pdf. - - :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.DownloadAccountingInvoicePdfRequest - ) - request = cast(operations.DownloadAccountingInvoicePdfRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/invoices/{invoiceId}/pdf", - 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/pdf", - 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="download-accounting-invoice-pdf", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/pdf"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "409", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingInvoiceRequest, - operations.GetAccountingInvoiceRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingInvoice: - r"""Get invoice - - The *Get invoice* endpoint returns a single invoice for a given invoiceId. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - - :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.GetAccountingInvoiceRequest) - request = cast(operations.GetAccountingInvoiceRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/invoices/{invoiceId}", - 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-accounting-invoice", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingInvoice, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingInvoiceRequest, - operations.GetAccountingInvoiceRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingInvoice: - r"""Get invoice - - The *Get invoice* endpoint returns a single invoice for a given invoiceId. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - - :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.GetAccountingInvoiceRequest) - request = cast(operations.GetAccountingInvoiceRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/invoices/{invoiceId}", - 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-accounting-invoice", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingInvoice, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingInvoiceAttachmentRequest, - operations.GetAccountingInvoiceAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get invoice attachment - - The *Get invoice attachment* endpoint returns a specific attachment for a given `invoiceId` and `attachmentId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - - :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.GetAccountingInvoiceAttachmentRequest - ) - request = cast(operations.GetAccountingInvoiceAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}", - 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-accounting-invoice-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingInvoiceAttachmentRequest, - operations.GetAccountingInvoiceAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get invoice attachment - - The *Get invoice attachment* endpoint returns a specific attachment for a given `invoiceId` and `attachmentId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - - :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.GetAccountingInvoiceAttachmentRequest - ) - request = cast(operations.GetAccountingInvoiceAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}", - 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-accounting-invoice-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingInvoicesRequest, - operations.ListAccountingInvoicesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingInvoices: - r"""List invoices - - The *List invoices* endpoint returns a list of [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for a given company's connection. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Useful queries - - - Outstanding invoices - `query = amountDue > 0` - - Invoices due after a certain date: `query = dueDate > 2021-01-28` - - [Read more about querying](https://docs.codat.io/using-the-api/querying). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - - :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.ListAccountingInvoicesRequest) - request = cast(operations.ListAccountingInvoicesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/invoices", - 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-accounting-invoices", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingInvoices, 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.ListAccountingInvoicesRequest, - operations.ListAccountingInvoicesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingInvoices: - r"""List invoices - - The *List invoices* endpoint returns a list of [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for a given company's connection. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data). - - ### Useful queries - - - Outstanding invoices - `query = amountDue > 0` - - Invoices due after a certain date: `query = dueDate > 2021-01-28` - - [Read more about querying](https://docs.codat.io/using-the-api/querying). - - ### Tips and traps - - To access the `paymentAllocations` property, ensure that the `payments` data type is queued and cached in Codat before retrieving `invoices` from Codat's cache. - - - :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.ListAccountingInvoicesRequest) - request = cast(operations.ListAccountingInvoicesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/invoices", - 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-accounting-invoices", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingInvoices, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingInvoiceAttachmentsRequest, - operations.ListAccountingInvoiceAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List invoice attachments - - The *List invoice attachments* endpoint returns a list of attachments available to download for given `invoiceId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - :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.ListAccountingInvoiceAttachmentsRequest - ) - request = cast(operations.ListAccountingInvoiceAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-invoice-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingInvoiceAttachmentsRequest, - operations.ListAccountingInvoiceAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List invoice attachments - - The *List invoice attachments* endpoint returns a list of attachments available to download for given `invoiceId`. - - [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer. - - :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.ListAccountingInvoiceAttachmentsRequest - ) - request = cast(operations.ListAccountingInvoiceAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-invoice-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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) - - def list_reconciled( - self, - *, - request: Union[ - operations.ListReconciledInvoicesRequest, - operations.ListReconciledInvoicesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedInvoicesReport: - r"""List reconciled invoices - - Gets a list of invoices linked to the corresponding banking transaction - - :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.ListReconciledInvoicesRequest) - request = cast(operations.ListReconciledInvoicesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/enhancedInvoices", - 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-reconciled-invoices", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedInvoicesReport, 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_reconciled_async( - self, - *, - request: Union[ - operations.ListReconciledInvoicesRequest, - operations.ListReconciledInvoicesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedInvoicesReport: - r"""List reconciled invoices - - Gets a list of invoices linked to the corresponding banking transaction - - :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.ListReconciledInvoicesRequest) - request = cast(operations.ListReconciledInvoicesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/enhancedInvoices", - 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-reconciled-invoices", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedInvoicesReport, 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_lending.api.invoices import Invoices diff --git a/lending/src/codat_lending/journal_entries.py b/lending/src/codat_lending/journal_entries.py index e24d95423..b16670ca0 100644 --- a/lending/src/codat_lending/journal_entries.py +++ b/lending/src/codat_lending/journal_entries.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.journal_entries — re-export of the journal_entries method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class JournalEntries(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingJournalEntryRequest, - operations.GetAccountingJournalEntryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournalEntry: - r"""Get journal entry - - The *Get journal entry* endpoint returns a single journal entry for a given journalEntryId. - - [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingJournalEntryRequest - ) - request = cast(operations.GetAccountingJournalEntryRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/journalEntries/{journalEntryId}", - 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-accounting-journal-entry", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournalEntry, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingJournalEntryRequest, - operations.GetAccountingJournalEntryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournalEntry: - r"""Get journal entry - - The *Get journal entry* endpoint returns a single journal entry for a given journalEntryId. - - [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingJournalEntryRequest - ) - request = cast(operations.GetAccountingJournalEntryRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/journalEntries/{journalEntryId}", - 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-accounting-journal-entry", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournalEntry, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingJournalEntriesRequest, - operations.ListAccountingJournalEntriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournalEntries: - r"""List journal entries - - The *List journal entries* endpoint returns a list of [journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) for a given company's connection. - - [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingJournalEntriesRequest - ) - request = cast(operations.ListAccountingJournalEntriesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/journalEntries", - 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-accounting-journal-entries", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournalEntries, 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.ListAccountingJournalEntriesRequest, - operations.ListAccountingJournalEntriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournalEntries: - r"""List journal entries - - The *List journal entries* endpoint returns a list of [journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) for a given company's connection. - - [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) are made in a company's general ledger, or accounts, when transactions are approved. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingJournalEntriesRequest - ) - request = cast(operations.ListAccountingJournalEntriesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/journalEntries", - 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-accounting-journal-entries", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournalEntries, 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_lending.api.journal_entries import JournalEntries diff --git a/lending/src/codat_lending/journals.py b/lending/src/codat_lending/journals.py index 95e838fe0..02f452bcb 100644 --- a/lending/src/codat_lending/journals.py +++ b/lending/src/codat_lending/journals.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.journals — re-export of the journals method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Journals(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingJournalRequest, - operations.GetAccountingJournalRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournal: - r"""Get journal - - The *Get journal* endpoint returns a single journal for a given journalId. - - [Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingJournalRequest) - request = cast(operations.GetAccountingJournalRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/journals/{journalId}", - 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-accounting-journal", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournal, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingJournalRequest, - operations.GetAccountingJournalRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournal: - r"""Get journal - - The *Get journal* endpoint returns a single journal for a given journalId. - - [Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingJournalRequest) - request = cast(operations.GetAccountingJournalRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/journals/{journalId}", - 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-accounting-journal", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournal, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingJournalsRequest, - operations.ListAccountingJournalsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournals: - r"""List journals - - The *List journals* endpoint returns a list of [journals](https://docs.codat.io/lending-api#/schemas/Journal) for a given company's connection. - - [Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingJournalsRequest) - request = cast(operations.ListAccountingJournalsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/journals", - 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-accounting-journals", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournals, 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.ListAccountingJournalsRequest, - operations.ListAccountingJournalsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingJournals: - r"""List journals - - The *List journals* endpoint returns a list of [journals](https://docs.codat.io/lending-api#/schemas/Journal) for a given company's connection. - - [Journals](https://docs.codat.io/lending-api#/schemas/Journal) are used to record all the financial transactions of a company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingJournalsRequest) - request = cast(operations.ListAccountingJournalsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/journals", - 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-accounting-journals", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingJournals, 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_lending.api.journals import Journals diff --git a/lending/src/codat_lending/liabilities.py b/lending/src/codat_lending/liabilities.py index ea4786084..469d8e02b 100644 --- a/lending/src/codat_lending/liabilities.py +++ b/lending/src/codat_lending/liabilities.py @@ -1,839 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.liabilities — re-export of the liabilities method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Liabilities(BaseSDK): - r"""Debt and other liabilities.""" - - def generate_loan_summary( - self, - *, - request: Union[ - operations.GenerateLoanSummaryRequest, - operations.GenerateLoanSummaryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Generate loan summaries report - - The _Generate loan summaries_ endpoint requests the generation of the Loan Summaries report. - - Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GenerateLoanSummaryRequest) - request = cast(operations.GenerateLoanSummaryRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/reports/liabilities/loans", - 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-loan-summary", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "*"): - 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 generate_loan_summary_async( - self, - *, - request: Union[ - operations.GenerateLoanSummaryRequest, - operations.GenerateLoanSummaryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Generate loan summaries report - - The _Generate loan summaries_ endpoint requests the generation of the Loan Summaries report. - - Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GenerateLoanSummaryRequest) - request = cast(operations.GenerateLoanSummaryRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/reports/liabilities/loans", - 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-loan-summary", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "*"): - 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_loan_transactions( - self, - *, - request: Union[ - operations.GenerateLoanTransactionsRequest, - operations.GenerateLoanTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Generate loan transactions report - - The _Generate loan transactions_ endpoint requests the generation of the Loan Transactions report. - - Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GenerateLoanTransactionsRequest - ) - request = cast(operations.GenerateLoanTransactionsRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/reports/liabilities/loans/transactions", - 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-loan-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "*"): - return - 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_loan_transactions_async( - self, - *, - request: Union[ - operations.GenerateLoanTransactionsRequest, - operations.GenerateLoanTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Generate loan transactions report - - The _Generate loan transactions_ endpoint requests the generation of the Loan Transactions report. - - Learn more about Codat's liabilities feature [here](https://docs.codat.io/lending/features/liabilities-overview). - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GenerateLoanTransactionsRequest - ) - request = cast(operations.GenerateLoanTransactionsRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/reports/liabilities/loans/transactions", - 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-loan-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "*"): - return - 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_loan_summary( - self, - *, - request: Union[ - operations.GetLoanSummaryRequest, operations.GetLoanSummaryRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.LoanSummary: - r"""Get loan summaries - - The *Get loan summaries* endpoint returns a summary by integration type of all loans identified from a company's accounting, banking, and commerce integrations. - - The endpoint returns a list of a company's [loan summaries](https://docs.codat.io/lending-api#/schemas/LoanSummary) for each valid data connection. - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GetLoanSummaryRequest) - request = cast(operations.GetLoanSummaryRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/liabilities/loans", - 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-loan-summary", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.LoanSummary, 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_loan_summary_async( - self, - *, - request: Union[ - operations.GetLoanSummaryRequest, operations.GetLoanSummaryRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.LoanSummary: - r"""Get loan summaries - - The *Get loan summaries* endpoint returns a summary by integration type of all loans identified from a company's accounting, banking, and commerce integrations. - - The endpoint returns a list of a company's [loan summaries](https://docs.codat.io/lending-api#/schemas/LoanSummary) for each valid data connection. - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.GetLoanSummaryRequest) - request = cast(operations.GetLoanSummaryRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/liabilities/loans", - 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-loan-summary", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.LoanSummary, 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_loan_transactions( - self, - *, - request: Union[ - operations.ListLoanTransactionsRequest, - operations.ListLoanTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.LoanTransactions: - r"""List loan transactions - - The *List loan transactions* endpoint returns all [loan transactions](https://docs.codat.io/lending-api#/schemas/LoanTransactions) identified from a company's accounting, banking, and commerce integrations. - - This detail gives analysts a better idea of the loan obligations a company may have. - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.ListLoanTransactionsRequest) - request = cast(operations.ListLoanTransactionsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/liabilities/loans/transactions", - 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-loan-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.LoanTransactions, 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_loan_transactions_async( - self, - *, - request: Union[ - operations.ListLoanTransactionsRequest, - operations.ListLoanTransactionsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.LoanTransactions: - r"""List loan transactions - - The *List loan transactions* endpoint returns all [loan transactions](https://docs.codat.io/lending-api#/schemas/LoanTransactions) identified from a company's accounting, banking, and commerce integrations. - - This detail gives analysts a better idea of the loan obligations a company may have. - - Make sure you have [synced a company](https://docs.codat.io/lending-api#/operations/refresh-company-data) recently before calling the endpoint. - - - :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.ListLoanTransactionsRequest) - request = cast(operations.ListLoanTransactionsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/liabilities/loans/transactions", - 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-loan-transactions", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.LoanTransactions, 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_lending.api.liabilities import Liabilities diff --git a/lending/src/codat_lending/loan_writeback.py b/lending/src/codat_lending/loan_writeback.py index 005604aa7..97b710c56 100644 --- a/lending/src/codat_lending/loan_writeback.py +++ b/lending/src/codat_lending/loan_writeback.py @@ -1,62 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.loan_writeback — re-export of the loan_writeback method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.bank_accounts import BankAccounts -from codat_lending.bank_transactions import BankTransactions -from codat_lending.codatlending_loan_writeback_accounts import ( - CodatLendingLoanWritebackAccounts, -) -from codat_lending.codatlending_payments import CodatLendingPayments -from codat_lending.codatlending_suppliers import CodatLendingSuppliers -from codat_lending.create_operations import CreateOperations -from codat_lending.direct_costs import DirectCosts -from codat_lending.source_accounts import SourceAccounts -from codat_lending.transfers import Transfers -from typing import Optional - - -class LoanWriteback(BaseSDK): - source_accounts: SourceAccounts - bank_accounts: BankAccounts - bank_transactions: BankTransactions - accounts: CodatLendingLoanWritebackAccounts - direct_costs: DirectCosts - payments: CodatLendingPayments - suppliers: CodatLendingSuppliers - transfers: Transfers - create_operations: CreateOperations - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.source_accounts = SourceAccounts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.bank_accounts = BankAccounts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.bank_transactions = BankTransactions( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.accounts = CodatLendingLoanWritebackAccounts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.direct_costs = DirectCosts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.payments = CodatLendingPayments( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.suppliers = CodatLendingSuppliers( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.transfers = Transfers(self.sdk_configuration, parent_ref=self.parent_ref) - self.create_operations = CreateOperations( - self.sdk_configuration, parent_ref=self.parent_ref - ) +from codat_lending.api.loan_writeback import LoanWriteback diff --git a/lending/src/codat_lending/locations.py b/lending/src/codat_lending/locations.py index 24e5e9297..e59ebf37a 100644 --- a/lending/src/codat_lending/locations.py +++ b/lending/src/codat_lending/locations.py @@ -1,423 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.locations — re-export of the locations method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Locations(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceLocationRequest, - operations.GetCommerceLocationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceLocation: - r"""Get location - - The *Get location* endpoint returns a single location for a given locationId. - - [Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceLocationRequest) - request = cast(operations.GetCommerceLocationRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId}", - 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-commerce-location", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceLocation, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceLocationRequest, - operations.GetCommerceLocationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceLocation: - r"""Get location - - The *Get location* endpoint returns a single location for a given locationId. - - [Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceLocationRequest) - request = cast(operations.GetCommerceLocationRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-locations/{locationId}", - 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-commerce-location", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceLocation, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceLocationsRequest, - operations.ListCommerceLocationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceLocations: - r"""List locations - - The *List locations* endpoint returns a list of [locations](https://docs.codat.io/lending-api#/schemas/Location) for a given company's connection. - - [Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceLocationsRequest) - request = cast(operations.ListCommerceLocationsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-locations", - 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-commerce-locations", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceLocations, http_res) - if utils.match_response( - http_res, ["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.ListCommerceLocationsRequest, - operations.ListCommerceLocationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceLocations: - r"""List locations - - The *List locations* endpoint returns a list of [locations](https://docs.codat.io/lending-api#/schemas/Location) for a given company's connection. - - [Locations](https://docs.codat.io/lending-api#/schemas/Location) hold information on the geographic location at which stocks of [products](https://docs.codat.io/lending-api#/schemas/Product) may be held or where [orders](https://docs.codat.io/lending-api#/schemas/Order) were placed. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceLocationsRequest) - request = cast(operations.ListCommerceLocationsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-locations", - 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-commerce-locations", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceLocations, http_res) - if utils.match_response( - http_res, ["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_lending.api.locations import Locations diff --git a/lending/src/codat_lending/manage_data.py b/lending/src/codat_lending/manage_data.py index eee5ed8f2..1e69a2609 100644 --- a/lending/src/codat_lending/manage_data.py +++ b/lending/src/codat_lending/manage_data.py @@ -1,228 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.manage_data — re-export of the manage_data method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations -from codat_lending.pull_operations import PullOperations -from codat_lending.refresh import Refresh -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ManageData(BaseSDK): - refresh: Refresh - pull_operations: PullOperations - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.refresh = Refresh(self.sdk_configuration, parent_ref=self.parent_ref) - self.pull_operations = PullOperations( - self.sdk_configuration, parent_ref=self.parent_ref - ) - - def get_status( - self, - *, - request: Union[ - operations.GetDataStatusRequest, operations.GetDataStatusRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetDataStatusDataStatuses: - r"""Get data status - - Get the state of each data type 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.GetDataStatusRequest) - request = cast(operations.GetDataStatusRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/dataStatus", - 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-data-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.GetDataStatusDataStatuses, 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_status_async( - self, - *, - request: Union[ - operations.GetDataStatusRequest, operations.GetDataStatusRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> operations.GetDataStatusDataStatuses: - r"""Get data status - - Get the state of each data type 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.GetDataStatusRequest) - request = cast(operations.GetDataStatusRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/dataStatus", - 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-data-status", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - operations.GetDataStatusDataStatuses, 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_lending.api.manage_data import ManageData diff --git a/lending/src/codat_lending/manage_reports.py b/lending/src/codat_lending/manage_reports.py index da809fff7..514ab9f81 100644 --- a/lending/src/codat_lending/manage_reports.py +++ b/lending/src/codat_lending/manage_reports.py @@ -1,409 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.manage_reports — re-export of the manage_reports method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ManageReports(BaseSDK): - r"""Generate and review generated reports for a company.""" - - def generate_report( - self, - *, - request: Union[ - operations.GenerateReportRequest, operations.GenerateReportRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ReportOperation: - r"""Generate report - - Use the *Generate report* endpoint to initiate the generation of a report specified by the `reportType` parameter. - - This action triggers the system to refresh and pull the necessary data from the company's data sources to ensure the report contains the most up-to-date 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.GenerateReportRequest) - request = cast(operations.GenerateReportRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/reports/{reportType}", - 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-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "application/json"): - return unmarshal_json_response(shared.ReportOperation, 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 generate_report_async( - self, - *, - request: Union[ - operations.GenerateReportRequest, operations.GenerateReportRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.ReportOperation: - r"""Generate report - - Use the *Generate report* endpoint to initiate the generation of a report specified by the `reportType` parameter. - - This action triggers the system to refresh and pull the necessary data from the company's data sources to ensure the report contains the most up-to-date 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.GenerateReportRequest) - request = cast(operations.GenerateReportRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/reports/{reportType}", - 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-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "202", "application/json"): - return unmarshal_json_response(shared.ReportOperation, 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) - - def list_reports( - self, - *, - request: Union[ - operations.ListReportsRequest, operations.ListReportsRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Reports: - r"""List reports - - Use the *List reports* endpoint to return details (such as generation's current status, date of request, and date of generation) about all reports generated for a company. The query parameter can be used to filter the results. - - :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.ListReportsRequest) - request = cast(operations.ListReportsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports", - 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-reports", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Reports, 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_reports_async( - self, - *, - request: Union[ - operations.ListReportsRequest, operations.ListReportsRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Reports: - r"""List reports - - Use the *List reports* endpoint to return details (such as generation's current status, date of request, and date of generation) about all reports generated for a company. The query parameter can be used to filter the results. - - :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.ListReportsRequest) - request = cast(operations.ListReportsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports", - 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-reports", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Reports, 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_lending.api.manage_reports import ManageReports diff --git a/lending/src/codat_lending/metrics.py b/lending/src/codat_lending/metrics.py index 1498e87b5..3ca3c11c9 100644 --- a/lending/src/codat_lending/metrics.py +++ b/lending/src/codat_lending/metrics.py @@ -1,749 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.metrics — re-export of the metrics method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Metrics(BaseSDK): - def get_customer_retention( - self, - *, - request: Union[ - operations.GetCommerceCustomerRetentionMetricsRequest, - operations.GetCommerceCustomerRetentionMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get customer retention metrics - - The *Get customer retention metrics* endpoint returns customer retention insights for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - #### Customer retention metrics - - - __Existing customers__: the number of unique customers that have placed an order(s) in the specified period and any previous period. - - __New customers__: the number of unique customers that have placed an order(s) in the specified period and none in any previous period. - - __Total customers__: the total number of existing and new customers within the specified period. - - __Retention rate__: the ratio of existing customers within the specified period compared to the total customers at the end of the previous period represented as a percentage. - - __Repeat rate__: the ratio of existing customers to total customers over the specified period represented as a percentage. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate customer retention metrics. - - #### Response structure - - The Customer retention report's dimensions and measures are: - - | Index | Dimensions | - |-----------------------------|----------------------------| - | `index` = 0 | Period | - | `index` = 1 | Customer retention metrics | - - | Index | Measures | - |----------------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Percentage | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - :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.GetCommerceCustomerRetentionMetricsRequest - ) - request = cast(operations.GetCommerceCustomerRetentionMetricsRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/customerRetention", - 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-commerce-customer-retention-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_customer_retention_async( - self, - *, - request: Union[ - operations.GetCommerceCustomerRetentionMetricsRequest, - operations.GetCommerceCustomerRetentionMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get customer retention metrics - - The *Get customer retention metrics* endpoint returns customer retention insights for a specific company's commerce connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - #### Customer retention metrics - - - __Existing customers__: the number of unique customers that have placed an order(s) in the specified period and any previous period. - - __New customers__: the number of unique customers that have placed an order(s) in the specified period and none in any previous period. - - __Total customers__: the total number of existing and new customers within the specified period. - - __Retention rate__: the ratio of existing customers within the specified period compared to the total customers at the end of the previous period represented as a percentage. - - __Repeat rate__: the ratio of existing customers to total customers over the specified period represented as a percentage. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate customer retention metrics. - - #### Response structure - - The Customer retention report's dimensions and measures are: - - | Index | Dimensions | - |-----------------------------|----------------------------| - | `index` = 0 | Period | - | `index` = 1 | Customer retention metrics | - - | Index | Measures | - |----------------------|------------| - | `index` = 0 | Count | - | `index` = 1 | Percentage | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - :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.GetCommerceCustomerRetentionMetricsRequest - ) - request = cast(operations.GetCommerceCustomerRetentionMetricsRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/customerRetention", - 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-commerce-customer-retention-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_lifetime_value( - self, - *, - request: Union[ - operations.GetCommerceLifetimeValueMetricsRequest, - operations.GetCommerceLifetimeValueMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get lifetime value metrics - - The *Get lifetime value metrics* endpoint returns the average revenue that a specific company will generate throughout its lifespan over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the lifetime value metrics. - - #### Response structure - - The Lifetime value report's dimensions and measures are: - - | Index | Dimensions | - |---------------|------------------------| - | `index` = 0 | Period | - | `index` = 1 | Lifetime value metrics | - - | Index | Measures | - |-------------------|---------| - | `index` = 1 | Value | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceLifetimeValueMetricsRequest - ) - request = cast(operations.GetCommerceLifetimeValueMetricsRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/lifetimeValue", - 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-commerce-lifetime-value-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_lifetime_value_async( - self, - *, - request: Union[ - operations.GetCommerceLifetimeValueMetricsRequest, - operations.GetCommerceLifetimeValueMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get lifetime value metrics - - The *Get lifetime value metrics* endpoint returns the average revenue that a specific company will generate throughout its lifespan over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the lifetime value metrics. - - #### Response structure - - The Lifetime value report's dimensions and measures are: - - | Index | Dimensions | - |---------------|------------------------| - | `index` = 0 | Period | - | `index` = 1 | Lifetime value metrics | - - | Index | Measures | - |-------------------|---------| - | `index` = 1 | Value | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceLifetimeValueMetricsRequest - ) - request = cast(operations.GetCommerceLifetimeValueMetricsRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/lifetimeValue", - 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-commerce-lifetime-value-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_revenue( - self, - *, - request: Union[ - operations.GetCommerceRevenueMetricsRequest, - operations.GetCommerceRevenueMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get commerce revenue metrics - - The *Get revenue report* endpoint returns the revenue and revenue growth for a specific company connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the revenue metrics. - - #### Response structure - - The Revenue report's dimensions and measures are: - - | Index | Dimensions | - |---------------|------------| - | `index` = 0 | Period | - | `index` = 1 | Revenue | - - | Index | Measures | - |---------------|--------------------------------------------------------------------------------------------------------------------------| - | `index` = 0 | Value | - | `index` = 1 | Percentage change, defined as the change between the current and previous periods' values and expressed as a percentage. | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceRevenueMetricsRequest - ) - request = cast(operations.GetCommerceRevenueMetricsRequest, request) - - req = self._build_request( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/revenue", - 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-commerce-revenue-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_revenue_async( - self, - *, - request: Union[ - operations.GetCommerceRevenueMetricsRequest, - operations.GetCommerceRevenueMetricsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceReport: - r"""Get commerce revenue metrics - - The *Get revenue report* endpoint returns the revenue and revenue growth for a specific company connection over one or more periods of time. - - This detail helps you assess a merchant's health and advise them on performance improvement strategies. It also provides you with key insights you need to assess the credit risk of a company. - - [Learn more](https://docs.codat.io/lending/features/sales-overview#metrics) about the formulas used to calculate the revenue metrics. - - #### Response structure - - The Revenue report's dimensions and measures are: - - | Index | Dimensions | - |---------------|------------| - | `index` = 0 | Period | - | `index` = 1 | Revenue | - - | Index | Measures | - |---------------|--------------------------------------------------------------------------------------------------------------------------| - | `index` = 0 | Value | - | `index` = 1 | Percentage change, defined as the change between the current and previous periods' values and expressed as a percentage. | - - The report data then combines multiple reporting dimensions and measures and outputs the value of each combination. - - - :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.GetCommerceRevenueMetricsRequest - ) - request = cast(operations.GetCommerceRevenueMetricsRequest, request) - - req = self._build_request_async( - method="GET", - path="/data/companies/{companyId}/connections/{connectionId}/assess/commerceMetrics/revenue", - 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-commerce-revenue-metrics", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceReport, 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_lending.api.metrics import Metrics diff --git a/lending/src/codat_lending/models/__init__.py b/lending/src/codat_lending/models/__init__.py index d0b47ff9f..7ce2c003c 100644 --- a/lending/src/codat_lending/models/__init__.py +++ b/lending/src/codat_lending/models/__init__.py @@ -1,23 +1,348 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from typing import Any, TYPE_CHECKING +# flake8: noqa +""" + Lending -from codat_lending.utils.dynamic_imports import lazy_getattr, lazy_dir + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -if TYPE_CHECKING: - from . import errors, operations, shared, webhooks + 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", "webhooks"] - - -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_lending.models.account import Account +from codat_lending.models.shared.accountbalance import AccountBalance +from codat_lending.models.shared.accountbalanceamounts import AccountBalanceAmounts +from codat_lending.models.shared.accountcategoriesupdatedwebhook import AccountCategoriesUpdatedWebhook +from codat_lending.models.shared.accountcategoriesupdatedwebhookdata import AccountCategoriesUpdatedWebhookData +from codat_lending.models.shared.accountcategorylevel import AccountCategoryLevel +from codat_lending.models.shared.accountidentifiertype import AccountIdentifierType +from codat_lending.models.shared.accountidentifiers import AccountIdentifiers +from codat_lending.models.shared.accountinfo import AccountInfo +from codat_lending.models.shared.accountinstitution import AccountInstitution +from codat_lending.models.shared.accountprototype import AccountPrototype +from codat_lending.models.shared.accountref import AccountRef +from codat_lending.models.shared.accountstatus import AccountStatus +from codat_lending.models.shared.accounttransactionline import AccountTransactionLine +from codat_lending.models.account_transaction_line_record_ref import AccountTransactionLineRecordRef +from codat_lending.models.shared.accountingaccount import AccountingAccount +from codat_lending.models.shared.accountingaccounttransaction import AccountingAccountTransaction +from codat_lending.models.shared.accountingaccounttransactions import AccountingAccountTransactions +from codat_lending.models.shared.accountingaccounts import AccountingAccounts +from codat_lending.models.shared.accountingaddress import AccountingAddress +from codat_lending.models.shared.accountingaddresstype import AccountingAddressType +from codat_lending.models.shared.accountingagedcreditorreport import AccountingAgedCreditorReport +from codat_lending.models.shared.accountingageddebtorreport import AccountingAgedDebtorReport +from codat_lending.models.shared.accountingattachment import AccountingAttachment +from codat_lending.models.shared.accountingbalancesheet import AccountingBalanceSheet +from codat_lending.models.shared.accountingbankaccount import AccountingBankAccount +from codat_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from codat_lending.models.shared.accountingbankaccounts import AccountingBankAccounts +from codat_lending.models.shared.accountingbanktransaction import AccountingBankTransaction +from codat_lending.models.shared.accountingbanktransactions import AccountingBankTransactions +from codat_lending.models.shared.accountingbill import AccountingBill +from codat_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNote +from codat_lending.models.shared.accountingbillcreditnotes import AccountingBillCreditNotes +from codat_lending.models.shared.accountingbillpayment import AccountingBillPayment +from codat_lending.models.accounting_bill_payment_all_of_payment_method_ref import AccountingBillPaymentAllOfPaymentMethodRef +from codat_lending.models.accounting_bill_payment_all_of_supplier_ref import AccountingBillPaymentAllOfSupplierRef +from codat_lending.models.shared.accountingbillpayments import AccountingBillPayments +from codat_lending.models.shared.accountingbills import AccountingBills +from codat_lending.models.shared.accountingcashflowstatement import AccountingCashFlowStatement +from codat_lending.models.shared.accountingcompanyinfo import AccountingCompanyInfo +from codat_lending.models.shared.accountingcreateaccountresponse import AccountingCreateAccountResponse +from codat_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData +from codat_lending.models.shared.accountingcreatebankaccountresponse import AccountingCreateBankAccountResponse +from codat_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData +from codat_lending.models.shared.accountingcreatebanktransactions import AccountingCreateBankTransactions +from codat_lending.models.shared.accountingcreatebanktransactionsresponse import AccountingCreateBankTransactionsResponse +from codat_lending.models.accounting_create_bank_transactions_response_all_of_data import AccountingCreateBankTransactionsResponseAllOfData +from codat_lending.models.shared.accountingcreatedirectcostresponse import AccountingCreateDirectCostResponse +from codat_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData +from codat_lending.models.shared.accountingcreatepaymentresponse import AccountingCreatePaymentResponse +from codat_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData +from codat_lending.models.shared.accountingcreatesupplierresponse import AccountingCreateSupplierResponse +from codat_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData +from codat_lending.models.accounting_create_transfer_response import AccountingCreateTransferResponse +from codat_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData +from codat_lending.models.shared.accountingcreditnote import AccountingCreditNote +from codat_lending.models.shared.accountingcreditnotes import AccountingCreditNotes +from codat_lending.models.shared.accountingcustomer import AccountingCustomer +from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRef +from codat_lending.models.shared.accountingcustomers import AccountingCustomers +from codat_lending.models.shared.accountingdirectcost import AccountingDirectCost +from codat_lending.models.shared.accountingdirectcosts import AccountingDirectCosts +from codat_lending.models.shared.accountingdirectincome import AccountingDirectIncome +from codat_lending.models.shared.accountingdirectincomes import AccountingDirectIncomes +from codat_lending.models.shared.accountinginvoice import AccountingInvoice +from codat_lending.models.shared.accountinginvoices import AccountingInvoices +from codat_lending.models.shared.accountingjournal import AccountingJournal +from codat_lending.models.shared.accountingjournalentries import AccountingJournalEntries +from codat_lending.models.shared.accountingjournalentry import AccountingJournalEntry +from codat_lending.models.shared.accountingjournals import AccountingJournals +from codat_lending.models.shared.accountingpayment import AccountingPayment +from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation +from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocation +from codat_lending.models.accounting_payment_method import AccountingPaymentMethod +from codat_lending.models.shared.accountingpayments import AccountingPayments +from codat_lending.models.shared.accountingprofitandlossreport import AccountingProfitAndLossReport +from codat_lending.models.shared.accountingrecordref import AccountingRecordRef +from codat_lending.models.shared.accountingsupplier import AccountingSupplier +from codat_lending.models.shared.accountingsuppliers import AccountingSuppliers +from codat_lending.models.accounting_tracking_category import AccountingTrackingCategory +from codat_lending.models.shared.accountingtransfer import AccountingTransfer +from codat_lending.models.shared.accountingtransfers import AccountingTransfers +from codat_lending.models.shared.accounts import Accounts +from codat_lending.models.shared.accountspayabletracking import AccountsPayableTracking +from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTracking +from codat_lending.models.shared.agedcreditor import AgedCreditor +from codat_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstanding +from codat_lending.models.shared.ageddebtor import AgedDebtor +from codat_lending.models.shared.agedoutstandingamount import AgedOutstandingAmount +from codat_lending.models.shared.agedoutstandingamountdetail import AgedOutstandingAmountDetail +from codat_lending.models.shared.attachments import Attachments +from codat_lending.models.shared.balancesheet import BalanceSheet +from codat_lending.models.bank_account_prototype import BankAccountPrototype +from codat_lending.models.shared.bankaccountref import BankAccountRef +from codat_lending.models.shared.bankaccountstatus import BankAccountStatus +from codat_lending.models.shared.bankfeedbankaccountmapping import BankFeedBankAccountMapping +from codat_lending.models.shared.bankfeedbankaccountmappingresponse import BankFeedBankAccountMappingResponse +from codat_lending.models.shared.bankfeedmapping import BankFeedMapping +from codat_lending.models.shared.bankstatementuploadconfiguration import BankStatementUploadConfiguration +from codat_lending.models.shared.banktransactiontype import BankTransactionType +from codat_lending.models.shared.bankingaccount import BankingAccount +from codat_lending.models.shared.bankingaccountbalance import BankingAccountBalance +from codat_lending.models.shared.bankingaccountbalances import BankingAccountBalances +from codat_lending.models.shared.bankingaccounts import BankingAccounts +from codat_lending.models.shared.bankingtransaction import BankingTransaction +from codat_lending.models.shared.bankingtransactioncategories import BankingTransactionCategories +from codat_lending.models.shared.bankingtransactioncategory import BankingTransactionCategory +from codat_lending.models.shared.bankingtransactionref import BankingTransactionRef +from codat_lending.models.shared.bankingtransactions import BankingTransactions +from codat_lending.models.shared.billcreditnotelineitem import BillCreditNoteLineItem +from codat_lending.models.shared.billcreditnotestatus import BillCreditNoteStatus +from codat_lending.models.bill_line_item import BillLineItem +from codat_lending.models.bill_line_item_purchase_order_line_ref import BillLineItemPurchaseOrderLineRef +from codat_lending.models.shared.billpaymentline import BillPaymentLine +from codat_lending.models.shared.billpaymentlinelink import BillPaymentLineLink +from codat_lending.models.shared.billpaymentlinelinktype import BillPaymentLineLinkType +from codat_lending.models.shared.billstatus import BillStatus +from codat_lending.models.shared.billedtotype import BilledToType +from codat_lending.models.shared.billedtotype1 import BilledToType1 +from codat_lending.models.shared.cashflowstatement import CashFlowStatement +from codat_lending.models.cash_flow_transaction import CashFlowTransaction +from codat_lending.models.categorized_bank_statement_accounts import CategorizedBankStatementAccounts +from codat_lending.models.categorized_bank_statement_transactions import CategorizedBankStatementTransactions +from codat_lending.models.shared.clientratelimitwebhook import ClientRateLimitWebhook +from codat_lending.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload +from codat_lending.models.shared.commerceaddress import CommerceAddress +from codat_lending.models.shared.commerceaddresstype import CommerceAddressType +from codat_lending.models.shared.commercecompanyinfo import CommerceCompanyInfo +from codat_lending.models.shared.commercecustomer import CommerceCustomer +from codat_lending.models.shared.commercecustomerref import CommerceCustomerRef +from codat_lending.models.shared.commercecustomers import CommerceCustomers +from codat_lending.models.shared.commercedispute import CommerceDispute +from codat_lending.models.shared.commercedisputes import CommerceDisputes +from codat_lending.models.shared.commercelocation import CommerceLocation +from codat_lending.models.shared.commercelocations import CommerceLocations +from codat_lending.models.shared.commerceorder import CommerceOrder +from codat_lending.models.shared.commerceorders import CommerceOrders +from codat_lending.models.shared.commercepayment import CommercePayment +from codat_lending.models.shared.commercepaymentmethod import CommercePaymentMethod +from codat_lending.models.shared.commercepaymentmethods import CommercePaymentMethods +from codat_lending.models.shared.commercepayments import CommercePayments +from codat_lending.models.shared.commerceproduct import CommerceProduct +from codat_lending.models.shared.commerceproductcategories import CommerceProductCategories +from codat_lending.models.shared.commerceproductcategory import CommerceProductCategory +from codat_lending.models.shared.commerceproducts import CommerceProducts +from codat_lending.models.shared.commercerecordref import CommerceRecordRef +from codat_lending.models.shared.commercereport import CommerceReport +from codat_lending.models.shared.commercereportcomponent import CommerceReportComponent +from codat_lending.models.shared.commercereportdimension import CommerceReportDimension +from codat_lending.models.commerce_report_dimension_items import CommerceReportDimensionItems +from codat_lending.models.shared.commercereporterror import CommerceReportError +from codat_lending.models.shared.commercereportmeasure import CommerceReportMeasure +from codat_lending.models.commerce_tax_component import CommerceTaxComponent +from codat_lending.models.shared.commercetransaction import CommerceTransaction +from codat_lending.models.shared.commercetransactions import CommerceTransactions +from codat_lending.models.shared.companies import Companies +from codat_lending.models.shared.company import Company +from codat_lending.models.company_details import CompanyDetails +from codat_lending.models.shared.companyreference import CompanyReference +from codat_lending.models.company_reference_links import CompanyReferenceLinks +from codat_lending.models.shared.companyrequestbody import CompanyRequestBody +from codat_lending.models.shared.companyupdaterequest import CompanyUpdateRequest +from codat_lending.models.shared.connection import Connection +from codat_lending.models.shared.connections import Connections +from codat_lending.models.shared.contact import Contact +from codat_lending.models.contact_ref import ContactRef +from codat_lending.models.contact_reference import ContactReference +from codat_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransaction +from codat_lending.models.create_connection_request import CreateConnectionRequest +from codat_lending.models.create_source_account200_response import CreateSourceAccount200Response +from codat_lending.models.create_source_account_request import CreateSourceAccountRequest +from codat_lending.models.created_date import CreatedDate +from codat_lending.models.shared.creditnotelineitem import CreditNoteLineItem +from codat_lending.models.shared.creditnotestatus import CreditNoteStatus +from codat_lending.models.shared.customerstatus import CustomerStatus +from codat_lending.models.shared.dataconnectionerror import DataConnectionError +from codat_lending.models.shared.dataconnectionstatus import DataConnectionStatus +from codat_lending.models.shared.dataintegrityamounts import DataIntegrityAmounts +from codat_lending.models.shared.dataintegritybyamount import DataIntegrityByAmount +from codat_lending.models.shared.dataintegritybycount import DataIntegrityByCount +from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionId +from codat_lending.models.shared.dataintegritydates import DataIntegrityDates +from codat_lending.models.shared.dataintegritydetail import DataIntegrityDetail +from codat_lending.models.shared.dataintegritydetails import DataIntegrityDetails +from codat_lending.models.shared.dataintegritymatch import DataIntegrityMatch +from codat_lending.models.shared.dataintegritystatus import DataIntegrityStatus +from codat_lending.models.shared.dataintegritystatusinfo import DataIntegrityStatusInfo +from codat_lending.models.shared.dataintegritystatuses import DataIntegrityStatuses +from codat_lending.models.shared.dataintegritysummaries import DataIntegritySummaries +from codat_lending.models.shared.dataintegritysummary import DataIntegritySummary +from codat_lending.models.data_integrity_type import DataIntegrityType +from codat_lending.models.shared.datasource import DataSource +from codat_lending.models.shared.datastatus import DataStatus +from codat_lending.models.data_statuses import DataStatuses +from codat_lending.models.shared.datatype import DataType +from codat_lending.models.shared.directcostlineitem import DirectCostLineItem +from codat_lending.models.shared.directcostprototype import DirectCostPrototype +from codat_lending.models.shared.directincomelineitem import DirectIncomeLineItem +from codat_lending.models.shared.disputestatus import DisputeStatus +from codat_lending.models.shared.enduploadsessionrequest import EndUploadSessionRequest +from codat_lending.models.shared.enhancedcashflowitem import EnhancedCashFlowItem +from codat_lending.models.shared.enhancedcashflowtransactions import EnhancedCashFlowTransactions +from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReport +from codat_lending.models.shared.enhancedinvoicereportitem import EnhancedInvoiceReportItem +from codat_lending.models.shared.enhancedinvoicesreport import EnhancedInvoicesReport +from codat_lending.models.shared.enhancedreportaccountcategory import EnhancedReportAccountCategory +from codat_lending.models.shared.enhancedreportinfo import EnhancedReportInfo +from codat_lending.models.error_message import ErrorMessage +from codat_lending.models.shared.errorvalidation import ErrorValidation +from codat_lending.models.shared.errorvalidationitem import ErrorValidationItem +from codat_lending.models.shared.excelreporttypes import ExcelReportTypes +from codat_lending.models.shared.excelstatus import ExcelStatus +from codat_lending.models.shared.file import File +from codat_lending.models.financial_summary import FinancialSummary +from codat_lending.models.financial_summary_accounting_score import FinancialSummaryAccountingScore +from codat_lending.models.financial_summary_books_closed_date import FinancialSummaryBooksClosedDate +from codat_lending.models.get_report_status_report_id_parameter import GetReportStatusReportIdParameter +from codat_lending.models.shared.halref import HalRef +from codat_lending.models.shared.integritystatus import IntegrityStatus +from codat_lending.models.shared.invoicelineitem import InvoiceLineItem +from codat_lending.models.shared.invoicestatus import InvoiceStatus +from codat_lending.models.shared.itemref import ItemRef +from codat_lending.models.item_reference import ItemReference +from codat_lending.models.shared.items import Items +from codat_lending.models.shared.journalentryrecordref import JournalEntryRecordRef +from codat_lending.models.journal_line import JournalLine +from codat_lending.models.journal_line_tracking import JournalLineTracking +from codat_lending.models.journal_prototype import JournalPrototype +from codat_lending.models.shared.journalref import JournalRef +from codat_lending.models.shared.journalstatus import JournalStatus +from codat_lending.models.shared.lendingcustomerref import LendingCustomerRef +from codat_lending.models.shared.links import Links +from codat_lending.models.shared.loanref import LoanRef +from codat_lending.models.shared.loansummary import LoanSummary +from codat_lending.models.shared.loansummaryintegrationtype import LoanSummaryIntegrationType +from codat_lending.models.shared.loansummaryrecordref import LoanSummaryRecordRef +from codat_lending.models.shared.loansummaryrecordreftype import LoanSummaryRecordRefType +from codat_lending.models.shared.loansummaryreportinfo import LoanSummaryReportInfo +from codat_lending.models.shared.loansummaryreportitem import LoanSummaryReportItem +from codat_lending.models.shared.loantransactions import LoanTransactions +from codat_lending.models.shared.loantransactionsreportinfo import LoanTransactionsReportInfo +from codat_lending.models.shared.locationref import LocationRef +from codat_lending.models.shared.metadata import Metadata +from codat_lending.models.model0 import Model0 +from codat_lending.models.model3 import Model3 +from codat_lending.models.shared.orderdiscountallocation import OrderDiscountAllocation +from codat_lending.models.shared.orderlineitem import OrderLineItem +from codat_lending.models.paging_info import PagingInfo +from codat_lending.models.shared.payment import Payment +from codat_lending.models.shared.paymentallocationpayment import PaymentAllocationPayment +from codat_lending.models.shared.paymentline import PaymentLine +from codat_lending.models.shared.paymentlinelink import PaymentLineLink +from codat_lending.models.shared.paymentlinktype import PaymentLinkType +from codat_lending.models.shared.paymentmethodref import PaymentMethodRef +from codat_lending.models.payment_method_type import PaymentMethodType +from codat_lending.models.shared.paymentref import PaymentRef +from codat_lending.models.shared.paymentstatus import PaymentStatus +from codat_lending.models.shared.paymenttype import PaymentType +from codat_lending.models.phone_number import PhoneNumber +from codat_lending.models.shared.productinventory import ProductInventory +from codat_lending.models.shared.productinventorylocation import ProductInventoryLocation +from codat_lending.models.shared.productprice import ProductPrice +from codat_lending.models.shared.productref import ProductRef +from codat_lending.models.shared.productvariant import ProductVariant +from codat_lending.models.shared.productvariantref import ProductVariantRef +from codat_lending.models.shared.productvariantstatus import ProductVariantStatus +from codat_lending.models.shared.profitandlossreport import ProfitAndLossReport +from codat_lending.models.shared.projectref import ProjectRef +from codat_lending.models.shared.pulloperation import PullOperation +from codat_lending.models.shared.pulloperations import PullOperations +from codat_lending.models.purchase_order_reference import PurchaseOrderReference +from codat_lending.models.shared.pushchangetype import PushChangeType +from codat_lending.models.shared.pushfieldvalidation import PushFieldValidation +from codat_lending.models.shared.pushoperation import PushOperation +from codat_lending.models.shared.pushoperationchange import PushOperationChange +from codat_lending.models.shared.pushoperationref import PushOperationRef +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.pushoperations import PushOperations +from codat_lending.models.shared.pushoption import PushOption +from codat_lending.models.shared.pushoptionchoice import PushOptionChoice +from codat_lending.models.shared.pushoptionproperty import PushOptionProperty +from codat_lending.models.shared.pushoptiontype import PushOptionType +from codat_lending.models.shared.pushvalidationinfo import PushValidationInfo +from codat_lending.models.record_line_reference import RecordLineReference +from codat_lending.models.shared.reportbasis import ReportBasis +from codat_lending.models.shared.reportcomponentmeasure import ReportComponentMeasure +from codat_lending.models.shared.reportinfo import ReportInfo +from codat_lending.models.shared.reportinput import ReportInput +from codat_lending.models.report_item import ReportItem +from codat_lending.models.shared.reportitems import ReportItems +from codat_lending.models.shared.reportline import ReportLine +from codat_lending.models.shared.reportoperation import ReportOperation +from codat_lending.models.report_source_reference import ReportSourceReference +from codat_lending.models.shared.reports import Reports +from codat_lending.models.shared.routinginfo import RoutingInfo +from codat_lending.models.sales_order_reference import SalesOrderReference +from codat_lending.models.shared.servicecharge import ServiceCharge +from codat_lending.models.shared.servicechargetype import ServiceChargeType +from codat_lending.models.shared.sourceaccount import SourceAccount +from codat_lending.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_lending.models.source_account_v2 import SourceAccountV2 +from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype +from codat_lending.models.shared.sourceref import SourceRef +from codat_lending.models.shared.startuploadsessionrequest import StartUploadSessionRequest +from codat_lending.models.shared.status import Status +from codat_lending.models.shared.supplementaldata import SupplementalData +from codat_lending.models.shared.supplierref import SupplierRef +from codat_lending.models.shared.supplierstatus import SupplierStatus +from codat_lending.models.shared.targetaccountoption import TargetAccountOption +from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocation +from codat_lending.models.shared.taxcomponentref import TaxComponentRef +from codat_lending.models.shared.taxrateref import TaxRateRef +from codat_lending.models.tax_rate_reference import TaxRateReference +from codat_lending.models.shared.tracking import Tracking +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef +from codat_lending.models.tracking_record_ref import TrackingRecordRef +from codat_lending.models.shared.transactioncategory import TransactionCategory +from codat_lending.models.shared.transactioncategoryref import TransactionCategoryRef +from codat_lending.models.shared.transactioncategorystatus import TransactionCategoryStatus +from codat_lending.models.shared.transactioncode import TransactionCode +from codat_lending.models.shared.transactionsourceref import TransactionSourceRef +from codat_lending.models.shared.transactionsourcetype import TransactionSourceType +from codat_lending.models.shared.transactiontype import TransactionType +from codat_lending.models.shared.transferaccount import TransferAccount +from codat_lending.models.update_connection import UpdateConnection +from codat_lending.models.upload_bank_statement_data_request import UploadBankStatementDataRequest +from codat_lending.models.valid_data_type_links import ValidDataTypeLinks +from codat_lending.models.shared.validation import Validation +from codat_lending.models.shared.validationitem import ValidationItem +from codat_lending.models.shared.weblink import WebLink +from codat_lending.models.withholding_tax import WithholdingTax diff --git a/lending/src/codat_lending/models/_compat/__init__.py b/lending/src/codat_lending/models/_compat/__init__.py new file mode 100644 index 000000000..70271e525 --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/_compat/accounttransactionlinerecordref.py b/lending/src/codat_lending/models/_compat/accounttransactionlinerecordref.py new file mode 100644 index 000000000..d9aaaa1a2 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/accounttransactionlinerecordref.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountTransactionLineRecordRefDataType(str, Enum): + """Speakeasy-name compat for JournalEntryRecordRefDataType (matched by value set).""" + BANK_TRANSACTIONS = 'bankTransactions' + BILL_CREDIT_NOTES = 'billCreditNotes' + BILL_PAYMENTS = 'billPayments' + BILLS = 'bills' + CREDIT_NOTES = 'creditNotes' + DIRECT_COSTS = 'directCosts' + DIRECT_INCOMES = 'directIncomes' + INVOICES = 'invoices' + JOURNAL_ENTRIES = 'journalEntries' + PAYMENTS = 'payments' + TRANSFERS = 'transfers' diff --git a/lending/src/codat_lending/models/_compat/billlineitem.py b/lending/src/codat_lending/models/_compat/billlineitem.py new file mode 100644 index 000000000..937fe3318 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/billlineitem.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class BillLineItemDataType(str, Enum): + """Speakeasy-name compat for RecordLineReferenceDataType (matched by value set).""" + PURCHASE_ORDERS = 'purchaseOrders' + BILLS = 'bills' diff --git a/lending/src/codat_lending/models/_compat/contactref.py b/lending/src/codat_lending/models/_compat/contactref.py new file mode 100644 index 000000000..bd49c84e8 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/contactref.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class ContactRefDataType(str, Enum): + """Speakeasy-name compat for AccountingJournalEntryDataType (matched by value set).""" + CUSTOMERS = 'customers' + SUPPLIERS = 'suppliers' diff --git a/lending/src/codat_lending/models/_compat/journalline.py b/lending/src/codat_lending/models/_compat/journalline.py new file mode 100644 index 000000000..78d007410 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/journalline.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class JournalLineDataType(str, Enum): + """Speakeasy-name compat for AccountingJournalEntryDataType (matched by value set).""" + CUSTOMERS = 'customers' + SUPPLIERS = 'suppliers' diff --git a/lending/src/codat_lending/models/_compat/phonenumber.py b/lending/src/codat_lending/models/_compat/phonenumber.py new file mode 100644 index 000000000..0bc424a26 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/phonenumber.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class PhoneNumberType(str, Enum): + """Speakeasy-name compat for Type (matched by value set).""" + PRIMARY = 'Primary' + LANDLINE = 'Landline' + MOBILE = 'Mobile' + FAX = 'Fax' + UNKNOWN = 'Unknown' diff --git a/lending/src/codat_lending/models/_compat/propertie_accounttype.py b/lending/src/codat_lending/models/_compat/propertie_accounttype.py new file mode 100644 index 000000000..f5529c6f9 --- /dev/null +++ b/lending/src/codat_lending/models/_compat/propertie_accounttype.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class PropertieAccountType(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/lending/src/codat_lending/models/_compat/schema_datatype.py b/lending/src/codat_lending/models/_compat/schema_datatype.py new file mode 100644 index 000000000..1d7d3b5ca --- /dev/null +++ b/lending/src/codat_lending/models/_compat/schema_datatype.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from enum import Enum + + +class SchemaDataType(str, Enum): + """Speakeasy-name compat for DataTypes (matched by value set).""" + 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' diff --git a/lending/src/codat_lending/models/_compat/sourceaccountv2.py b/lending/src/codat_lending/models/_compat/sourceaccountv2.py new file mode 100644 index 000000000..6536b837b --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/_compat/trackingrecordref.py b/lending/src/codat_lending/models/_compat/trackingrecordref.py new file mode 100644 index 000000000..ae672b16b --- /dev/null +++ b/lending/src/codat_lending/models/_compat/trackingrecordref.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class TrackingRecordRefDataType(str, Enum): + """Speakeasy-name compat for JournalLineTrackingDataType (matched by value set).""" + CUSTOMERS = 'customers' + SUPPLIERS = 'suppliers' + TRACKING_CATEGORIES = 'trackingCategories' diff --git a/lending/src/codat_lending/models/account.py b/lending/src/codat_lending/models/account.py new file mode 100644 index 000000000..b61d50d35 --- /dev/null +++ b/lending/src/codat_lending/models/account.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountidentifiers import AccountIdentifiers, AccountIdentifiersTypedDict +from codat_lending.models.shared.sourceref import SourceRef, SourceRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class Account(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} + """ + Account + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The ID of the account from the provider.") + source_ref: Optional[SourceRef] = Field(default=None, alias="sourceRef") + platform_name: Optional[str] = Field(default=None, description="Name of the banking data source, e.g. \"Plaid\".", alias="platformName") + account_provider: Optional[str] = Field(default=None, description="The bank or other financial institution providing the account.", alias="accountProvider") + account_name: Optional[str] = Field(default=None, description="The name of the account according to the provider.", alias="accountName") + account_type: Optional[str] = Field(default=None, description="The type of banking account, e.g. credit or debit.", alias="accountType") + 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.") + current_balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The balance of the bank account.", alias="currentBalance") + identifiers: Optional[AccountIdentifiers] = None + __properties: ClassVar[List[str]] = ["id", "sourceRef", "platformName", "accountProvider", "accountName", "accountType", "currency", "currentBalance", "identifiers"] + + 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 Account 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 source_ref + if self.source_ref: + _dict['sourceRef'] = self.source_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of identifiers + if self.identifiers: + _dict['identifiers'] = self.identifiers.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Account 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"), + "sourceRef": SourceRef.from_dict(obj["sourceRef"]) if obj.get("sourceRef") is not None else None, + "platformName": obj.get("platformName"), + "accountProvider": obj.get("accountProvider"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "currency": obj.get("currency"), + "currentBalance": obj.get("currentBalance"), + "identifiers": AccountIdentifiers.from_dict(obj["identifiers"]) if obj.get("identifiers") is not None else None + }) + return _obj + + + + + +class AccountTypedDict(TypedDict): + """TypedDict variant of Account, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + source_ref: NotRequired[Optional[SourceRefTypedDict]] + platform_name: NotRequired[Optional[str]] + account_provider: NotRequired[Optional[str]] + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + current_balance: NotRequired[Optional[Decimal]] + identifiers: NotRequired[Optional[AccountIdentifiersTypedDict]] diff --git a/lending/src/codat_lending/models/account_transaction_line_record_ref.py b/lending/src/codat_lending/models/account_transaction_line_record_ref.py new file mode 100644 index 000000000..21505bff3 --- /dev/null +++ b/lending/src/codat_lending/models/account_transaction_line_record_ref.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.accounting_account_transaction_data_type import AccountingAccountTransactionDataType +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_lending.models._compat.accounttransactionlinerecordref import AccountTransactionLineRecordRefDataType +class AccountTransactionLineRecordRef(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} + """ + Links an account transaction line to the underlying record that created it. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' of the underlying record or data type.") + data_type: Optional[AccountTransactionLineRecordRefDataType] = Field(default=None, description="Name of underlying data type.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'creditNotes', 'directCosts', 'directIncomes', 'invoices', 'journalEntries', 'payments', 'transfers']): + raise ValueError("must be one of enum values ('bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'creditNotes', 'directCosts', 'directIncomes', 'invoices', 'journalEntries', 'payments', 'transfers')") + 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 AccountTransactionLineRecordRef 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 AccountTransactionLineRecordRef 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") + }) + return _obj + + + + + +class AccountTransactionLineRecordRefTypedDict(TypedDict): + """TypedDict variant of AccountTransactionLineRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[AccountTransactionLineRecordRefDataType]] diff --git a/lending/src/codat_lending/models/accounting_account_transaction_data_type.py b/lending/src/codat_lending/models/accounting_account_transaction_data_type.py new file mode 100644 index 000000000..8ad079343 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_account_transaction_data_type.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountingAccountTransactionDataType(str, Enum): + """AccountingAccountTransactionDataType enum (lifted from inline OAS enum).""" + BANK_TRANSACTIONS = 'bankTransactions' + BILL_CREDIT_NOTES = 'billCreditNotes' + BILL_PAYMENTS = 'billPayments' + BILLS = 'bills' + CREDIT_NOTES = 'creditNotes' + DIRECT_COSTS = 'directCosts' + DIRECT_INCOMES = 'directIncomes' + INVOICES = 'invoices' + JOURNAL_ENTRIES = 'journalEntries' + PAYMENTS = 'payments' + TRANSFERS = 'transfers' diff --git a/lending/src/codat_lending/models/accounting_account_transaction_status.py b/lending/src/codat_lending/models/accounting_account_transaction_status.py new file mode 100644 index 000000000..3549a7fdb --- /dev/null +++ b/lending/src/codat_lending/models/accounting_account_transaction_status.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountingAccountTransactionStatus(str, Enum): + """AccountingAccountTransactionStatus enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + UNRECONCILED = 'Unreconciled' + RECONCILED = 'Reconciled' + VOID = 'Void' diff --git a/lending/src/codat_lending/models/accounting_bill_payment_all_of_payment_method_ref.py b/lending/src/codat_lending/models/accounting_bill_payment_all_of_payment_method_ref.py new file mode 100644 index 000000000..6435c745b --- /dev/null +++ b/lending/src/codat_lending/models/accounting_bill_payment_all_of_payment_method_ref.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from codat_lending.models.shared.paymentmethodref import PaymentMethodRef as AccountingBillPaymentAllOfPaymentMethodRef, PaymentMethodRefTypedDict as AccountingBillPaymentAllOfPaymentMethodRefTypedDict + +__all__ = ["AccountingBillPaymentAllOfPaymentMethodRef", "AccountingBillPaymentAllOfPaymentMethodRefTypedDict"] diff --git a/lending/src/codat_lending/models/accounting_bill_payment_all_of_supplier_ref.py b/lending/src/codat_lending/models/accounting_bill_payment_all_of_supplier_ref.py new file mode 100644 index 000000000..ebd97d702 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_bill_payment_all_of_supplier_ref.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from codat_lending.models.shared.supplierref import SupplierRef as AccountingBillPaymentAllOfSupplierRef, SupplierRefTypedDict as AccountingBillPaymentAllOfSupplierRefTypedDict + +__all__ = ["AccountingBillPaymentAllOfSupplierRef", "AccountingBillPaymentAllOfSupplierRefTypedDict"] diff --git a/lending/src/codat_lending/models/accounting_create_account_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_account_response_all_of_data.py new file mode 100644 index 000000000..e154fe8a7 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_account_response_all_of_data.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountstatus import AccountStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.valid_data_type_links import ValidDataTypeLinks, ValidDataTypeLinksTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateAccountResponseAllOfData(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} + """ + AccountingCreateAccountResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the account, unique for the company.") + nominal_code: Optional[str] = Field(default=None, description="Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.", alias="nominalCode") + name: Optional[str] = Field(default=None, description="Name of the account.") + description: Optional[str] = Field(default=None, description="Description for the account.") + fully_qualified_category: Optional[str] = Field(default=None, description="Full category of the account. For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation.", alias="fullyQualifiedCategory") + fully_qualified_name: Optional[str] = Field(default=None, description="Full name of the account, for example: - `Cash On Hand` - `Rents Held In Trust` - `Fixed Asset`", alias="fullyQualifiedName") + 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.") + current_balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Current balance in the account.", alias="currentBalance") + type: Optional[str] = Field(default=None, description="The type of bank account e.g. Credit.") + status: Optional[AccountStatus] = None + is_bank_account: Optional[bool] = Field(default=None, description="Confirms whether the account is a bank account or not.", alias="isBankAccount") + valid_datatype_links: Optional[List[ValidDataTypeLinks]] = Field(default=None, description="The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).", alias="validDatatypeLinks") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + metadata: Optional[Metadata] = None + 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]] = ["id", "nominalCode", "name", "description", "fullyQualifiedCategory", "fullyQualifiedName", "currency", "currentBalance", "type", "status", "isBankAccount", "validDatatypeLinks", "supplementalData", "metadata", "modifiedDate", "sourceModifiedDate"] + + 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 AccountingCreateAccountResponseAllOfData 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 valid_datatype_links (list) + _items = [] + if self.valid_datatype_links: + for _item_valid_datatype_links in self.valid_datatype_links: + if _item_valid_datatype_links: + _items.append(_item_valid_datatype_links.to_dict()) + _dict['validDatatypeLinks'] = _items + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingCreateAccountResponseAllOfData 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"), + "nominalCode": obj.get("nominalCode"), + "name": obj.get("name"), + "description": obj.get("description"), + "fullyQualifiedCategory": obj.get("fullyQualifiedCategory"), + "fullyQualifiedName": obj.get("fullyQualifiedName"), + "currency": obj.get("currency"), + "currentBalance": obj.get("currentBalance"), + "type": obj.get("type"), + "status": obj.get("status"), + "isBankAccount": obj.get("isBankAccount"), + "validDatatypeLinks": [ValidDataTypeLinks.from_dict(_item) for _item in obj["validDatatypeLinks"]] if obj.get("validDatatypeLinks") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + return _obj + + + + + +class AccountingCreateAccountResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreateAccountResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + nominal_code: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + fully_qualified_category: NotRequired[Optional[str]] + fully_qualified_name: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + current_balance: NotRequired[Optional[Decimal]] + type: NotRequired[Optional[str]] + status: NotRequired[Optional[AccountStatus]] + is_bank_account: NotRequired[Optional[bool]] + valid_datatype_links: NotRequired[Optional[List[ValidDataTypeLinksTypedDict]]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + metadata: NotRequired[Optional[MetadataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/accounting_create_bank_account_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_bank_account_response_all_of_data.py new file mode 100644 index 000000000..198f9504d --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_bank_account_response_all_of_data.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from codat_lending.models.shared.bankaccountstatus import BankAccountStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateBankAccountResponseAllOfData(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} + """ + AccountingCreateBankAccountResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the account, unique for the company in the accounting software.") + account_name: Optional[str] = Field(default=None, description="Name of the bank account in the accounting software.", alias="accountName") + account_type: Optional[AccountingBankAccountType] = Field(default=None, 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 + 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]] = ["id", "accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "status", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + 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 AccountingCreateBankAccountResponseAllOfData 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 AccountingCreateBankAccountResponseAllOfData 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"), + "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"), + "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 AccountingCreateBankAccountResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreateBankAccountResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[AccountingBankAccountType]] + 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]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/accounting_create_bank_transactions_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_bank_transactions_response_all_of_data.py new file mode 100644 index 000000000..083b1d51e --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_bank_transactions_response_all_of_data.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from codat_lending.models.accountingcreatebankaccounttransactions import AccountingCreateBankAccountTransactions as AccountingCreateBankTransactionsResponseAllOfData, AccountingCreateBankAccountTransactionsTypedDict as AccountingCreateBankTransactionsResponseAllOfDataTypedDict + +__all__ = ["AccountingCreateBankTransactionsResponseAllOfData", "AccountingCreateBankTransactionsResponseAllOfDataTypedDict"] diff --git a/lending/src/codat_lending/models/accounting_create_direct_cost_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_direct_cost_response_all_of_data.py new file mode 100644 index 000000000..c50675ae3 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_direct_cost_response_all_of_data.py @@ -0,0 +1,174 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateDirectCostResponseAllOfData(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} + """ + AccountingCreateDirectCostResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier of the direct cost, unique for the company.") + reference: Optional[str] = Field(default=None, description="User-friendly reference for the direct cost.") + note: Optional[str] = Field(default=None, description="A note attached to the direct cost.") + contact_ref: Optional[ContactRef] = Field(default=None, description="A customer or supplier associated with the direct cost.", alias="contactRef") + issue_date: 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="issueDate") + 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.") + currency_rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: List[DirectCostLineItem] = Field(description="An array of line items.", alias="lineItems") + payment_allocations: List[AccountingPaymentAllocation] = Field(description="An array of payment allocations.", alias="paymentAllocations") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of the direct costs, excluding any taxes.", alias="subTotal") + tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of tax on the direct costs.", alias="taxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The amount of the direct costs, inclusive of tax.", alias="totalAmount") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + metadata: Optional[Metadata] = None + 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]] = ["id", "reference", "note", "contactRef", "issueDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "subTotal", "taxAmount", "totalAmount", "supplementalData", "metadata", "modifiedDate", "sourceModifiedDate"] + + 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 AccountingCreateDirectCostResponseAllOfData 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 contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingCreateDirectCostResponseAllOfData 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"), + "reference": obj.get("reference"), + "note": obj.get("note"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "issueDate": obj.get("issueDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [DirectCostLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + return _obj + + + + + +class AccountingCreateDirectCostResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreateDirectCostResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + reference: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + issue_date: NotRequired[str] + currency: NotRequired[str] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[List[DirectCostLineItemTypedDict]] + payment_allocations: NotRequired[List[AccountingPaymentAllocationTypedDict]] + sub_total: NotRequired[Decimal] + tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + metadata: NotRequired[Optional[MetadataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/accounting_create_payment_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_payment_response_all_of_data.py new file mode 100644 index 000000000..35fbc3998 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_payment_response_all_of_data.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.paymentline import PaymentLine, PaymentLineTypedDict +from codat_lending.models.shared.paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreatePaymentResponseAllOfData(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} + """ + AccountingCreatePaymentResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the payment, unique to the company in the accounting software.") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, description="Customer the payment is recorded against in the accounting software.", alias="customerRef") + account_ref: Optional[AccountRef] = Field(default=None, description="Account the payment is recorded against in the accounting software.", alias="accountRef") + payment_method_ref: Optional[PaymentMethodRef] = Field(default=None, description="The Payment Method to which the payment is linked in the accounting software.", alias="paymentMethodRef") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.", alias="totalAmount") + 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.") + currency_rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + date_: 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="date") + note: Optional[str] = Field(default=None, description="Any additional information associated with the payment.") + lines: Optional[List[PaymentLine]] = Field(default=None, description="An array of payment lines.") + reference: Optional[str] = Field(default=None, description="Friendly reference for the payment.") + 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]] = ["id", "customerRef", "accountRef", "paymentMethodRef", "totalAmount", "currency", "currencyRate", "date", "note", "lines", "reference", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + 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 AccountingCreatePaymentResponseAllOfData 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 customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment_method_ref + if self.payment_method_ref: + _dict['paymentMethodRef'] = self.payment_method_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in lines (list) + _items = [] + if self.lines: + for _item_lines in self.lines: + if _item_lines: + _items.append(_item_lines.to_dict()) + _dict['lines'] = _items + # 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 AccountingCreatePaymentResponseAllOfData 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"), + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "paymentMethodRef": PaymentMethodRef.from_dict(obj["paymentMethodRef"]) if obj.get("paymentMethodRef") is not None else None, + "totalAmount": obj.get("totalAmount"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "date": obj.get("date"), + "note": obj.get("note"), + "lines": [PaymentLine.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None, + "reference": obj.get("reference"), + "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 AccountingCreatePaymentResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreatePaymentResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + payment_method_ref: NotRequired[Optional[PaymentMethodRefTypedDict]] + total_amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + date_: NotRequired[str] + note: NotRequired[Optional[str]] + lines: NotRequired[Optional[List[PaymentLineTypedDict]]] + reference: 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/lending/src/codat_lending/models/accounting_create_supplier_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_supplier_response_all_of_data.py new file mode 100644 index 000000000..a8b1f84dd --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_supplier_response_all_of_data.py @@ -0,0 +1,155 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.supplierstatus import SupplierStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateSupplierResponseAllOfData(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} + """ + AccountingCreateSupplierResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the supplier, unique to the company in the accounting software.") + supplier_name: Optional[str] = Field(default=None, description="Name of the supplier as recorded in the accounting system, typically the company name.", alias="supplierName") + contact_name: Optional[str] = Field(default=None, description="Name of the main contact for the supplier.", alias="contactName") + email_address: Optional[str] = Field(default=None, description="Email address that the supplier may be contacted on.", alias="emailAddress") + phone: Optional[str] = Field(default=None, description="Phone number that the supplier may be contacted on.") + addresses: Optional[List[AccountingAddress]] = Field(default=None, description="An array of Addresses.") + registration_number: Optional[str] = Field(default=None, description="Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.", alias="registrationNumber") + tax_number: Optional[str] = Field(default=None, description="Supplier's company tax number.", alias="taxNumber") + status: SupplierStatus + default_currency: Optional[str] = Field(default=None, description="Default currency the supplier's transactional data is recorded in.", alias="defaultCurrency") + 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]] = ["id", "supplierName", "contactName", "emailAddress", "phone", "addresses", "registrationNumber", "taxNumber", "status", "defaultCurrency", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + 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 AccountingCreateSupplierResponseAllOfData 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 addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + # 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 AccountingCreateSupplierResponseAllOfData 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"), + "supplierName": obj.get("supplierName"), + "contactName": obj.get("contactName"), + "emailAddress": obj.get("emailAddress"), + "phone": obj.get("phone"), + "addresses": [AccountingAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "registrationNumber": obj.get("registrationNumber"), + "taxNumber": obj.get("taxNumber"), + "status": obj.get("status"), + "defaultCurrency": obj.get("defaultCurrency"), + "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 AccountingCreateSupplierResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreateSupplierResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + supplier_name: NotRequired[Optional[str]] + contact_name: NotRequired[Optional[str]] + email_address: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[AccountingAddressTypedDict]]] + registration_number: NotRequired[Optional[str]] + tax_number: NotRequired[Optional[str]] + status: SupplierStatus + default_currency: 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/lending/src/codat_lending/models/accounting_create_transfer_response.py b/lending/src/codat_lending/models/accounting_create_transfer_response.py new file mode 100644 index 000000000..3a1f49fa9 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_transfer_response.py @@ -0,0 +1,171 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateTransferResponse(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _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) + } + """ + AccountingCreateTransferResponse + """ # 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="Available data types", 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[AccountingCreateTransferResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + 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 AccountingCreateTransferResponse 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 AccountingCreateTransferResponse 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": AccountingCreateTransferResponseAllOfData.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj + + + + + +class AccountingCreateTransferResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateTransferResponse, 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[AccountingCreateTransferResponseAllOfData]] diff --git a/lending/src/codat_lending/models/accounting_create_transfer_response_all_of_data.py b/lending/src/codat_lending/models/accounting_create_transfer_response_all_of_data.py new file mode 100644 index 000000000..6f66667d9 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_create_transfer_response_all_of_data.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.status import Status +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_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from codat_lending.models.shared.transferaccount import TransferAccount, TransferAccountTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateTransferResponseAllOfData(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} + """ + AccountingCreateTransferResponseAllOfData + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for the transfer.") + description: Optional[str] = Field(default=None, description="Description of the transfer.") + contact_ref: Optional[ContactRef] = Field(default=None, description="The customer or supplier for the transfer, if available.", alias="contactRef") + 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="date") + from_: Optional[TransferAccount] = Field(default=None, description="The details of the accounts the transfer is moving from.", alias="from") + to: Optional[TransferAccount] = Field(default=None, description="The details of the accounts the transfer is moving to.") + status: Optional[str] = Field(default=None, description="The status of the transfer in the account") + tracking_category_refs: Optional[List[TrackingCategoryRef]] = Field(default=None, description="Reference to the tracking categories this transfer is being tracked against.", alias="trackingCategoryRefs") + deposited_record_refs: Optional[List[AccountingRecordRef]] = Field(default=None, description="List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.", alias="depositedRecordRefs") + 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]] = ["id", "description", "contactRef", "date", "from", "to", "status", "trackingCategoryRefs", "depositedRecordRefs", "metadata", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Unreconciled', 'Reconciled', 'Void']): + raise ValueError("must be one of enum values ('Unknown', 'Unreconciled', 'Reconciled', 'Void')") + 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 AccountingCreateTransferResponseAllOfData 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 contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_from + if self.from_: + _dict['from'] = self.from_.to_dict() + # override the default output from pydantic by calling `to_dict()` of to + if self.to: + _dict['to'] = self.to.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in deposited_record_refs (list) + _items = [] + if self.deposited_record_refs: + for _item_deposited_record_refs in self.deposited_record_refs: + if _item_deposited_record_refs: + _items.append(_item_deposited_record_refs.to_dict()) + _dict['depositedRecordRefs'] = _items + # 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 AccountingCreateTransferResponseAllOfData 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"), + "description": obj.get("description"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "date": obj.get("date"), + "from": TransferAccount.from_dict(obj["from"]) if obj.get("from") is not None else None, + "to": TransferAccount.from_dict(obj["to"]) if obj.get("to") is not None else None, + "status": obj.get("status"), + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "depositedRecordRefs": [AccountingRecordRef.from_dict(_item) for _item in obj["depositedRecordRefs"]] if obj.get("depositedRecordRefs") is not None else None, + "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 AccountingCreateTransferResponseAllOfDataTypedDict(TypedDict): + """TypedDict variant of AccountingCreateTransferResponseAllOfData, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + date_: NotRequired[Optional[str]] + from_: NotRequired[Optional[TransferAccountTypedDict]] + to: NotRequired[Optional[TransferAccountTypedDict]] + status: NotRequired[Optional[str]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + deposited_record_refs: NotRequired[Optional[List[AccountingRecordRefTypedDict]]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/accounting_invoice_data_type.py b/lending/src/codat_lending/models/accounting_invoice_data_type.py new file mode 100644 index 000000000..cdadba563 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_invoice_data_type.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountingInvoiceDataType(str, Enum): + """AccountingInvoiceDataType enum (lifted from inline OAS enum).""" + SALES_ORDERS = 'salesOrders' diff --git a/lending/src/codat_lending/models/accounting_journal_entry_data_type.py b/lending/src/codat_lending/models/accounting_journal_entry_data_type.py new file mode 100644 index 000000000..4aa00b7d6 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_journal_entry_data_type.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountingJournalEntryDataType(str, Enum): + """AccountingJournalEntryDataType enum (lifted from inline OAS enum).""" + CUSTOMERS = 'customers' + SUPPLIERS = 'suppliers' diff --git a/lending/src/codat_lending/models/accounting_payment_allocation_allocation.py b/lending/src/codat_lending/models/accounting_payment_allocation_allocation.py new file mode 100644 index 000000000..e20d7fa99 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_payment_allocation_allocation.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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 AccountingPaymentAllocationAllocation(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} + """ + AccountingPaymentAllocationAllocation + """ # noqa: E501 + 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.") + currency_rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + allocated_on_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="allocatedOnDate") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total amount that has been allocated.", alias="totalAmount") + __properties: ClassVar[List[str]] = ["currency", "currencyRate", "allocatedOnDate", "totalAmount"] + + 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 AccountingPaymentAllocationAllocation 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 AccountingPaymentAllocationAllocation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "allocatedOnDate": obj.get("allocatedOnDate"), + "totalAmount": obj.get("totalAmount") + }) + return _obj + + + + + +class AccountingPaymentAllocationAllocationTypedDict(TypedDict): + """TypedDict variant of AccountingPaymentAllocationAllocation, for dict-literal request/response inputs.""" + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + allocated_on_date: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/accounting_payment_method.py b/lending/src/codat_lending/models/accounting_payment_method.py new file mode 100644 index 000000000..4f5f6f6c4 --- /dev/null +++ b/lending/src/codat_lending/models/accounting_payment_method.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.payment_method_type import PaymentMethodType +from codat_lending.models.shared.status import Status +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingPaymentMethod(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} + """ + ## Overview A Payment Method represents the payment method(s) used to pay a Bill. Payment Methods are referenced on [Bill Payments](https://docs.codat.io/lending-api#/schemas/BillPayment) and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Unique identifier for the payment method.") + name: Optional[str] = Field(default=None, description="Name of the payment method.") + type: Optional[PaymentMethodType] = None + status: Optional[Status] = None + metadata: Optional[Metadata] = None + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "type", "status", "metadata"] + + 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 AccountingPaymentMethod 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() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "status": obj.get("status"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + + + + +class AccountingPaymentMethodTypedDict(TypedDict): + """TypedDict variant of AccountingPaymentMethod, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + type: NotRequired[Optional[PaymentMethodType]] + status: NotRequired[Optional[Status]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/accounting_tracking_category.py b/lending/src/codat_lending/models/accounting_tracking_category.py new file mode 100644 index 000000000..a19871c7c --- /dev/null +++ b/lending/src/codat_lending/models/accounting_tracking_category.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.status import Status +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingTrackingCategory(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} + """ + Details of a category used for tracking transactions. > Language tip > > Parameters used to track types of spend in various parts of an organization can be called **dimensions**, **projects**, **classes**, or **locations** in different accounting software. In Codat, we refer to these as tracking categories. ## Overview Tracking categories are used to monitor cost centres and control budgets that sit outside the standard chart of accounts. Customers may use tracking categories to group together and track the income and costs of specific departments, projects, locations or customers. From their accounting system, customers can: - Create and maintain tracking categories and tracking category types. - View all tracking categories that are available for use. - View the relationships between the categories. - Assign invoices, bills, credit notes, or bill credit notes to one or more categories. - View the categories that a transaction belongs to. - View all transactions in a tracking category. ### Tracking categories per platform Review the platform-specific tracking categories that Codat supports, and the level they are assigned to in the source platform.
Platform Tracking category Tracking level
Dynamics 365 Dimensions Line item
Freshbooks Expense categories Line item
MYOB Categories Transaction
Netsuite Classes Line item
Locations Line item
Departments Line item
Custom segments Line item
QuickBooks Desktop Classes Line item or transaction level
Locations Transaction
QuickBooks Online Classes Line item or transaction level
Locations Transaction
Sage 200 Cost centers Line item
Departments Line item
Analysis codes Transaction
Sage 50 Departments Line item
Costcodes Line item
Projects Line item
Sage Intacct Dimensions Line item
Xero Tracking categories Line item
> **Example use case** > > Monitor the budget for your annual conference using a tracking category called 'AnnualConference2020' with the **type** set to **Costing**. If a tracking category has a parent category, the ID of that parent category is displayed. There is also a `hasChildren` field that shows whether there are child subcategories nested beneath. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="The identifier for the item, unique per tracking category.") + name: Optional[str] = Field(default=None, description="The name of the tracking category.") + status: Optional[Status] = None + parent_id: Optional[str] = Field(default=None, description="The identifier for this item's immediate parent.", alias="parentId") + has_children: Optional[bool] = Field(default=None, description="Boolean value indicating whether this category has SubCategories.", alias="hasChildren") + metadata: Optional[Metadata] = None + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "status", "parentId", "hasChildren", "metadata"] + + 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 AccountingTrackingCategory 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() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingTrackingCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "status": obj.get("status"), + "parentId": obj.get("parentId"), + "hasChildren": obj.get("hasChildren"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj + + + + + +class AccountingTrackingCategoryTypedDict(TypedDict): + """TypedDict variant of AccountingTrackingCategory, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + status: NotRequired[Optional[Status]] + parent_id: NotRequired[Optional[str]] + has_children: NotRequired[Optional[bool]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/accounting_transfer_status.py b/lending/src/codat_lending/models/accounting_transfer_status.py new file mode 100644 index 000000000..b6239b0bf --- /dev/null +++ b/lending/src/codat_lending/models/accounting_transfer_status.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +from enum import Enum + + +class AccountingTransferStatus(str, Enum): + """AccountingTransferStatus enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + UNRECONCILED = 'Unreconciled' + RECONCILED = 'Reconciled' + VOID = 'Void' diff --git a/lending/src/codat_lending/models/accountingcreatebankaccounttransactions.py b/lending/src/codat_lending/models/accountingcreatebankaccounttransactions.py new file mode 100644 index 000000000..08b04aa6e --- /dev/null +++ b/lending/src/codat_lending/models/accountingcreatebankaccounttransactions.py @@ -0,0 +1,30 @@ +"""Accounting create-bank-account-transactions response. Synthesized to match Speakeasy's shared surface.""" +from __future__ import annotations +from typing import Optional, List +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict +from codat_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransaction, CreateBankAccountTransactionTypedDict + + +class AccountingCreateBankAccountTransactionsTypedDict(TypedDict): + account_id: NotRequired[Optional[str]] + transactions: NotRequired[Optional[List[CreateBankAccountTransactionTypedDict]]] + + +class AccountingCreateBankAccountTransactions(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} + + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) + + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + + account_id: Optional[str] = Field(default=None, alias="accountId") + transactions: Optional[List[CreateBankAccountTransaction]] = None + + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/bank_account_prototype.py b/lending/src/codat_lending/models/bank_account_prototype.py new file mode 100644 index 000000000..1df5e339e --- /dev/null +++ b/lending/src/codat_lending/models/bank_account_prototype.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from codat_lending.models.shared.bankaccountstatus import BankAccountStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class BankAccountPrototype(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} + """ + BankAccountPrototype + """ # noqa: E501 + account_name: Optional[str] = Field(default=None, description="Name of the bank account in the accounting software.", alias="accountName") + account_type: Optional[AccountingBankAccountType] = Field(default=None, 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 + __properties: ClassVar[List[str]] = ["accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "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 BankAccountPrototype 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 BankAccountPrototype 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") + }) + return _obj + + + + + +class BankAccountPrototypeTypedDict(TypedDict): + """TypedDict variant of BankAccountPrototype, for dict-literal request/response inputs.""" + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[AccountingBankAccountType]] + 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/lending/src/codat_lending/models/bill_line_item.py b/lending/src/codat_lending/models/bill_line_item.py new file mode 100644 index 000000000..d49d37684 --- /dev/null +++ b/lending/src/codat_lending/models/bill_line_item.py @@ -0,0 +1,182 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountspayabletracking import AccountsPayableTracking, AccountsPayableTrackingTypedDict +from codat_lending.models.bill_line_item_purchase_order_line_ref import BillLineItemPurchaseOrderLineRef, BillLineItemPurchaseOrderLineRefTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BillLineItem(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'lineNumber', 'line_number', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs', 'unitOfMeasurement', 'unit_of_measurement'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + BillLineItem + """ # noqa: E501 + line_number: OptionalNullable[str] = Field(default=UNSET, description="The bill line's number.", alias="lineNumber") + description: OptionalNullable[str] = Field(default=UNSET, description="Friendly name of the goods or services received.") + unit_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Price of each unit of goods or services.", alias="unitAmount") + quantity: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Number of units of goods or services received.") + unit_of_measurement: OptionalNullable[str] = Field(default=UNSET, description="The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').", alias="unitOfMeasurement") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Numerical value of any discounts applied. Do not use to apply discounts in Oracle NetSuite—see Oracle NetSuite integration reference.", alias="discountAmount") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of the line, inclusive of discounts but exclusive of tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of tax for the line.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the line, including tax.", alias="totalAmount") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Percentage rate of any discount applied to the bill.", alias="discountPercentage") + account_ref: Optional[AccountRef] = Field(default=None, description="Reference to the account to which the line item is linked.", alias="accountRef") + tax_rate_ref: Optional[TaxRateRef] = Field(default=None, description="Reference to the tax rate to which the line item is linked.", alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, description="Reference to the product, service type, or inventory item to which the line item is linked.", alias="itemRef") + purchase_order_line_ref: Optional[BillLineItemPurchaseOrderLineRef] = Field(default=None, alias="purchaseOrderLineRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Collection of categories against which this item is tracked.", alias="trackingCategoryRefs") + tracking: Optional[AccountsPayableTracking] = None + is_direct_cost: Optional[bool] = Field(default=None, description="The bill is a direct cost if `True`.", alias="isDirectCost") + __properties: ClassVar[List[str]] = ["lineNumber", "description", "unitAmount", "quantity", "unitOfMeasurement", "discountAmount", "subTotal", "taxAmount", "totalAmount", "discountPercentage", "accountRef", "taxRateRef", "itemRef", "purchaseOrderLineRef", "trackingCategoryRefs", "tracking", "isDirectCost"] + + 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 BillLineItem 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_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of purchase_order_line_ref + if self.purchase_order_line_ref: + _dict['purchaseOrderLineRef'] = self.purchase_order_line_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BillLineItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "lineNumber": obj.get("lineNumber"), + "description": obj.get("description"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "unitOfMeasurement": obj.get("unitOfMeasurement"), + "discountAmount": obj.get("discountAmount"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "discountPercentage": obj.get("discountPercentage"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "taxRateRef": TaxRateRef.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "purchaseOrderLineRef": BillLineItemPurchaseOrderLineRef.from_dict(obj["purchaseOrderLineRef"]) if obj.get("purchaseOrderLineRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "tracking": AccountsPayableTracking.from_dict(obj["tracking"]) if obj.get("tracking") is not None else None, + "isDirectCost": obj.get("isDirectCost") + }) + return _obj + + + + + +class BillLineItemTypedDict(TypedDict): + """TypedDict variant of BillLineItem, for dict-literal request/response inputs.""" + line_number: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Optional[Decimal]] + quantity: NotRequired[Optional[Decimal]] + unit_of_measurement: NotRequired[Optional[str]] + discount_amount: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + discount_percentage: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + tax_rate_ref: NotRequired[Optional[TaxRateRefTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + purchase_order_line_ref: NotRequired[Optional[BillLineItemPurchaseOrderLineRefTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + tracking: NotRequired[Optional[AccountsPayableTrackingTypedDict]] + is_direct_cost: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref.py b/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref.py new file mode 100644 index 000000000..2302433a2 --- /dev/null +++ b/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from codat_lending.models.record_line_reference import RecordLineReference as BillLineItemPurchaseOrderLineRef, RecordLineReferenceTypedDict as BillLineItemPurchaseOrderLineRefTypedDict + +__all__ = ["BillLineItemPurchaseOrderLineRef", "BillLineItemPurchaseOrderLineRefTypedDict"] diff --git a/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref_data_type.py b/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref_data_type.py new file mode 100644 index 000000000..f95c18bb9 --- /dev/null +++ b/lending/src/codat_lending/models/bill_line_item_purchase_order_line_ref_data_type.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class BillLineItemPurchaseOrderLineRefDataType(str, Enum): + """BillLineItemPurchaseOrderLineRefDataType enum (lifted from inline OAS enum).""" + PURCHASE_ORDERS = 'purchaseOrders' + BILLS = 'bills' diff --git a/lending/src/codat_lending/models/cash_flow_transaction.py b/lending/src/codat_lending/models/cash_flow_transaction.py new file mode 100644 index 000000000..339d59d3a --- /dev/null +++ b/lending/src/codat_lending/models/cash_flow_transaction.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.sourceref import SourceRef, SourceRefTypedDict +from codat_lending.models.shared.transactioncategory import TransactionCategory, TransactionCategoryTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class CashFlowTransaction(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'isRecurring', 'is_recurring'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + CashFlowTransaction + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The unique identifier of the bank transaction.") + 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="date") + description: Optional[str] = Field(default=None, description="The description of the bank transaction.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The bank transaction amount.") + 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.") + transaction_category: Optional[TransactionCategory] = Field(default=None, description="Contains an array of category levels.", alias="transactionCategory") + platform_name: Optional[str] = Field(default=None, description="Returns the payment processor responsible for the transaction.", alias="platformName") + counterparty_names: Optional[List[str]] = Field(default=None, description="An array of counterparty names involved in the transaction.", alias="counterpartyNames") + source_ref: Optional[SourceRef] = Field(default=None, alias="sourceRef") + account_ref: Optional[AccountRef] = Field(default=None, alias="accountRef") + 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") + is_recurring: OptionalNullable[bool] = Field(default=UNSET, description="Indicates if the transaction is classified as recurring by Codat's categorization engine.", alias="isRecurring") + __properties: ClassVar[List[str]] = ["id", "date", "description", "amount", "currency", "transactionCategory", "platformName", "counterpartyNames", "sourceRef", "accountRef", "modifiedDate", "isRecurring"] + + 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 CashFlowTransaction 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 transaction_category + if self.transaction_category: + _dict['transactionCategory'] = self.transaction_category.to_dict() + # override the default output from pydantic by calling `to_dict()` of source_ref + if self.source_ref: + _dict['sourceRef'] = self.source_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CashFlowTransaction 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"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "transactionCategory": TransactionCategory.from_dict(obj["transactionCategory"]) if obj.get("transactionCategory") is not None else None, + "platformName": obj.get("platformName"), + "counterpartyNames": obj.get("counterpartyNames"), + "sourceRef": SourceRef.from_dict(obj["sourceRef"]) if obj.get("sourceRef") is not None else None, + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "isRecurring": obj.get("isRecurring") + }) + return _obj + + + + + +class CashFlowTransactionTypedDict(TypedDict): + """TypedDict variant of CashFlowTransaction, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + transaction_category: NotRequired[Optional[TransactionCategoryTypedDict]] + platform_name: NotRequired[Optional[str]] + counterparty_names: NotRequired[Optional[List[str]]] + source_ref: NotRequired[Optional[SourceRefTypedDict]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + modified_date: NotRequired[Optional[str]] + is_recurring: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/categorized_bank_statement_accounts.py b/lending/src/codat_lending/models/categorized_bank_statement_accounts.py new file mode 100644 index 000000000..0a1befee5 --- /dev/null +++ b/lending/src/codat_lending/models/categorized_bank_statement_accounts.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.account import Account, AccountTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class CategorizedBankStatementAccounts(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} + """ + > **Categorization engine** > > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. The Enhanced Cash Flow accounts endpoint provides a list of accounts that categorized transactions have been taken from. + """ # 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[Account]] = 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 CategorizedBankStatementAccounts 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 CategorizedBankStatementAccounts 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": [Account.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + + + + +class CategorizedBankStatementAccountsTypedDict(TypedDict): + """TypedDict variant of CategorizedBankStatementAccounts, 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[AccountTypedDict]]] diff --git a/lending/src/codat_lending/models/categorized_bank_statement_transactions.py b/lending/src/codat_lending/models/categorized_bank_statement_transactions.py new file mode 100644 index 000000000..e408d9631 --- /dev/null +++ b/lending/src/codat_lending/models/categorized_bank_statement_transactions.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.cash_flow_transaction import CashFlowTransaction, CashFlowTransactionTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class CategorizedBankStatementTransactions(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} + """ + > **Categorization engine** > > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. + """ # 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[CashFlowTransaction]] = 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 CategorizedBankStatementTransactions 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 CategorizedBankStatementTransactions 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": [CashFlowTransaction.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + + + + +class CategorizedBankStatementTransactionsTypedDict(TypedDict): + """TypedDict variant of CategorizedBankStatementTransactions, 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[CashFlowTransactionTypedDict]]] diff --git a/lending/src/codat_lending/models/commerce_payment_method_status.py b/lending/src/codat_lending/models/commerce_payment_method_status.py new file mode 100644 index 000000000..9706ce73c --- /dev/null +++ b/lending/src/codat_lending/models/commerce_payment_method_status.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class CommercePaymentMethodStatus(str, Enum): + """CommercePaymentMethodStatus enum (lifted from inline OAS enum).""" + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' diff --git a/lending/src/codat_lending/models/commerce_report_dimension_items.py b/lending/src/codat_lending/models/commerce_report_dimension_items.py new file mode 100644 index 000000000..df36a54f2 --- /dev/null +++ b/lending/src/codat_lending/models/commerce_report_dimension_items.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 CommerceReportDimensionItems(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} + """ + CommerceReportDimensionItems + """ # noqa: E501 + index: Optional[int] = Field(default=None, description="The dimension's items index.") + __properties: ClassVar[List[str]] = ["index"] + + 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 CommerceReportDimensionItems 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 CommerceReportDimensionItems from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index") + }) + return _obj + + + + + +class CommerceReportDimensionItemsTypedDict(TypedDict): + """TypedDict variant of CommerceReportDimensionItems, for dict-literal request/response inputs.""" + index: NotRequired[Optional[int]] diff --git a/lending/src/codat_lending/models/commerce_tax_component.py b/lending/src/codat_lending/models/commerce_tax_component.py new file mode 100644 index 000000000..1714d8b61 --- /dev/null +++ b/lending/src/codat_lending/models/commerce_tax_component.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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 CommerceTaxComponent(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} + """ + The Tax Components endpoints return tax rates data from the commerce software, including tax rate names and values. This is to support the mapping of tax rates from the commerce software to those in the accounting software. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + 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") + name: Optional[str] = Field(default=None, description="Name of the Tax Rate Component in the source commerce software.") + rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Rate of taxation represented as a fraction of the net price (typically in the range 0.00 - 1.00).") + is_compound: Optional[bool] = Field(default=None, description="The Boolean flag to indicate when a Tax Rate Component compounds on a sale.", alias="isCompound") + __properties: ClassVar[List[str]] = ["id", "modifiedDate", "sourceModifiedDate", "name", "rate", "isCompound"] + + 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 CommerceTaxComponent 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 CommerceTaxComponent 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"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "name": obj.get("name"), + "rate": obj.get("rate"), + "isCompound": obj.get("isCompound") + }) + return _obj + + + + + +class CommerceTaxComponentTypedDict(TypedDict): + """TypedDict variant of CommerceTaxComponent, for dict-literal request/response inputs.""" + id: NotRequired[str] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + rate: NotRequired[Optional[Decimal]] + is_compound: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/company_details.py b/lending/src/codat_lending/models/company_details.py new file mode 100644 index 000000000..82e239957 --- /dev/null +++ b/lending/src/codat_lending/models/company_details.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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/lending/src/codat_lending/models/company_reference_links.py b/lending/src/codat_lending/models/company_reference_links.py new file mode 100644 index 000000000..0a50fdd18 --- /dev/null +++ b/lending/src/codat_lending/models/company_reference_links.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/contact_ref.py b/lending/src/codat_lending/models/contact_ref.py new file mode 100644 index 000000000..5b1555f19 --- /dev/null +++ b/lending/src/codat_lending/models/contact_ref.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.accounting_journal_entry_data_type import AccountingJournalEntryDataType +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 + +from codat_lending.models._compat.contactref import ContactRefDataType +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ContactRef(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'dataType', 'data_type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ContactRef + """ # noqa: E501 + id: str = Field(description="Unique identifier for a customer or supplier.") + data_type: OptionalNullable[ContactRefDataType] = Field(default=UNSET, description="Allowed name of the 'dataType'.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customers', 'suppliers']): + raise ValueError("must be one of enum values ('customers', 'suppliers')") + 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 ContactRef 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 ContactRef 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") + }) + return _obj + + + + + +class ContactRefTypedDict(TypedDict): + """TypedDict variant of ContactRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + data_type: NotRequired[Optional[ContactRefDataType]] diff --git a/lending/src/codat_lending/models/contact_reference.py b/lending/src/codat_lending/models/contact_reference.py new file mode 100644 index 000000000..b6a52d2d1 --- /dev/null +++ b/lending/src/codat_lending/models/contact_reference.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.accounting_journal_entry_data_type import AccountingJournalEntryDataType +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 + +from codat_lending.models._compat.journalline import JournalLineDataType +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ContactReference(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'dataType', 'data_type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ContactReference + """ # noqa: E501 + id: str = Field(description="Unique identifier for a customer or supplier.") + data_type: OptionalNullable[JournalLineDataType] = Field(default=UNSET, description="Allowed name of the 'dataType'.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customers', 'suppliers']): + raise ValueError("must be one of enum values ('customers', 'suppliers')") + 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 ContactReference 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 ContactReference 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") + }) + return _obj + + + + + +class ContactReferenceTypedDict(TypedDict): + """TypedDict variant of ContactReference, for dict-literal request/response inputs.""" + id: NotRequired[str] + data_type: NotRequired[Optional[JournalLineDataType]] diff --git a/lending/src/codat_lending/models/create_connection_request.py b/lending/src/codat_lending/models/create_connection_request.py new file mode 100644 index 000000000..671943042 --- /dev/null +++ b/lending/src/codat_lending/models/create_connection_request.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/create_source_account200_response.py b/lending/src/codat_lending/models/create_source_account200_response.py new file mode 100644 index 000000000..593b20254 --- /dev/null +++ b/lending/src/codat_lending/models/create_source_account200_response.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict +from codat_lending.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/lending/src/codat_lending/models/create_source_account_request.py b/lending/src/codat_lending/models/create_source_account_request.py new file mode 100644 index 000000000..03db139b5 --- /dev/null +++ b/lending/src/codat_lending/models/create_source_account_request.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.sourceaccountprototype import SourceAccountPrototype, SourceAccountPrototypeTypedDict +from codat_lending.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/lending/src/codat_lending/models/created_date.py b/lending/src/codat_lending/models/created_date.py new file mode 100644 index 000000000..ae46ef1d8 --- /dev/null +++ b/lending/src/codat_lending/models/created_date.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 CreatedDate(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} + """ + CreatedDate + """ # noqa: E501 + created_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="createdDate") + __properties: ClassVar[List[str]] = ["createdDate"] + + 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 CreatedDate 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 CreatedDate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "createdDate": obj.get("createdDate") + }) + return _obj + + + + + +class CreatedDateTypedDict(TypedDict): + """TypedDict variant of CreatedDate, for dict-literal request/response inputs.""" + created_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/current_status.py b/lending/src/codat_lending/models/current_status.py new file mode 100644 index 000000000..5f023c517 --- /dev/null +++ b/lending/src/codat_lending/models/current_status.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +from enum import Enum + + +class CurrentStatus(str, Enum): + """CurrentStatus 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/lending/src/codat_lending/models/data_integrity_type.py b/lending/src/codat_lending/models/data_integrity_type.py new file mode 100644 index 000000000..5e76455b5 --- /dev/null +++ b/lending/src/codat_lending/models/data_integrity_type.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 DataIntegrityType(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} + """ + DataIntegrityType + """ # noqa: E501 + type: Optional[str] = Field(default=None, description="The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.") + __properties: ClassVar[List[str]] = ["type"] + + 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 DataIntegrityType 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 DataIntegrityType 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") + }) + return _obj + + + + + +class DataIntegrityTypeTypedDict(TypedDict): + """TypedDict variant of DataIntegrityType, for dict-literal request/response inputs.""" + type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/data_statuses.py b/lending/src/codat_lending/models/data_statuses.py new file mode 100644 index 000000000..920b82435 --- /dev/null +++ b/lending/src/codat_lending/models/data_statuses.py @@ -0,0 +1,362 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.datastatus import DataStatus, DataStatusTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class DataStatuses(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} + """ + DataStatuses + """ # noqa: E501 + account_transactions: Optional[DataStatus] = Field(default=None, alias="accountTransactions") + balance_sheet: Optional[DataStatus] = Field(default=None, alias="balanceSheet") + bank_accounts: Optional[DataStatus] = Field(default=None, alias="bankAccounts") + bank_transactions: Optional[DataStatus] = Field(default=None, alias="bankTransactions") + bill_credit_notes: Optional[DataStatus] = Field(default=None, alias="billCreditNotes") + bill_payments: Optional[DataStatus] = Field(default=None, alias="billPayments") + bills: Optional[DataStatus] = None + cash_flow_statement: Optional[DataStatus] = Field(default=None, alias="cashFlowStatement") + chart_of_accounts: Optional[DataStatus] = Field(default=None, alias="chartOfAccounts") + company: Optional[DataStatus] = None + credit_notes: Optional[DataStatus] = Field(default=None, alias="creditNotes") + customers: Optional[DataStatus] = None + direct_costs: Optional[DataStatus] = Field(default=None, alias="directCosts") + direct_incomes: Optional[DataStatus] = Field(default=None, alias="directIncomes") + invoices: Optional[DataStatus] = None + item_receipts: Optional[DataStatus] = Field(default=None, alias="itemReceipts") + items: Optional[DataStatus] = None + journal_entries: Optional[DataStatus] = Field(default=None, alias="journalEntries") + journals: Optional[DataStatus] = None + payment_methods: Optional[DataStatus] = Field(default=None, alias="paymentMethods") + payments: Optional[DataStatus] = None + profit_and_loss: Optional[DataStatus] = Field(default=None, alias="profitAndLoss") + purchase_orders: Optional[DataStatus] = Field(default=None, alias="purchaseOrders") + sales_orders: Optional[DataStatus] = Field(default=None, alias="salesOrders") + suppliers: Optional[DataStatus] = None + tax_rates: Optional[DataStatus] = Field(default=None, alias="taxRates") + tracking_categories: Optional[DataStatus] = Field(default=None, alias="trackingCategories") + transfers: Optional[DataStatus] = None + banking_account_balances: Optional[DataStatus] = Field(default=None, alias="banking-accountBalances") + banking_accounts: Optional[DataStatus] = Field(default=None, alias="banking-accounts") + banking_transaction_categories: Optional[DataStatus] = Field(default=None, alias="banking-transactionCategories") + banking_transactions: Optional[DataStatus] = Field(default=None, alias="banking-transactions") + commerce_company_info: Optional[DataStatus] = Field(default=None, alias="commerce-companyInfo") + commerce_customers: Optional[DataStatus] = Field(default=None, alias="commerce-customers") + commerce_disputes: Optional[DataStatus] = Field(default=None, alias="commerce-disputes") + commerce_locations: Optional[DataStatus] = Field(default=None, alias="commerce-locations") + commerce_orders: Optional[DataStatus] = Field(default=None, alias="commerce-orders") + commerce_payment_methods: Optional[DataStatus] = Field(default=None, alias="commerce-paymentMethods") + commerce_payments: Optional[DataStatus] = Field(default=None, alias="commerce-payments") + commerce_product_categories: Optional[DataStatus] = Field(default=None, alias="commerce-productCategories") + commerce_products: Optional[DataStatus] = Field(default=None, alias="commerce-products") + commerce_tax_components: Optional[DataStatus] = Field(default=None, alias="commerce-taxComponents") + commerce_transactions: Optional[DataStatus] = Field(default=None, alias="commerce-transactions") + __properties: ClassVar[List[str]] = ["accountTransactions", "balanceSheet", "bankAccounts", "bankTransactions", "billCreditNotes", "billPayments", "bills", "cashFlowStatement", "chartOfAccounts", "company", "creditNotes", "customers", "directCosts", "directIncomes", "invoices", "itemReceipts", "items", "journalEntries", "journals", "paymentMethods", "payments", "profitAndLoss", "purchaseOrders", "salesOrders", "suppliers", "taxRates", "trackingCategories", "transfers", "banking-accountBalances", "banking-accounts", "banking-transactionCategories", "banking-transactions", "commerce-companyInfo", "commerce-customers", "commerce-disputes", "commerce-locations", "commerce-orders", "commerce-paymentMethods", "commerce-payments", "commerce-productCategories", "commerce-products", "commerce-taxComponents", "commerce-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 DataStatuses 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_transactions + if self.account_transactions: + _dict['accountTransactions'] = self.account_transactions.to_dict() + # override the default output from pydantic by calling `to_dict()` of balance_sheet + if self.balance_sheet: + _dict['balanceSheet'] = self.balance_sheet.to_dict() + # override the default output from pydantic by calling `to_dict()` of bank_accounts + if self.bank_accounts: + _dict['bankAccounts'] = self.bank_accounts.to_dict() + # override the default output from pydantic by calling `to_dict()` of bank_transactions + if self.bank_transactions: + _dict['bankTransactions'] = self.bank_transactions.to_dict() + # override the default output from pydantic by calling `to_dict()` of bill_credit_notes + if self.bill_credit_notes: + _dict['billCreditNotes'] = self.bill_credit_notes.to_dict() + # override the default output from pydantic by calling `to_dict()` of bill_payments + if self.bill_payments: + _dict['billPayments'] = self.bill_payments.to_dict() + # override the default output from pydantic by calling `to_dict()` of bills + if self.bills: + _dict['bills'] = self.bills.to_dict() + # override the default output from pydantic by calling `to_dict()` of cash_flow_statement + if self.cash_flow_statement: + _dict['cashFlowStatement'] = self.cash_flow_statement.to_dict() + # override the default output from pydantic by calling `to_dict()` of chart_of_accounts + if self.chart_of_accounts: + _dict['chartOfAccounts'] = self.chart_of_accounts.to_dict() + # override the default output from pydantic by calling `to_dict()` of company + if self.company: + _dict['company'] = self.company.to_dict() + # override the default output from pydantic by calling `to_dict()` of credit_notes + if self.credit_notes: + _dict['creditNotes'] = self.credit_notes.to_dict() + # override the default output from pydantic by calling `to_dict()` of customers + if self.customers: + _dict['customers'] = self.customers.to_dict() + # override the default output from pydantic by calling `to_dict()` of direct_costs + if self.direct_costs: + _dict['directCosts'] = self.direct_costs.to_dict() + # override the default output from pydantic by calling `to_dict()` of direct_incomes + if self.direct_incomes: + _dict['directIncomes'] = self.direct_incomes.to_dict() + # override the default output from pydantic by calling `to_dict()` of invoices + if self.invoices: + _dict['invoices'] = self.invoices.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_receipts + if self.item_receipts: + _dict['itemReceipts'] = self.item_receipts.to_dict() + # override the default output from pydantic by calling `to_dict()` of items + if self.items: + _dict['items'] = self.items.to_dict() + # override the default output from pydantic by calling `to_dict()` of journal_entries + if self.journal_entries: + _dict['journalEntries'] = self.journal_entries.to_dict() + # override the default output from pydantic by calling `to_dict()` of journals + if self.journals: + _dict['journals'] = self.journals.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment_methods + if self.payment_methods: + _dict['paymentMethods'] = self.payment_methods.to_dict() + # override the default output from pydantic by calling `to_dict()` of payments + if self.payments: + _dict['payments'] = self.payments.to_dict() + # override the default output from pydantic by calling `to_dict()` of profit_and_loss + if self.profit_and_loss: + _dict['profitAndLoss'] = self.profit_and_loss.to_dict() + # override the default output from pydantic by calling `to_dict()` of purchase_orders + if self.purchase_orders: + _dict['purchaseOrders'] = self.purchase_orders.to_dict() + # override the default output from pydantic by calling `to_dict()` of sales_orders + if self.sales_orders: + _dict['salesOrders'] = self.sales_orders.to_dict() + # override the default output from pydantic by calling `to_dict()` of suppliers + if self.suppliers: + _dict['suppliers'] = self.suppliers.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rates + if self.tax_rates: + _dict['taxRates'] = self.tax_rates.to_dict() + # override the default output from pydantic by calling `to_dict()` of tracking_categories + if self.tracking_categories: + _dict['trackingCategories'] = self.tracking_categories.to_dict() + # override the default output from pydantic by calling `to_dict()` of transfers + if self.transfers: + _dict['transfers'] = self.transfers.to_dict() + # override the default output from pydantic by calling `to_dict()` of banking_account_balances + if self.banking_account_balances: + _dict['banking-accountBalances'] = self.banking_account_balances.to_dict() + # override the default output from pydantic by calling `to_dict()` of banking_accounts + if self.banking_accounts: + _dict['banking-accounts'] = self.banking_accounts.to_dict() + # override the default output from pydantic by calling `to_dict()` of banking_transaction_categories + if self.banking_transaction_categories: + _dict['banking-transactionCategories'] = self.banking_transaction_categories.to_dict() + # override the default output from pydantic by calling `to_dict()` of banking_transactions + if self.banking_transactions: + _dict['banking-transactions'] = self.banking_transactions.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_company_info + if self.commerce_company_info: + _dict['commerce-companyInfo'] = self.commerce_company_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_customers + if self.commerce_customers: + _dict['commerce-customers'] = self.commerce_customers.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_disputes + if self.commerce_disputes: + _dict['commerce-disputes'] = self.commerce_disputes.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_locations + if self.commerce_locations: + _dict['commerce-locations'] = self.commerce_locations.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_orders + if self.commerce_orders: + _dict['commerce-orders'] = self.commerce_orders.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_payment_methods + if self.commerce_payment_methods: + _dict['commerce-paymentMethods'] = self.commerce_payment_methods.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_payments + if self.commerce_payments: + _dict['commerce-payments'] = self.commerce_payments.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_product_categories + if self.commerce_product_categories: + _dict['commerce-productCategories'] = self.commerce_product_categories.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_products + if self.commerce_products: + _dict['commerce-products'] = self.commerce_products.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_tax_components + if self.commerce_tax_components: + _dict['commerce-taxComponents'] = self.commerce_tax_components.to_dict() + # override the default output from pydantic by calling `to_dict()` of commerce_transactions + if self.commerce_transactions: + _dict['commerce-transactions'] = self.commerce_transactions.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataStatuses from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountTransactions": DataStatus.from_dict(obj["accountTransactions"]) if obj.get("accountTransactions") is not None else None, + "balanceSheet": DataStatus.from_dict(obj["balanceSheet"]) if obj.get("balanceSheet") is not None else None, + "bankAccounts": DataStatus.from_dict(obj["bankAccounts"]) if obj.get("bankAccounts") is not None else None, + "bankTransactions": DataStatus.from_dict(obj["bankTransactions"]) if obj.get("bankTransactions") is not None else None, + "billCreditNotes": DataStatus.from_dict(obj["billCreditNotes"]) if obj.get("billCreditNotes") is not None else None, + "billPayments": DataStatus.from_dict(obj["billPayments"]) if obj.get("billPayments") is not None else None, + "bills": DataStatus.from_dict(obj["bills"]) if obj.get("bills") is not None else None, + "cashFlowStatement": DataStatus.from_dict(obj["cashFlowStatement"]) if obj.get("cashFlowStatement") is not None else None, + "chartOfAccounts": DataStatus.from_dict(obj["chartOfAccounts"]) if obj.get("chartOfAccounts") is not None else None, + "company": DataStatus.from_dict(obj["company"]) if obj.get("company") is not None else None, + "creditNotes": DataStatus.from_dict(obj["creditNotes"]) if obj.get("creditNotes") is not None else None, + "customers": DataStatus.from_dict(obj["customers"]) if obj.get("customers") is not None else None, + "directCosts": DataStatus.from_dict(obj["directCosts"]) if obj.get("directCosts") is not None else None, + "directIncomes": DataStatus.from_dict(obj["directIncomes"]) if obj.get("directIncomes") is not None else None, + "invoices": DataStatus.from_dict(obj["invoices"]) if obj.get("invoices") is not None else None, + "itemReceipts": DataStatus.from_dict(obj["itemReceipts"]) if obj.get("itemReceipts") is not None else None, + "items": DataStatus.from_dict(obj["items"]) if obj.get("items") is not None else None, + "journalEntries": DataStatus.from_dict(obj["journalEntries"]) if obj.get("journalEntries") is not None else None, + "journals": DataStatus.from_dict(obj["journals"]) if obj.get("journals") is not None else None, + "paymentMethods": DataStatus.from_dict(obj["paymentMethods"]) if obj.get("paymentMethods") is not None else None, + "payments": DataStatus.from_dict(obj["payments"]) if obj.get("payments") is not None else None, + "profitAndLoss": DataStatus.from_dict(obj["profitAndLoss"]) if obj.get("profitAndLoss") is not None else None, + "purchaseOrders": DataStatus.from_dict(obj["purchaseOrders"]) if obj.get("purchaseOrders") is not None else None, + "salesOrders": DataStatus.from_dict(obj["salesOrders"]) if obj.get("salesOrders") is not None else None, + "suppliers": DataStatus.from_dict(obj["suppliers"]) if obj.get("suppliers") is not None else None, + "taxRates": DataStatus.from_dict(obj["taxRates"]) if obj.get("taxRates") is not None else None, + "trackingCategories": DataStatus.from_dict(obj["trackingCategories"]) if obj.get("trackingCategories") is not None else None, + "transfers": DataStatus.from_dict(obj["transfers"]) if obj.get("transfers") is not None else None, + "banking-accountBalances": DataStatus.from_dict(obj["banking-accountBalances"]) if obj.get("banking-accountBalances") is not None else None, + "banking-accounts": DataStatus.from_dict(obj["banking-accounts"]) if obj.get("banking-accounts") is not None else None, + "banking-transactionCategories": DataStatus.from_dict(obj["banking-transactionCategories"]) if obj.get("banking-transactionCategories") is not None else None, + "banking-transactions": DataStatus.from_dict(obj["banking-transactions"]) if obj.get("banking-transactions") is not None else None, + "commerce-companyInfo": DataStatus.from_dict(obj["commerce-companyInfo"]) if obj.get("commerce-companyInfo") is not None else None, + "commerce-customers": DataStatus.from_dict(obj["commerce-customers"]) if obj.get("commerce-customers") is not None else None, + "commerce-disputes": DataStatus.from_dict(obj["commerce-disputes"]) if obj.get("commerce-disputes") is not None else None, + "commerce-locations": DataStatus.from_dict(obj["commerce-locations"]) if obj.get("commerce-locations") is not None else None, + "commerce-orders": DataStatus.from_dict(obj["commerce-orders"]) if obj.get("commerce-orders") is not None else None, + "commerce-paymentMethods": DataStatus.from_dict(obj["commerce-paymentMethods"]) if obj.get("commerce-paymentMethods") is not None else None, + "commerce-payments": DataStatus.from_dict(obj["commerce-payments"]) if obj.get("commerce-payments") is not None else None, + "commerce-productCategories": DataStatus.from_dict(obj["commerce-productCategories"]) if obj.get("commerce-productCategories") is not None else None, + "commerce-products": DataStatus.from_dict(obj["commerce-products"]) if obj.get("commerce-products") is not None else None, + "commerce-taxComponents": DataStatus.from_dict(obj["commerce-taxComponents"]) if obj.get("commerce-taxComponents") is not None else None, + "commerce-transactions": DataStatus.from_dict(obj["commerce-transactions"]) if obj.get("commerce-transactions") is not None else None + }) + return _obj + + + + +# Speakeasy response-class alias — type-identical so isinstance() checks pass. +GetDataStatusDataStatuses = DataStatuses + + + +class DataStatusesTypedDict(TypedDict): + """TypedDict variant of DataStatuses, for dict-literal request/response inputs.""" + account_transactions: NotRequired[Optional[DataStatusTypedDict]] + balance_sheet: NotRequired[Optional[DataStatusTypedDict]] + bank_accounts: NotRequired[Optional[DataStatusTypedDict]] + bank_transactions: NotRequired[Optional[DataStatusTypedDict]] + bill_credit_notes: NotRequired[Optional[DataStatusTypedDict]] + bill_payments: NotRequired[Optional[DataStatusTypedDict]] + bills: NotRequired[Optional[DataStatusTypedDict]] + cash_flow_statement: NotRequired[Optional[DataStatusTypedDict]] + chart_of_accounts: NotRequired[Optional[DataStatusTypedDict]] + company: NotRequired[Optional[DataStatusTypedDict]] + credit_notes: NotRequired[Optional[DataStatusTypedDict]] + customers: NotRequired[Optional[DataStatusTypedDict]] + direct_costs: NotRequired[Optional[DataStatusTypedDict]] + direct_incomes: NotRequired[Optional[DataStatusTypedDict]] + invoices: NotRequired[Optional[DataStatusTypedDict]] + item_receipts: NotRequired[Optional[DataStatusTypedDict]] + items: NotRequired[Optional[DataStatusTypedDict]] + journal_entries: NotRequired[Optional[DataStatusTypedDict]] + journals: NotRequired[Optional[DataStatusTypedDict]] + payment_methods: NotRequired[Optional[DataStatusTypedDict]] + payments: NotRequired[Optional[DataStatusTypedDict]] + profit_and_loss: NotRequired[Optional[DataStatusTypedDict]] + purchase_orders: NotRequired[Optional[DataStatusTypedDict]] + sales_orders: NotRequired[Optional[DataStatusTypedDict]] + suppliers: NotRequired[Optional[DataStatusTypedDict]] + tax_rates: NotRequired[Optional[DataStatusTypedDict]] + tracking_categories: NotRequired[Optional[DataStatusTypedDict]] + transfers: NotRequired[Optional[DataStatusTypedDict]] + banking_account_balances: NotRequired[Optional[DataStatusTypedDict]] + banking_accounts: NotRequired[Optional[DataStatusTypedDict]] + banking_transaction_categories: NotRequired[Optional[DataStatusTypedDict]] + banking_transactions: NotRequired[Optional[DataStatusTypedDict]] + commerce_company_info: NotRequired[Optional[DataStatusTypedDict]] + commerce_customers: NotRequired[Optional[DataStatusTypedDict]] + commerce_disputes: NotRequired[Optional[DataStatusTypedDict]] + commerce_locations: NotRequired[Optional[DataStatusTypedDict]] + commerce_orders: NotRequired[Optional[DataStatusTypedDict]] + commerce_payment_methods: NotRequired[Optional[DataStatusTypedDict]] + commerce_payments: NotRequired[Optional[DataStatusTypedDict]] + commerce_product_categories: NotRequired[Optional[DataStatusTypedDict]] + commerce_products: NotRequired[Optional[DataStatusTypedDict]] + commerce_tax_components: NotRequired[Optional[DataStatusTypedDict]] + commerce_transactions: NotRequired[Optional[DataStatusTypedDict]] + +# Speakeasy TypedDict companions for response-class aliases. +GetDataStatusDataStatusesTypedDict = DataStatusesTypedDict diff --git a/lending/src/codat_lending/models/data_types.py b/lending/src/codat_lending/models/data_types.py new file mode 100644 index 000000000..734060127 --- /dev/null +++ b/lending/src/codat_lending/models/data_types.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from enum import Enum + + +class DataTypes(str, Enum): + """DataTypes enum (lifted from inline OAS enum).""" + 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' diff --git a/lending/src/codat_lending/models/dataset_status.py b/lending/src/codat_lending/models/dataset_status.py new file mode 100644 index 000000000..2b657c709 --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/end_upload_session_request_status.py b/lending/src/codat_lending/models/end_upload_session_request_status.py new file mode 100644 index 000000000..cee102f5e --- /dev/null +++ b/lending/src/codat_lending/models/end_upload_session_request_status.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class EndUploadSessionRequestStatus(str, Enum): + """EndUploadSessionRequestStatus enum (lifted from inline OAS enum).""" + CANCEL = 'Cancel' + PROCESS = 'Process' diff --git a/lending/src/codat_lending/models/error_message.py b/lending/src/codat_lending/models/error_message.py new file mode 100644 index 000000000..db4d78c29 --- /dev/null +++ b/lending/src/codat_lending/models/error_message.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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/lending/src/codat_lending/models/error_status.py b/lending/src/codat_lending/models/error_status.py new file mode 100644 index 000000000..ecf0a01b7 --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/errors/__init__.py b/lending/src/codat_lending/models/errors/__init__.py index 4c1ec7171..ba3adf6e9 100644 --- a/lending/src/codat_lending/models/errors/__init__.py +++ b/lending/src/codat_lending/models/errors/__init__.py @@ -1,39 +1,16 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.errors — Speakeasy-shape exception hierarchy.""" from .codatlendingerror import CodatLendingError -from typing import Any, TYPE_CHECKING - -from codat_lending.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__ = [ "CodatLendingError", + "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/lending/src/codat_lending/models/errors/codatlendingerror.py b/lending/src/codat_lending/models/errors/codatlendingerror.py index 6c25ff6f5..21dd5c54b 100644 --- a/lending/src/codat_lending/models/errors/codatlendingerror.py +++ b/lending/src/codat_lending/models/errors/codatlendingerror.py @@ -1,30 +1,72 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Base error class for codat_lending. -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 CodatLendingError(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 + # (`CodatLendingError(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/lending/src/codat_lending/models/errors/errormessage.py b/lending/src/codat_lending/models/errors/errormessage.py index efe92c70f..ac328e404 100644 --- a/lending/src/codat_lending/models/errors/errormessage.py +++ b/lending/src/codat_lending/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_lending.models.errors import CodatLendingError -from codat_lending.models.shared import errorvalidation as shared_errorvalidation -from codat_lending.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 .codatlendingerror import CodatLendingError +from codat_lending.models.error_message import ErrorMessage as ErrorMessageData + + class ErrorMessage(CodatLendingError): - 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/lending/src/codat_lending/models/errors/no_response_error.py b/lending/src/codat_lending/models/errors/no_response_error.py index 1deab64bc..acea02af8 100644 --- a/lending/src/codat_lending/models/errors/no_response_error.py +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/errors/responsevalidationerror.py b/lending/src/codat_lending/models/errors/responsevalidationerror.py index 437d3b64c..d0f1bcdf8 100644 --- a/lending/src/codat_lending/models/errors/responsevalidationerror.py +++ b/lending/src/codat_lending/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_lending.models.errors import CodatLendingError +from typing import Any, Mapping, Optional + +from .codatlendingerror import CodatLendingError -@dataclass(unsafe_hash=True) class ResponseValidationError(CodatLendingError): - """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/lending/src/codat_lending/models/errors/sdkerror.py b/lending/src/codat_lending/models/errors/sdkerror.py index 6c7c0d21b..13abc2742 100644 --- a/lending/src/codat_lending/models/errors/sdkerror.py +++ b/lending/src/codat_lending/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 .codatlendingerror import CodatLendingError -from codat_lending.models.errors import CodatLendingError MAX_MESSAGE_LEN = 10_000 -@dataclass(unsafe_hash=True) class SDKError(CodatLendingError): """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/lending/src/codat_lending/models/financial_summary.py b/lending/src/codat_lending/models/financial_summary.py new file mode 100644 index 000000000..ef3d13a09 --- /dev/null +++ b/lending/src/codat_lending/models/financial_summary.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.financial_summary_accounting_score import FinancialSummaryAccountingScore, FinancialSummaryAccountingScoreTypedDict +from codat_lending.models.financial_summary_books_closed_date import FinancialSummaryBooksClosedDate, FinancialSummaryBooksClosedDateTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class FinancialSummary(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} + """ + FinancialSummary + """ # noqa: E501 + books_closed_date: Optional[FinancialSummaryBooksClosedDate] = Field(default=None, alias="booksClosedDate") + accounting_score: Optional[FinancialSummaryAccountingScore] = Field(default=None, alias="accountingScore") + __properties: ClassVar[List[str]] = ["booksClosedDate", "accountingScore"] + + 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 FinancialSummary 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 books_closed_date + if self.books_closed_date: + _dict['booksClosedDate'] = self.books_closed_date.to_dict() + # override the default output from pydantic by calling `to_dict()` of accounting_score + if self.accounting_score: + _dict['accountingScore'] = self.accounting_score.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FinancialSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "booksClosedDate": FinancialSummaryBooksClosedDate.from_dict(obj["booksClosedDate"]) if obj.get("booksClosedDate") is not None else None, + "accountingScore": FinancialSummaryAccountingScore.from_dict(obj["accountingScore"]) if obj.get("accountingScore") is not None else None + }) + return _obj + + + + + +class FinancialSummaryTypedDict(TypedDict): + """TypedDict variant of FinancialSummary, for dict-literal request/response inputs.""" + books_closed_date: NotRequired[Optional[FinancialSummaryBooksClosedDateTypedDict]] + accounting_score: NotRequired[Optional[FinancialSummaryAccountingScoreTypedDict]] diff --git a/lending/src/codat_lending/models/financial_summary_accounting_score.py b/lending/src/codat_lending/models/financial_summary_accounting_score.py new file mode 100644 index 000000000..504b6c33f --- /dev/null +++ b/lending/src/codat_lending/models/financial_summary_accounting_score.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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 FinancialSummaryAccountingScore(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 score based on data completeness, accuracy, consistency, and presentation of data and the reasons for the score. + """ # noqa: E501 + score: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The accounting score value.") + reason: Optional[List[str]] = Field(default=None, description="List of reasons explaining the accounting score.") + __properties: ClassVar[List[str]] = ["score", "reason"] + + 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 FinancialSummaryAccountingScore 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 FinancialSummaryAccountingScore from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "score": obj.get("score"), + "reason": obj.get("reason") + }) + return _obj + + + + + +class FinancialSummaryAccountingScoreTypedDict(TypedDict): + """TypedDict variant of FinancialSummaryAccountingScore, for dict-literal request/response inputs.""" + score: NotRequired[Optional[Decimal]] + reason: NotRequired[Optional[List[str]]] diff --git a/lending/src/codat_lending/models/financial_summary_books_closed_date.py b/lending/src/codat_lending/models/financial_summary_books_closed_date.py new file mode 100644 index 000000000..77ece6f65 --- /dev/null +++ b/lending/src/codat_lending/models/financial_summary_books_closed_date.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 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 + +class FinancialSummaryBooksClosedDate(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} + """ + The date time in UTC the books closed. + """ # noqa: E501 + date_: Optional[str] = Field(default=None, description="The date time in UTC the books closed.", alias="date") + reason: Optional[List[str]] = Field(default=None, description="List of reasons explaining the books closed date.") + __properties: ClassVar[List[str]] = ["date", "reason"] + + 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 FinancialSummaryBooksClosedDate 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 FinancialSummaryBooksClosedDate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "reason": obj.get("reason") + }) + return _obj + + + + + +class FinancialSummaryBooksClosedDateTypedDict(TypedDict): + """TypedDict variant of FinancialSummaryBooksClosedDate, for dict-literal request/response inputs.""" + date_: NotRequired[Optional[str]] + reason: NotRequired[Optional[List[str]]] diff --git a/lending/src/codat_lending/models/get_report_status_report_id_parameter.py b/lending/src/codat_lending/models/get_report_status_report_id_parameter.py new file mode 100644 index 000000000..2ed0d5671 --- /dev/null +++ b/lending/src/codat_lending/models/get_report_status_report_id_parameter.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +GETREPORTSTATUSREPORTIDPARAMETER_ONE_OF_SCHEMAS = ["str"] + +# Collapsed by postprocess: degenerate oneOf branch — OAG emitted a oneOf wrapper for what the OAS +# specifies as a single `str` schema. Speakeasy types it as the +# bare underlying type. See collapse_identical_oneof_wrappers in +# pipeline/postprocess_generated.py. +GetReportStatusReportIdParameter = str + + + + + +class GetReportStatusReportIdParameterTypedDict(TypedDict): + """TypedDict variant of GetReportStatusReportIdParameter, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[str]] + oneof_schema_2_validator: NotRequired[Optional[str]] + actual_instance: NotRequired[Optional[Union[str]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/lending/src/codat_lending/models/item_reference.py b/lending/src/codat_lending/models/item_reference.py new file mode 100644 index 000000000..459299e44 --- /dev/null +++ b/lending/src/codat_lending/models/item_reference.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ItemReference(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Reference to the item the line is linked to. + """ # noqa: E501 + id: str = Field(description="Unique identifier for the item in the accounting software.") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the item in the accounting software.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 ItemReference 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 ItemReference 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") + }) + return _obj + + + + + +class ItemReferenceTypedDict(TypedDict): + """TypedDict variant of ItemReference, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/journal_entry_record_ref_data_type.py b/lending/src/codat_lending/models/journal_entry_record_ref_data_type.py new file mode 100644 index 000000000..a06d94a30 --- /dev/null +++ b/lending/src/codat_lending/models/journal_entry_record_ref_data_type.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from enum import Enum + + +class JournalEntryRecordRefDataType(str, Enum): + """JournalEntryRecordRefDataType enum (lifted from inline OAS enum).""" + BANK_TRANSACTIONS = 'bankTransactions' + BILL_CREDIT_NOTES = 'billCreditNotes' + BILL_PAYMENTS = 'billPayments' + BILLS = 'bills' + CREDIT_NOTES = 'creditNotes' + DIRECT_COSTS = 'directCosts' + DIRECT_INCOMES = 'directIncomes' + INVOICES = 'invoices' + JOURNAL_ENTRIES = 'journalEntries' + PAYMENTS = 'payments' + TRANSFERS = 'transfers' diff --git a/lending/src/codat_lending/models/journal_line.py b/lending/src/codat_lending/models/journal_line.py new file mode 100644 index 000000000..ddae1db7e --- /dev/null +++ b/lending/src/codat_lending/models/journal_line.py @@ -0,0 +1,139 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.contact_reference import ContactReference, ContactReferenceTypedDict +from codat_lending.models.journal_line_tracking import JournalLineTracking, JournalLineTrackingTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class JournalLine(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'currency', 'description', 'transactionCurrency', 'transaction_currency'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + JournalLine + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Description of the journal line item.") + net_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative.", alias="netAmount") + transaction_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount in the original transaction currency.", alias="transactionAmount") + currency: OptionalNullable[str] = Field(default=UNSET, description="Currency for the journal line item.") + transaction_currency: OptionalNullable[str] = Field(default=UNSET, description="Currency of the original transaction.", alias="transactionCurrency") + account_ref: Optional[AccountRef] = Field(default=None, alias="accountRef") + tracking: Optional[JournalLineTracking] = None + contact_ref: Optional[ContactReference] = Field(default=None, alias="contactRef") + __properties: ClassVar[List[str]] = ["description", "netAmount", "transactionAmount", "currency", "transactionCurrency", "accountRef", "tracking", "contactRef"] + + 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 JournalLine 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_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + # override the default output from pydantic by calling `to_dict()` of contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of JournalLine 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"), + "netAmount": obj.get("netAmount"), + "transactionAmount": obj.get("transactionAmount"), + "currency": obj.get("currency"), + "transactionCurrency": obj.get("transactionCurrency"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "tracking": JournalLineTracking.from_dict(obj["tracking"]) if obj.get("tracking") is not None else None, + "contactRef": ContactReference.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None + }) + return _obj + + + + + +class JournalLineTypedDict(TypedDict): + """TypedDict variant of JournalLine, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + net_amount: NotRequired[Decimal] + transaction_amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + transaction_currency: NotRequired[Optional[str]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + tracking: NotRequired[Optional[JournalLineTrackingTypedDict]] + contact_ref: NotRequired[Optional[ContactReferenceTypedDict]] diff --git a/lending/src/codat_lending/models/journal_line_tracking.py b/lending/src/codat_lending/models/journal_line_tracking.py new file mode 100644 index 000000000..8bb0235b8 --- /dev/null +++ b/lending/src/codat_lending/models/journal_line_tracking.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.tracking_record_ref import TrackingRecordRef, TrackingRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class JournalLineTracking(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'recordRefs', 'record_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.) + """ # noqa: E501 + record_refs: OptionalNullable[List[TrackingRecordRef]] = Field(default=UNSET, alias="recordRefs") + __properties: ClassVar[List[str]] = ["recordRefs"] + + 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 JournalLineTracking 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 record_refs (list) + _items = [] + if self.record_refs: + for _item_record_refs in self.record_refs: + if _item_record_refs: + _items.append(_item_record_refs.to_dict()) + _dict['recordRefs'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of JournalLineTracking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "recordRefs": [TrackingRecordRef.from_dict(_item) for _item in obj["recordRefs"]] if obj.get("recordRefs") is not None else None + }) + return _obj + + + + + +class JournalLineTrackingTypedDict(TypedDict): + """TypedDict variant of JournalLineTracking, for dict-literal request/response inputs.""" + record_refs: NotRequired[Optional[List[TrackingRecordRefTypedDict]]] diff --git a/lending/src/codat_lending/models/journal_line_tracking_data_type.py b/lending/src/codat_lending/models/journal_line_tracking_data_type.py new file mode 100644 index 000000000..6c1129319 --- /dev/null +++ b/lending/src/codat_lending/models/journal_line_tracking_data_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class JournalLineTrackingDataType(str, Enum): + """JournalLineTrackingDataType enum (lifted from inline OAS enum).""" + CUSTOMERS = 'customers' + SUPPLIERS = 'suppliers' + TRACKING_CATEGORIES = 'trackingCategories' diff --git a/lending/src/codat_lending/models/journal_prototype.py b/lending/src/codat_lending/models/journal_prototype.py new file mode 100644 index 000000000..5cbdaadbb --- /dev/null +++ b/lending/src/codat_lending/models/journal_prototype.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.journalstatus import JournalStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class JournalPrototype(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} + """ + JournalPrototype + """ # noqa: E501 + journal_code: Optional[str] = Field(default=None, description="Native journal number or code.", alias="journalCode") + name: Optional[str] = Field(default=None, description="Journal name. The maximum length for a journal name is 256 characters. All characters above that number will be truncated.") + type: Optional[str] = Field(default=None, description="The type of the journal.") + parent_id: Optional[str] = Field(default=None, description="Parent journal ID. If the journal is a parent journal, this value is not present.", alias="parentId") + has_children: Optional[bool] = Field(default=None, description="If the journal has child journals, this value is true. If it doesn’t, it is false.", alias="hasChildren") + created_on: 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="createdOn") + status: Optional[JournalStatus] = None + __properties: ClassVar[List[str]] = ["journalCode", "name", "type", "parentId", "hasChildren", "createdOn", "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 JournalPrototype 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 JournalPrototype from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "journalCode": obj.get("journalCode"), + "name": obj.get("name"), + "type": obj.get("type"), + "parentId": obj.get("parentId"), + "hasChildren": obj.get("hasChildren"), + "createdOn": obj.get("createdOn"), + "status": obj.get("status") + }) + return _obj + + + + + +class JournalPrototypeTypedDict(TypedDict): + """TypedDict variant of JournalPrototype, for dict-literal request/response inputs.""" + journal_code: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + parent_id: NotRequired[Optional[str]] + has_children: NotRequired[Optional[bool]] + created_on: NotRequired[Optional[str]] + status: NotRequired[Optional[JournalStatus]] diff --git a/lending/src/codat_lending/models/loan_transaction_type.py b/lending/src/codat_lending/models/loan_transaction_type.py new file mode 100644 index 000000000..c092c097f --- /dev/null +++ b/lending/src/codat_lending/models/loan_transaction_type.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +from enum import Enum + + +class LoanTransactionType(str, Enum): + """LoanTransactionType enum (lifted from inline OAS enum).""" + INVESTMENT = 'Investment' + REPAYMENT = 'Repayment' + INTEREST = 'Interest' + ACCURED_INTEREST = 'AccuredInterest' diff --git a/lending/src/codat_lending/models/model0.py b/lending/src/codat_lending/models/model0.py new file mode 100644 index 000000000..f6ad88d63 --- /dev/null +++ b/lending/src/codat_lending/models/model0.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 Model0(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} + """ + Model0 + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + __properties: ClassVar[List[str]] = ["id"] + + 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 Model0 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 Model0 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") + }) + return _obj + + + + + +class Model0TypedDict(TypedDict): + """TypedDict variant of Model0, for dict-literal request/response inputs.""" + id: NotRequired[str] diff --git a/lending/src/codat_lending/models/model3.py b/lending/src/codat_lending/models/model3.py new file mode 100644 index 000000000..a625cf91a --- /dev/null +++ b/lending/src/codat_lending/models/model3.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 Model3(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} + """ + Model3 + """ # noqa: E501 + 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]] = ["modifiedDate", "sourceModifiedDate"] + + 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 Model3 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 Model3 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + return _obj + + + + + +class Model3TypedDict(TypedDict): + """TypedDict variant of Model3, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/operations/__init__.py b/lending/src/codat_lending/models/operations/__init__.py index c402bf70a..a49cd6f22 100644 --- a/lending/src/codat_lending/models/operations/__init__.py +++ b/lending/src/codat_lending/models/operations/__init__.py @@ -1,1218 +1,454 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations — re-exports of per-operation request envelopes.""" -from typing import Any, TYPE_CHECKING +from codat_lending.api.account_balances import ( + ListBankingAccountBalancesRequest, + ListBankingAccountBalancesRequestTypedDict, +) +from codat_lending.api.account_transactions import ( + GetAccountingAccountTransactionRequest, + GetAccountingAccountTransactionRequestTypedDict, + ListAccountingAccountTransactionsRequest, + ListAccountingAccountTransactionsRequestTypedDict, +) +from codat_lending.api.accounting_bank_data import ( + ListAccountingBankAccountTransactionsRequest, + ListAccountingBankAccountTransactionsRequestTypedDict, +) +from codat_lending.api.accounts import ( + GetAccountingBankAccountRequest, + GetAccountingBankAccountRequestTypedDict, + ListAccountingBankAccountsRequest, + ListAccountingBankAccountsRequestTypedDict, +) +from codat_lending.api.balance_sheet import ( + GetAccountingBalanceSheetRequest, + GetAccountingBalanceSheetRequestTypedDict, + GetCategorizedBalanceSheetStatementRequest, + GetCategorizedBalanceSheetStatementRequestTypedDict, +) +from codat_lending.api.bank_accounts import ( + CreateBankAccountRequest, + CreateBankAccountRequestTypedDict, + GetCreateUpdateBankAccountsModelRequest, + GetCreateUpdateBankAccountsModelRequestTypedDict, +) +from codat_lending.api.bank_statements import ( + DownloadCategorizedBankStatementExcelRequest, + DownloadCategorizedBankStatementExcelRequestTypedDict, + EndBankStatementUploadSessionRequest, + EndBankStatementUploadSessionRequestTypedDict, + GetBankStatementUploadConfigurationRequest, + GetBankStatementUploadConfigurationRequestTypedDict, + GetCategorizedBankStatementTransactionsRequest, + GetCategorizedBankStatementTransactionsRequestTypedDict, + ListCategorizedBankStatementAccountsRequest, + ListCategorizedBankStatementAccountsRequestTypedDict, + SetBankStatementUploadConfigurationRequest, + SetBankStatementUploadConfigurationRequestTypedDict, + StartBankStatementUploadSessionRequest, + StartBankStatementUploadSessionRequestTypedDict, + UploadBankStatementDataRequest, + UploadBankStatementDataRequestTypedDict, +) +from codat_lending.api.bank_transactions import ( + CreateBankTransactionsRequest, + CreateBankTransactionsRequestTypedDict, + GetCreateBankTransactionsModelRequest, + GetCreateBankTransactionsModelRequestTypedDict, +) +from codat_lending.api.banking_accounts import ( + GetBankingAccountRequest, + GetBankingAccountRequestTypedDict, + ListBankingAccountsRequest, + ListBankingAccountsRequestTypedDict, +) +from codat_lending.api.bill_credit_notes import ( + GetAccountingBillCreditNoteRequest, + GetAccountingBillCreditNoteRequestTypedDict, + ListAccountingBillCreditNotesRequest, + ListAccountingBillCreditNotesRequestTypedDict, +) +from codat_lending.api.bill_payments import ( + GetAccountingBillPaymentRequest, + GetAccountingBillPaymentRequestTypedDict, + ListAccountingBillPaymentsRequest, + ListAccountingBillPaymentsRequestTypedDict, +) +from codat_lending.api.bills import ( + DownloadAccountingBillAttachmentRequest, + DownloadAccountingBillAttachmentRequestTypedDict, + GetAccountingBillAttachmentRequest, + GetAccountingBillAttachmentRequestTypedDict, + GetAccountingBillRequest, + GetAccountingBillRequestTypedDict, + ListAccountingBillAttachmentsRequest, + ListAccountingBillAttachmentsRequestTypedDict, + ListAccountingBillsRequest, + ListAccountingBillsRequestTypedDict, +) +from codat_lending.api.cash_flow import ( + GetAccountingCashFlowStatementRequest, + GetAccountingCashFlowStatementRequestTypedDict, +) +from codat_lending.api.categorized_statement import ( + GetCategorizedBankStatementRequest, + GetCategorizedBankStatementRequestTypedDict, +) +from codat_lending.api.companies import ( + CreateCompanyRequest, + CreateCompanyRequestTypedDict, + DeleteCompanyRequest, + DeleteCompanyRequestTypedDict, + GetCompanyRequest, + GetCompanyRequestTypedDict, + ListCompaniesRequest, + ListCompaniesRequestTypedDict, + ReplaceCompanyRequest, + ReplaceCompanyRequestTypedDict, + UpdateCompanyRequest, + UpdateCompanyRequestTypedDict, +) +from codat_lending.api.company_info import ( + GetAccountingProfileRequest, + GetAccountingProfileRequestTypedDict, + GetCommerceProfileRequest, + GetCommerceProfileRequestTypedDict, +) +from codat_lending.api.connections import ( + CreateConnectionRequest, + CreateConnectionRequestTypedDict, + DeleteConnectionRequest, + DeleteConnectionRequestTypedDict, + GetConnectionRequest, + GetConnectionRequestTypedDict, + ListConnectionsRequest, + ListConnectionsRequestTypedDict, + UnlinkConnectionRequest, + UnlinkConnectionRequestTypedDict, +) +from codat_lending.api.create_operations import ( + GetCreateOperationRequest, + GetCreateOperationRequestTypedDict, + ListCreateOperationsRequest, + ListCreateOperationsRequestTypedDict, +) +from codat_lending.api.credit_notes import ( + GetAccountingCreditNoteRequest, + GetAccountingCreditNoteRequestTypedDict, + ListAccountingCreditNotesRequest, + ListAccountingCreditNotesRequestTypedDict, +) +from codat_lending.api.customers import ( + DownloadAccountingCustomerAttachmentRequest, + DownloadAccountingCustomerAttachmentRequestTypedDict, + GetAccountingCustomerAttachmentRequest, + GetAccountingCustomerAttachmentRequestTypedDict, + GetAccountingCustomerRequest, + GetAccountingCustomerRequestTypedDict, + ListAccountingCustomerAttachmentsRequest, + ListAccountingCustomerAttachmentsRequestTypedDict, + ListAccountingCustomersRequest, + ListAccountingCustomersRequestTypedDict, +) +from codat_lending.api.data_integrity import ( + GetDataIntegrityStatusRequest, + GetDataIntegrityStatusRequestTypedDict, + GetDataIntegritySummariesRequest, + GetDataIntegritySummariesRequestTypedDict, + ListDataIntegrityDetailsRequest, + ListDataIntegrityDetailsRequestTypedDict, +) +from codat_lending.api.direct_costs import ( + CreateDirectCostRequest, + CreateDirectCostRequestTypedDict, + GetCreateDirectCostsModelRequest, + GetCreateDirectCostsModelRequestTypedDict, +) +from codat_lending.api.direct_incomes import ( + DownloadAccountingDirectIncomeAttachmentRequest, + DownloadAccountingDirectIncomeAttachmentRequestTypedDict, + GetAccountingDirectIncomeAttachmentRequest, + GetAccountingDirectIncomeAttachmentRequestTypedDict, + GetAccountingDirectIncomeRequest, + GetAccountingDirectIncomeRequestTypedDict, + ListAccountingDirectIncomeAttachmentsRequest, + ListAccountingDirectIncomeAttachmentsRequestTypedDict, + ListAccountingDirectIncomesRequest, + ListAccountingDirectIncomesRequestTypedDict, +) +from codat_lending.api.disputes import ( + GetCommerceDisputeRequest, + GetCommerceDisputeRequestTypedDict, + ListCommerceDisputesRequest, + ListCommerceDisputesRequestTypedDict, +) +from codat_lending.api.excel_reports import ( + DownloadExcelReportRequest, + DownloadExcelReportRequestTypedDict, + GenerateExcelReportRequest, + GenerateExcelReportRequestTypedDict, + GetExcelReportGenerationStatusRequest, + GetExcelReportGenerationStatusRequestTypedDict, +) +from codat_lending.api.file_upload import ( + DownloadFilesRequest, + DownloadFilesRequestTypedDict, + ListFilesRequest, + ListFilesRequestTypedDict, + UploadFilesRequest, + UploadFilesRequestTypedDict, +) +from codat_lending.api.financial_statements_accounts import ( + GetAccountingAccountRequest, + GetAccountingAccountRequestTypedDict, + ListAccountingAccountsRequest, + ListAccountingAccountsRequestTypedDict, +) +from codat_lending.api.financial_summary import ( + DownloadCreditModelExcelRequest, + DownloadCreditModelExcelRequestTypedDict, + GetFinancialSummaryRequest, + GetFinancialSummaryRequestTypedDict, +) +from codat_lending.api.invoices import ( + DownloadAccountingInvoiceAttachmentRequest, + DownloadAccountingInvoiceAttachmentRequestTypedDict, + DownloadAccountingInvoicePdfRequest, + DownloadAccountingInvoicePdfRequestTypedDict, + GetAccountingInvoiceAttachmentRequest, + GetAccountingInvoiceAttachmentRequestTypedDict, + GetAccountingInvoiceRequest, + GetAccountingInvoiceRequestTypedDict, + ListAccountingInvoiceAttachmentsRequest, + ListAccountingInvoiceAttachmentsRequestTypedDict, + ListAccountingInvoicesRequest, + ListAccountingInvoicesRequestTypedDict, + ListReconciledInvoicesRequest, + ListReconciledInvoicesRequestTypedDict, +) +from codat_lending.api.journal_entries import ( + GetAccountingJournalEntryRequest, + GetAccountingJournalEntryRequestTypedDict, + ListAccountingJournalEntriesRequest, + ListAccountingJournalEntriesRequestTypedDict, +) +from codat_lending.api.journals import ( + GetAccountingJournalRequest, + GetAccountingJournalRequestTypedDict, + ListAccountingJournalsRequest, + ListAccountingJournalsRequestTypedDict, +) +from codat_lending.api.liabilities import ( + GenerateLoanSummaryRequest, + GenerateLoanSummaryRequestTypedDict, + GenerateLoanTransactionsRequest, + GenerateLoanTransactionsRequestTypedDict, + GetLoanSummaryRequest, + GetLoanSummaryRequestTypedDict, + ListLoanTransactionsRequest, + ListLoanTransactionsRequestTypedDict, +) +from codat_lending.api.loan_writeback_accounts import ( + CreateAccountRequest, + CreateAccountRequestTypedDict, + GetCreateChartOfAccountsModelRequest, + GetCreateChartOfAccountsModelRequestTypedDict, +) +from codat_lending.api.loan_writeback_payments import ( + CreatePaymentRequest, + CreatePaymentRequestTypedDict, + GetCreatePaymentModelRequest, + GetCreatePaymentModelRequestTypedDict, +) +from codat_lending.api.loan_writeback_suppliers import ( + CreateSupplierRequest, + CreateSupplierRequestTypedDict, + GetCreateUpdateSuppliersModelRequest, + GetCreateUpdateSuppliersModelRequestTypedDict, +) +from codat_lending.api.locations import ( + GetCommerceLocationRequest, + GetCommerceLocationRequestTypedDict, + ListCommerceLocationsRequest, + ListCommerceLocationsRequestTypedDict, +) +from codat_lending.api.manage_data import ( + GetDataStatusRequest, + GetDataStatusRequestTypedDict, +) +from codat_lending.api.manage_reports import ( + GenerateReportRequest, + GenerateReportRequestTypedDict, + GetReportStatusRequest, + GetReportStatusRequestTypedDict, + ListReportsRequest, + ListReportsRequestTypedDict, +) +from codat_lending.api.metrics import ( + GetCommerceCustomerRetentionMetricsRequest, + GetCommerceCustomerRetentionMetricsRequestTypedDict, + GetCommerceLifetimeValueMetricsRequest, + GetCommerceLifetimeValueMetricsRequestTypedDict, + GetCommerceRevenueMetricsRequest, + GetCommerceRevenueMetricsRequestTypedDict, +) +from codat_lending.api.orders import ( + GetCommerceOrderRequest, + GetCommerceOrderRequestTypedDict, + ListCommerceOrdersRequest, + ListCommerceOrdersRequestTypedDict, +) +from codat_lending.api.payment_methods import ( + GetCommercePaymentMethodRequest, + GetCommercePaymentMethodRequestTypedDict, + ListCommercePaymentMethodsRequest, + ListCommercePaymentMethodsRequestTypedDict, +) +from codat_lending.api.payments import ( + GetAccountingPaymentRequest, + GetAccountingPaymentRequestTypedDict, + ListAccountingPaymentsRequest, + ListAccountingPaymentsRequestTypedDict, +) +from codat_lending.api.product_categories import ( + GetCommerceProductCategoryRequest, + GetCommerceProductCategoryRequestTypedDict, + ListCommerceProductCategoriesRequest, + ListCommerceProductCategoriesRequestTypedDict, +) +from codat_lending.api.products import ( + GetCommerceProductRequest, + GetCommerceProductRequestTypedDict, + ListCommerceProductsRequest, + ListCommerceProductsRequestTypedDict, +) +from codat_lending.api.profit_and_loss import ( + GetAccountingProfitAndLossRequest, + GetAccountingProfitAndLossRequestTypedDict, + GetCategorizedProfitAndLossStatementRequest, + GetCategorizedProfitAndLossStatementRequestTypedDict, +) +from codat_lending.api.pull_operations import ( + GetPullOperationRequest, + GetPullOperationRequestTypedDict, + ListPullOperationsRequest, + ListPullOperationsRequestTypedDict, +) +from codat_lending.api.refresh import ( + RefreshAllDataTypesRequest, + RefreshAllDataTypesRequestTypedDict, + RefreshDataTypeRequest, + RefreshDataTypeRequestTypedDict, +) +from codat_lending.api.reports import ( + GetAccountingAgedCreditorsReportRequest, + GetAccountingAgedCreditorsReportRequestTypedDict, + GetAccountingAgedDebtorsReportRequest, + GetAccountingAgedDebtorsReportRequestTypedDict, + IsAgedCreditorsReportAvailableRequest, + IsAgedCreditorsReportAvailableRequestTypedDict, + IsAgedDebtorsReportAvailableRequest, + IsAgedDebtorsReportAvailableRequestTypedDict, +) +from codat_lending.api.sales_customers import ( + GetCommerceCustomerRequest, + GetCommerceCustomerRequestTypedDict, + ListCommerceCustomersRequest, + ListCommerceCustomersRequestTypedDict, +) +from codat_lending.api.sales_payments import ( + GetCommercePaymentRequest, + GetCommercePaymentRequestTypedDict, + ListCommercePaymentsRequest, + ListCommercePaymentsRequestTypedDict, +) +from codat_lending.api.sales_reports import ( + GetCommerceOrdersReportRequest, + GetCommerceOrdersReportRequestTypedDict, + GetCommerceRefundsReportRequest, + GetCommerceRefundsReportRequestTypedDict, +) +from codat_lending.api.sales_transactions import ( + GetCommerceTransactionRequest, + GetCommerceTransactionRequestTypedDict, + ListCommerceTransactionsRequest, + ListCommerceTransactionsRequestTypedDict, +) +from codat_lending.api.source_accounts import ( + CreateBankAccountMappingRequest, + CreateBankAccountMappingRequestTypedDict, + CreateSourceAccountRequest, + CreateSourceAccountRequestTypedDict, + GetBankAccountMappingRequest, + GetBankAccountMappingRequestTypedDict, +) +from codat_lending.api.suppliers import ( + DownloadAccountingSupplierAttachmentRequest, + DownloadAccountingSupplierAttachmentRequestTypedDict, + GetAccountingSupplierAttachmentRequest, + GetAccountingSupplierAttachmentRequestTypedDict, + GetAccountingSupplierRequest, + GetAccountingSupplierRequestTypedDict, + ListAccountingSupplierAttachmentsRequest, + ListAccountingSupplierAttachmentsRequestTypedDict, + ListAccountingSuppliersRequest, + ListAccountingSuppliersRequestTypedDict, +) +from codat_lending.api.transaction_categories import ( + GetBankingTransactionCategoryRequest, + GetBankingTransactionCategoryRequestTypedDict, + ListBankingTransactionCategoriesRequest, + ListBankingTransactionCategoriesRequestTypedDict, +) +from codat_lending.api.transactions import ( + GetBankingTransactionRequest, + GetBankingTransactionRequestTypedDict, + ListBankingTransactionsRequest, + ListBankingTransactionsRequestTypedDict, +) +from codat_lending.api.transactions_direct_costs import ( + DownloadAccountingDirectCostAttachmentRequest, + DownloadAccountingDirectCostAttachmentRequestTypedDict, + GetAccountingDirectCostAttachmentRequest, + GetAccountingDirectCostAttachmentRequestTypedDict, + GetAccountingDirectCostRequest, + GetAccountingDirectCostRequestTypedDict, + ListAccountingDirectCostAttachmentsRequest, + ListAccountingDirectCostAttachmentsRequestTypedDict, + ListAccountingDirectCostsRequest, + ListAccountingDirectCostsRequestTypedDict, +) +from codat_lending.api.transactions_transfers import ( + GetAccountingTransferRequest, + GetAccountingTransferRequestTypedDict, + ListAccountingTransfersRequest, + ListAccountingTransfersRequestTypedDict, +) +from codat_lending.api.transfers import ( + CreateTransferRequest, + CreateTransferRequestTypedDict, + GetCreateTransfersModelRequest, + GetCreateTransfersModelRequestTypedDict, +) -from codat_lending.utils.dynamic_imports import lazy_getattr, lazy_dir +# Speakeasy request-body class names (aliases to POC body classes). +from codat_lending.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_lending.models.update_connection import UpdateConnection as UnlinkConnectionUpdateConnection -if TYPE_CHECKING: - from .create_account import CreateAccountRequest, CreateAccountRequestTypedDict - from .create_bank_account import ( - CreateBankAccountRequest, - CreateBankAccountRequestTypedDict, - ) - from .create_bank_account_mapping import ( - CreateBankAccountMappingRequest, - CreateBankAccountMappingRequestTypedDict, - ) - from .create_bank_transactions import ( - CreateBankTransactionsRequest, - CreateBankTransactionsRequestTypedDict, - ) - from .create_connection import ( - CreateConnectionRequest, - CreateConnectionRequestBody, - CreateConnectionRequestBodyTypedDict, - CreateConnectionRequestTypedDict, - ) - from .create_direct_cost import ( - CreateDirectCostRequest, - CreateDirectCostRequestTypedDict, - ) - from .create_payment import CreatePaymentRequest, CreatePaymentRequestTypedDict - from .create_source_account import ( - CreateSourceAccountRequest, - CreateSourceAccountRequestBody, - CreateSourceAccountRequestBodyTypedDict, - CreateSourceAccountRequestTypedDict, - CreateSourceAccountResponseBody, - CreateSourceAccountResponseBodyTypedDict, - ) - from .create_supplier import CreateSupplierRequest, CreateSupplierRequestTypedDict - from .create_transfer import CreateTransferRequest, CreateTransferRequestTypedDict - from .delete_company import DeleteCompanyRequest, DeleteCompanyRequestTypedDict - from .delete_connection import ( - DeleteConnectionRequest, - DeleteConnectionRequestTypedDict, - ) - from .download_accounting_bill_attachment import ( - DownloadAccountingBillAttachmentRequest, - DownloadAccountingBillAttachmentRequestTypedDict, - ) - from .download_accounting_customer_attachment import ( - DownloadAccountingCustomerAttachmentRequest, - DownloadAccountingCustomerAttachmentRequestTypedDict, - ) - from .download_accounting_direct_cost_attachment import ( - DownloadAccountingDirectCostAttachmentRequest, - DownloadAccountingDirectCostAttachmentRequestTypedDict, - ) - from .download_accounting_direct_income_attachment import ( - DownloadAccountingDirectIncomeAttachmentRequest, - DownloadAccountingDirectIncomeAttachmentRequestTypedDict, - ) - from .download_accounting_invoice_attachment import ( - DownloadAccountingInvoiceAttachmentRequest, - DownloadAccountingInvoiceAttachmentRequestTypedDict, - ) - from .download_accounting_invoice_pdf import ( - DownloadAccountingInvoicePdfRequest, - DownloadAccountingInvoicePdfRequestTypedDict, - ) - from .download_accounting_supplier_attachment import ( - DownloadAccountingSupplierAttachmentRequest, - DownloadAccountingSupplierAttachmentRequestTypedDict, - ) - from .download_excel_report import ( - DownloadExcelReportRequest, - DownloadExcelReportRequestTypedDict, - ) - from .download_files import DownloadFilesRequest, DownloadFilesRequestTypedDict - from .end_bank_statement_upload_session import ( - EndBankStatementUploadSessionRequest, - EndBankStatementUploadSessionRequestTypedDict, - ) - from .generate_excel_report import ( - GenerateExcelReportRequest, - GenerateExcelReportRequestTypedDict, - ) - from .generate_loan_summary import ( - GenerateLoanSummaryRequest, - GenerateLoanSummaryRequestTypedDict, - SourceType, - ) - from .generate_loan_transactions import ( - GenerateLoanTransactionsRequest, - GenerateLoanTransactionsRequestTypedDict, - QueryParamSourceType, - ) - from .generate_report import GenerateReportRequest, GenerateReportRequestTypedDict - from .get_accounting_account import ( - GetAccountingAccountRequest, - GetAccountingAccountRequestTypedDict, - ) - from .get_accounting_account_transaction import ( - GetAccountingAccountTransactionRequest, - GetAccountingAccountTransactionRequestTypedDict, - ) - from .get_accounting_aged_creditors_report import ( - GetAccountingAgedCreditorsReportRequest, - GetAccountingAgedCreditorsReportRequestTypedDict, - ) - from .get_accounting_aged_debtors_report import ( - GetAccountingAgedDebtorsReportRequest, - GetAccountingAgedDebtorsReportRequestTypedDict, - ) - from .get_accounting_balance_sheet import ( - GetAccountingBalanceSheetRequest, - GetAccountingBalanceSheetRequestTypedDict, - ) - from .get_accounting_bank_account import ( - GetAccountingBankAccountRequest, - GetAccountingBankAccountRequestTypedDict, - ) - from .get_accounting_bill import ( - GetAccountingBillRequest, - GetAccountingBillRequestTypedDict, - ) - from .get_accounting_bill_attachment import ( - GetAccountingBillAttachmentRequest, - GetAccountingBillAttachmentRequestTypedDict, - ) - from .get_accounting_bill_credit_note import ( - GetAccountingBillCreditNoteRequest, - GetAccountingBillCreditNoteRequestTypedDict, - ) - from .get_accounting_bill_payment import ( - GetAccountingBillPaymentRequest, - GetAccountingBillPaymentRequestTypedDict, - ) - from .get_accounting_cash_flow_statement import ( - GetAccountingCashFlowStatementRequest, - GetAccountingCashFlowStatementRequestTypedDict, - ) - from .get_accounting_credit_note import ( - GetAccountingCreditNoteRequest, - GetAccountingCreditNoteRequestTypedDict, - ) - from .get_accounting_customer import ( - GetAccountingCustomerRequest, - GetAccountingCustomerRequestTypedDict, - ) - from .get_accounting_customer_attachment import ( - GetAccountingCustomerAttachmentRequest, - GetAccountingCustomerAttachmentRequestTypedDict, - ) - from .get_accounting_direct_cost import ( - GetAccountingDirectCostRequest, - GetAccountingDirectCostRequestTypedDict, - ) - from .get_accounting_direct_cost_attachment import ( - GetAccountingDirectCostAttachmentRequest, - GetAccountingDirectCostAttachmentRequestTypedDict, - ) - from .get_accounting_direct_income import ( - GetAccountingDirectIncomeRequest, - GetAccountingDirectIncomeRequestTypedDict, - ) - from .get_accounting_direct_income_attachment import ( - GetAccountingDirectIncomeAttachmentRequest, - GetAccountingDirectIncomeAttachmentRequestTypedDict, - ) - from .get_accounting_invoice import ( - GetAccountingInvoiceRequest, - GetAccountingInvoiceRequestTypedDict, - ) - from .get_accounting_invoice_attachment import ( - GetAccountingInvoiceAttachmentRequest, - GetAccountingInvoiceAttachmentRequestTypedDict, - ) - from .get_accounting_journal import ( - GetAccountingJournalRequest, - GetAccountingJournalRequestTypedDict, - ) - from .get_accounting_journal_entry import ( - GetAccountingJournalEntryRequest, - GetAccountingJournalEntryRequestTypedDict, - ) - from .get_accounting_payment import ( - GetAccountingPaymentRequest, - GetAccountingPaymentRequestTypedDict, - ) - from .get_accounting_profile import ( - GetAccountingProfileRequest, - GetAccountingProfileRequestTypedDict, - ) - from .get_accounting_profit_and_loss import ( - GetAccountingProfitAndLossRequest, - GetAccountingProfitAndLossRequestTypedDict, - ) - from .get_accounting_supplier import ( - GetAccountingSupplierRequest, - GetAccountingSupplierRequestTypedDict, - ) - from .get_accounting_supplier_attachment import ( - GetAccountingSupplierAttachmentRequest, - GetAccountingSupplierAttachmentRequestTypedDict, - ) - from .get_accounting_transfer import ( - GetAccountingTransferRequest, - GetAccountingTransferRequestTypedDict, - ) - from .get_bank_account_mapping import ( - GetBankAccountMappingRequest, - GetBankAccountMappingRequestTypedDict, - ) - from .get_bank_statement_upload_configuration import ( - GetBankStatementUploadConfigurationRequest, - GetBankStatementUploadConfigurationRequestTypedDict, - ) - from .get_banking_account import ( - GetBankingAccountRequest, - GetBankingAccountRequestTypedDict, - ) - from .get_banking_transaction import ( - GetBankingTransactionRequest, - GetBankingTransactionRequestTypedDict, - ) - from .get_banking_transaction_category import ( - GetBankingTransactionCategoryRequest, - GetBankingTransactionCategoryRequestTypedDict, - ) - from .get_categorized_balance_sheet_statement import ( - GetCategorizedBalanceSheetStatementRequest, - GetCategorizedBalanceSheetStatementRequestTypedDict, - ) - from .get_categorized_bank_statement import ( - GetCategorizedBankStatementRequest, - GetCategorizedBankStatementRequestTypedDict, - ) - from .get_categorized_profit_and_loss_statement import ( - GetCategorizedProfitAndLossStatementRequest, - GetCategorizedProfitAndLossStatementRequestTypedDict, - ) - from .get_commerce_customer import ( - GetCommerceCustomerRequest, - GetCommerceCustomerRequestTypedDict, - ) - from .get_commerce_customer_retention_metrics import ( - GetCommerceCustomerRetentionMetricsRequest, - GetCommerceCustomerRetentionMetricsRequestTypedDict, - ) - from .get_commerce_dispute import ( - GetCommerceDisputeRequest, - GetCommerceDisputeRequestTypedDict, - ) - from .get_commerce_lifetime_value_metrics import ( - GetCommerceLifetimeValueMetricsRequest, - GetCommerceLifetimeValueMetricsRequestTypedDict, - ) - from .get_commerce_location import ( - GetCommerceLocationRequest, - GetCommerceLocationRequestTypedDict, - ) - from .get_commerce_order import ( - GetCommerceOrderRequest, - GetCommerceOrderRequestTypedDict, - ) - from .get_commerce_orders_report import ( - GetCommerceOrdersReportRequest, - GetCommerceOrdersReportRequestTypedDict, - ) - from .get_commerce_payment import ( - GetCommercePaymentRequest, - GetCommercePaymentRequestTypedDict, - ) - from .get_commerce_payment_method import ( - GetCommercePaymentMethodRequest, - GetCommercePaymentMethodRequestTypedDict, - ) - from .get_commerce_product import ( - GetCommerceProductRequest, - GetCommerceProductRequestTypedDict, - ) - from .get_commerce_product_category import ( - GetCommerceProductCategoryRequest, - GetCommerceProductCategoryRequestTypedDict, - ) - from .get_commerce_profile import ( - GetCommerceProfileRequest, - GetCommerceProfileRequestTypedDict, - ) - from .get_commerce_refunds_report import ( - GetCommerceRefundsReportRequest, - GetCommerceRefundsReportRequestTypedDict, - ) - from .get_commerce_revenue_metrics import ( - GetCommerceRevenueMetricsRequest, - GetCommerceRevenueMetricsRequestTypedDict, - ) - from .get_commerce_transaction import ( - GetCommerceTransactionRequest, - GetCommerceTransactionRequestTypedDict, - ) - from .get_company import GetCompanyRequest, GetCompanyRequestTypedDict - from .get_connection import GetConnectionRequest, GetConnectionRequestTypedDict - from .get_create_bank_transactions_model import ( - GetCreateBankTransactionsModelRequest, - GetCreateBankTransactionsModelRequestTypedDict, - ) - from .get_create_chartofaccounts_model import ( - GetCreateChartOfAccountsModelRequest, - GetCreateChartOfAccountsModelRequestTypedDict, - ) - from .get_create_directcosts_model import ( - GetCreateDirectCostsModelRequest, - GetCreateDirectCostsModelRequestTypedDict, - ) - from .get_create_operation import ( - GetCreateOperationRequest, - GetCreateOperationRequestTypedDict, - ) - from .get_create_payment_model import ( - GetCreatePaymentModelRequest, - GetCreatePaymentModelRequestTypedDict, - ) - from .get_create_transfers_model import ( - GetCreateTransfersModelRequest, - GetCreateTransfersModelRequestTypedDict, - ) - from .get_create_update_bankaccounts_model import ( - GetCreateUpdateBankAccountsModelRequest, - GetCreateUpdateBankAccountsModelRequestTypedDict, - ) - from .get_create_update_suppliers_model import ( - GetCreateUpdateSuppliersModelRequest, - GetCreateUpdateSuppliersModelRequestTypedDict, - ) - from .get_data_integrity_status import ( - GetDataIntegrityStatusRequest, - GetDataIntegrityStatusRequestTypedDict, - ) - from .get_data_integrity_summaries import ( - GetDataIntegritySummariesRequest, - GetDataIntegritySummariesRequestTypedDict, - ) - from .get_data_status import ( - GetDataStatusDataStatuses, - GetDataStatusDataStatusesTypedDict, - GetDataStatusRequest, - GetDataStatusRequestTypedDict, - ) - from .get_excel_report_generation_status import ( - GetExcelReportGenerationStatusRequest, - GetExcelReportGenerationStatusRequestTypedDict, - ) - from .get_loan_summary import ( - GetLoanSummaryQueryParamSourceType, - GetLoanSummaryRequest, - GetLoanSummaryRequestTypedDict, - ) - from .get_pull_operation import ( - GetPullOperationRequest, - GetPullOperationRequestTypedDict, - ) - from .is_aged_creditors_report_available import ( - IsAgedCreditorsReportAvailableRequest, - IsAgedCreditorsReportAvailableRequestTypedDict, - ) - from .is_aged_debtors_report_available import ( - IsAgedDebtorsReportAvailableRequest, - IsAgedDebtorsReportAvailableRequestTypedDict, - ) - from .list_accounting_account_transactions import ( - ListAccountingAccountTransactionsRequest, - ListAccountingAccountTransactionsRequestTypedDict, - ) - from .list_accounting_accounts import ( - ListAccountingAccountsRequest, - ListAccountingAccountsRequestTypedDict, - ) - from .list_accounting_bank_account_transactions import ( - ListAccountingBankAccountTransactionsRequest, - ListAccountingBankAccountTransactionsRequestTypedDict, - ) - from .list_accounting_bank_accounts import ( - ListAccountingBankAccountsRequest, - ListAccountingBankAccountsRequestTypedDict, - ) - from .list_accounting_bill_attachments import ( - ListAccountingBillAttachmentsRequest, - ListAccountingBillAttachmentsRequestTypedDict, - ) - from .list_accounting_bill_credit_notes import ( - ListAccountingBillCreditNotesRequest, - ListAccountingBillCreditNotesRequestTypedDict, - ) - from .list_accounting_bill_payments import ( - ListAccountingBillPaymentsRequest, - ListAccountingBillPaymentsRequestTypedDict, - ) - from .list_accounting_bills import ( - ListAccountingBillsRequest, - ListAccountingBillsRequestTypedDict, - ) - from .list_accounting_credit_notes import ( - ListAccountingCreditNotesRequest, - ListAccountingCreditNotesRequestTypedDict, - ) - from .list_accounting_customer_attachments import ( - ListAccountingCustomerAttachmentsRequest, - ListAccountingCustomerAttachmentsRequestTypedDict, - ) - from .list_accounting_customers import ( - ListAccountingCustomersRequest, - ListAccountingCustomersRequestTypedDict, - ) - from .list_accounting_direct_cost_attachments import ( - ListAccountingDirectCostAttachmentsRequest, - ListAccountingDirectCostAttachmentsRequestTypedDict, - ) - from .list_accounting_direct_costs import ( - ListAccountingDirectCostsRequest, - ListAccountingDirectCostsRequestTypedDict, - ) - from .list_accounting_direct_income_attachments import ( - ListAccountingDirectIncomeAttachmentsRequest, - ListAccountingDirectIncomeAttachmentsRequestTypedDict, - ) - from .list_accounting_direct_incomes import ( - ListAccountingDirectIncomesRequest, - ListAccountingDirectIncomesRequestTypedDict, - ) - from .list_accounting_invoice_attachments import ( - ListAccountingInvoiceAttachmentsRequest, - ListAccountingInvoiceAttachmentsRequestTypedDict, - ) - from .list_accounting_invoices import ( - ListAccountingInvoicesRequest, - ListAccountingInvoicesRequestTypedDict, - ) - from .list_accounting_journal_entries import ( - ListAccountingJournalEntriesRequest, - ListAccountingJournalEntriesRequestTypedDict, - ) - from .list_accounting_journals import ( - ListAccountingJournalsRequest, - ListAccountingJournalsRequestTypedDict, - ) - from .list_accounting_payments import ( - ListAccountingPaymentsRequest, - ListAccountingPaymentsRequestTypedDict, - ) - from .list_accounting_supplier_attachments import ( - ListAccountingSupplierAttachmentsRequest, - ListAccountingSupplierAttachmentsRequestTypedDict, - ) - from .list_accounting_suppliers import ( - ListAccountingSuppliersRequest, - ListAccountingSuppliersRequestTypedDict, - ) - from .list_accounting_transfers import ( - ListAccountingTransfersRequest, - ListAccountingTransfersRequestTypedDict, - ) - from .list_banking_account_balances import ( - ListBankingAccountBalancesRequest, - ListBankingAccountBalancesRequestTypedDict, - ) - from .list_banking_accounts import ( - ListBankingAccountsRequest, - ListBankingAccountsRequestTypedDict, - ) - from .list_banking_transaction_categories import ( - ListBankingTransactionCategoriesRequest, - ListBankingTransactionCategoriesRequestTypedDict, - ) - from .list_banking_transactions import ( - ListBankingTransactionsRequest, - ListBankingTransactionsRequestTypedDict, - ) - from .list_commerce_customers import ( - ListCommerceCustomersRequest, - ListCommerceCustomersRequestTypedDict, - ) - from .list_commerce_disputes import ( - ListCommerceDisputesRequest, - ListCommerceDisputesRequestTypedDict, - ) - from .list_commerce_locations import ( - ListCommerceLocationsRequest, - ListCommerceLocationsRequestTypedDict, - ) - from .list_commerce_orders import ( - ListCommerceOrdersRequest, - ListCommerceOrdersRequestTypedDict, - ) - from .list_commerce_payment_methods import ( - ListCommercePaymentMethodsRequest, - ListCommercePaymentMethodsRequestTypedDict, - ) - from .list_commerce_payments import ( - ListCommercePaymentsRequest, - ListCommercePaymentsRequestTypedDict, - ) - from .list_commerce_product_categories import ( - ListCommerceProductCategoriesRequest, - ListCommerceProductCategoriesRequestTypedDict, - ) - from .list_commerce_products import ( - ListCommerceProductsRequest, - ListCommerceProductsRequestTypedDict, - ) - from .list_commerce_transactions import ( - ListCommerceTransactionsRequest, - ListCommerceTransactionsRequestTypedDict, - ) - from .list_companies import ListCompaniesRequest, ListCompaniesRequestTypedDict - from .list_connections import ( - ListConnectionsRequest, - ListConnectionsRequestTypedDict, - ) - from .list_create_operations import ( - ListCreateOperationsRequest, - ListCreateOperationsRequestTypedDict, - ) - from .list_data_integrity_details import ( - ListDataIntegrityDetailsRequest, - ListDataIntegrityDetailsRequestTypedDict, - ) - from .list_files import ListFilesRequest, ListFilesRequestTypedDict - from .list_loan_transactions import ( - ListLoanTransactionsQueryParamSourceType, - ListLoanTransactionsRequest, - ListLoanTransactionsRequestTypedDict, - ) - from .list_pull_operations import ( - ListPullOperationsRequest, - ListPullOperationsRequestTypedDict, - ) - from .list_reconciled_invoices import ( - ListReconciledInvoicesRequest, - ListReconciledInvoicesRequestTypedDict, - ) - from .list_reports import ListReportsRequest, ListReportsRequestTypedDict - from .refresh_all_data_types import ( - RefreshAllDataTypesRequest, - RefreshAllDataTypesRequestTypedDict, - ) - from .refresh_data_type import ( - RefreshDataTypeRequest, - RefreshDataTypeRequestTypedDict, - ) - from .replace_company import ReplaceCompanyRequest, ReplaceCompanyRequestTypedDict - from .set_bank_statement_upload_configuration import ( - SetBankStatementUploadConfigurationRequest, - SetBankStatementUploadConfigurationRequestTypedDict, - ) - from .start_bank_statement_upload_session import ( - StartBankStatementUploadSessionRequest, - StartBankStatementUploadSessionRequestTypedDict, - ) - from .unlink_connection import ( - UnlinkConnectionRequest, - UnlinkConnectionRequestTypedDict, - UnlinkConnectionUpdateConnection, - UnlinkConnectionUpdateConnectionTypedDict, - ) - from .update_company import UpdateCompanyRequest, UpdateCompanyRequestTypedDict - from .upload_bank_statement_data import ( - UploadBankStatementDataRequest, - UploadBankStatementDataRequestBody, - UploadBankStatementDataRequestBodyTypedDict, - UploadBankStatementDataRequestTypedDict, - ) - from .upload_files import UploadFilesRequest, UploadFilesRequestTypedDict +# Speakeasy operations names POC defines elsewhere (response bodies, op-param enums). +from codat_lending.models.data_statuses import GetDataStatusDataStatuses +from codat_lending.models.operations.get_loan_summary import GetLoanSummaryQueryParamSourceType +from codat_lending.models.operations.list_loan_transactions import ListLoanTransactionsQueryParamSourceType +from codat_lending.models.operations.generate_loan_transactions import QueryParamSourceType +from codat_lending.models.operations.generate_loan_summary import SourceType +from codat_lending.models.operations.create_source_account_request_body import CreateSourceAccountRequestBody +from codat_lending.models.operations.create_source_account_request_body_typed_dict import CreateSourceAccountRequestBodyTypedDict +from codat_lending.models.operations.create_source_account_response_body import CreateSourceAccountResponseBody +from codat_lending.models.operations.create_source_account_response_body_typed_dict import CreateSourceAccountResponseBodyTypedDict +from codat_lending.models.operations.upload_bank_statement_data_request_body import UploadBankStatementDataRequestBody +from codat_lending.models.operations.upload_bank_statement_data_request_body_typed_dict import UploadBankStatementDataRequestBodyTypedDict -__all__ = [ - "CreateAccountRequest", - "CreateAccountRequestTypedDict", - "CreateBankAccountMappingRequest", - "CreateBankAccountMappingRequestTypedDict", - "CreateBankAccountRequest", - "CreateBankAccountRequestTypedDict", - "CreateBankTransactionsRequest", - "CreateBankTransactionsRequestTypedDict", - "CreateConnectionRequest", - "CreateConnectionRequestBody", - "CreateConnectionRequestBodyTypedDict", - "CreateConnectionRequestTypedDict", - "CreateDirectCostRequest", - "CreateDirectCostRequestTypedDict", - "CreatePaymentRequest", - "CreatePaymentRequestTypedDict", - "CreateSourceAccountRequest", - "CreateSourceAccountRequestBody", - "CreateSourceAccountRequestBodyTypedDict", - "CreateSourceAccountRequestTypedDict", - "CreateSourceAccountResponseBody", - "CreateSourceAccountResponseBodyTypedDict", - "CreateSupplierRequest", - "CreateSupplierRequestTypedDict", - "CreateTransferRequest", - "CreateTransferRequestTypedDict", - "DeleteCompanyRequest", - "DeleteCompanyRequestTypedDict", - "DeleteConnectionRequest", - "DeleteConnectionRequestTypedDict", - "DownloadAccountingBillAttachmentRequest", - "DownloadAccountingBillAttachmentRequestTypedDict", - "DownloadAccountingCustomerAttachmentRequest", - "DownloadAccountingCustomerAttachmentRequestTypedDict", - "DownloadAccountingDirectCostAttachmentRequest", - "DownloadAccountingDirectCostAttachmentRequestTypedDict", - "DownloadAccountingDirectIncomeAttachmentRequest", - "DownloadAccountingDirectIncomeAttachmentRequestTypedDict", - "DownloadAccountingInvoiceAttachmentRequest", - "DownloadAccountingInvoiceAttachmentRequestTypedDict", - "DownloadAccountingInvoicePdfRequest", - "DownloadAccountingInvoicePdfRequestTypedDict", - "DownloadAccountingSupplierAttachmentRequest", - "DownloadAccountingSupplierAttachmentRequestTypedDict", - "DownloadExcelReportRequest", - "DownloadExcelReportRequestTypedDict", - "DownloadFilesRequest", - "DownloadFilesRequestTypedDict", - "EndBankStatementUploadSessionRequest", - "EndBankStatementUploadSessionRequestTypedDict", - "GenerateExcelReportRequest", - "GenerateExcelReportRequestTypedDict", - "GenerateLoanSummaryRequest", - "GenerateLoanSummaryRequestTypedDict", - "GenerateLoanTransactionsRequest", - "GenerateLoanTransactionsRequestTypedDict", - "GenerateReportRequest", - "GenerateReportRequestTypedDict", - "GetAccountingAccountRequest", - "GetAccountingAccountRequestTypedDict", - "GetAccountingAccountTransactionRequest", - "GetAccountingAccountTransactionRequestTypedDict", - "GetAccountingAgedCreditorsReportRequest", - "GetAccountingAgedCreditorsReportRequestTypedDict", - "GetAccountingAgedDebtorsReportRequest", - "GetAccountingAgedDebtorsReportRequestTypedDict", - "GetAccountingBalanceSheetRequest", - "GetAccountingBalanceSheetRequestTypedDict", - "GetAccountingBankAccountRequest", - "GetAccountingBankAccountRequestTypedDict", - "GetAccountingBillAttachmentRequest", - "GetAccountingBillAttachmentRequestTypedDict", - "GetAccountingBillCreditNoteRequest", - "GetAccountingBillCreditNoteRequestTypedDict", - "GetAccountingBillPaymentRequest", - "GetAccountingBillPaymentRequestTypedDict", - "GetAccountingBillRequest", - "GetAccountingBillRequestTypedDict", - "GetAccountingCashFlowStatementRequest", - "GetAccountingCashFlowStatementRequestTypedDict", - "GetAccountingCreditNoteRequest", - "GetAccountingCreditNoteRequestTypedDict", - "GetAccountingCustomerAttachmentRequest", - "GetAccountingCustomerAttachmentRequestTypedDict", - "GetAccountingCustomerRequest", - "GetAccountingCustomerRequestTypedDict", - "GetAccountingDirectCostAttachmentRequest", - "GetAccountingDirectCostAttachmentRequestTypedDict", - "GetAccountingDirectCostRequest", - "GetAccountingDirectCostRequestTypedDict", - "GetAccountingDirectIncomeAttachmentRequest", - "GetAccountingDirectIncomeAttachmentRequestTypedDict", - "GetAccountingDirectIncomeRequest", - "GetAccountingDirectIncomeRequestTypedDict", - "GetAccountingInvoiceAttachmentRequest", - "GetAccountingInvoiceAttachmentRequestTypedDict", - "GetAccountingInvoiceRequest", - "GetAccountingInvoiceRequestTypedDict", - "GetAccountingJournalEntryRequest", - "GetAccountingJournalEntryRequestTypedDict", - "GetAccountingJournalRequest", - "GetAccountingJournalRequestTypedDict", - "GetAccountingPaymentRequest", - "GetAccountingPaymentRequestTypedDict", - "GetAccountingProfileRequest", - "GetAccountingProfileRequestTypedDict", - "GetAccountingProfitAndLossRequest", - "GetAccountingProfitAndLossRequestTypedDict", - "GetAccountingSupplierAttachmentRequest", - "GetAccountingSupplierAttachmentRequestTypedDict", - "GetAccountingSupplierRequest", - "GetAccountingSupplierRequestTypedDict", - "GetAccountingTransferRequest", - "GetAccountingTransferRequestTypedDict", - "GetBankAccountMappingRequest", - "GetBankAccountMappingRequestTypedDict", - "GetBankStatementUploadConfigurationRequest", - "GetBankStatementUploadConfigurationRequestTypedDict", - "GetBankingAccountRequest", - "GetBankingAccountRequestTypedDict", - "GetBankingTransactionCategoryRequest", - "GetBankingTransactionCategoryRequestTypedDict", - "GetBankingTransactionRequest", - "GetBankingTransactionRequestTypedDict", - "GetCategorizedBalanceSheetStatementRequest", - "GetCategorizedBalanceSheetStatementRequestTypedDict", - "GetCategorizedBankStatementRequest", - "GetCategorizedBankStatementRequestTypedDict", - "GetCategorizedProfitAndLossStatementRequest", - "GetCategorizedProfitAndLossStatementRequestTypedDict", - "GetCommerceCustomerRequest", - "GetCommerceCustomerRequestTypedDict", - "GetCommerceCustomerRetentionMetricsRequest", - "GetCommerceCustomerRetentionMetricsRequestTypedDict", - "GetCommerceDisputeRequest", - "GetCommerceDisputeRequestTypedDict", - "GetCommerceLifetimeValueMetricsRequest", - "GetCommerceLifetimeValueMetricsRequestTypedDict", - "GetCommerceLocationRequest", - "GetCommerceLocationRequestTypedDict", - "GetCommerceOrderRequest", - "GetCommerceOrderRequestTypedDict", - "GetCommerceOrdersReportRequest", - "GetCommerceOrdersReportRequestTypedDict", - "GetCommercePaymentMethodRequest", - "GetCommercePaymentMethodRequestTypedDict", - "GetCommercePaymentRequest", - "GetCommercePaymentRequestTypedDict", - "GetCommerceProductCategoryRequest", - "GetCommerceProductCategoryRequestTypedDict", - "GetCommerceProductRequest", - "GetCommerceProductRequestTypedDict", - "GetCommerceProfileRequest", - "GetCommerceProfileRequestTypedDict", - "GetCommerceRefundsReportRequest", - "GetCommerceRefundsReportRequestTypedDict", - "GetCommerceRevenueMetricsRequest", - "GetCommerceRevenueMetricsRequestTypedDict", - "GetCommerceTransactionRequest", - "GetCommerceTransactionRequestTypedDict", - "GetCompanyRequest", - "GetCompanyRequestTypedDict", - "GetConnectionRequest", - "GetConnectionRequestTypedDict", - "GetCreateBankTransactionsModelRequest", - "GetCreateBankTransactionsModelRequestTypedDict", - "GetCreateChartOfAccountsModelRequest", - "GetCreateChartOfAccountsModelRequestTypedDict", - "GetCreateDirectCostsModelRequest", - "GetCreateDirectCostsModelRequestTypedDict", - "GetCreateOperationRequest", - "GetCreateOperationRequestTypedDict", - "GetCreatePaymentModelRequest", - "GetCreatePaymentModelRequestTypedDict", - "GetCreateTransfersModelRequest", - "GetCreateTransfersModelRequestTypedDict", - "GetCreateUpdateBankAccountsModelRequest", - "GetCreateUpdateBankAccountsModelRequestTypedDict", - "GetCreateUpdateSuppliersModelRequest", - "GetCreateUpdateSuppliersModelRequestTypedDict", - "GetDataIntegrityStatusRequest", - "GetDataIntegrityStatusRequestTypedDict", - "GetDataIntegritySummariesRequest", - "GetDataIntegritySummariesRequestTypedDict", - "GetDataStatusDataStatuses", - "GetDataStatusDataStatusesTypedDict", - "GetDataStatusRequest", - "GetDataStatusRequestTypedDict", - "GetExcelReportGenerationStatusRequest", - "GetExcelReportGenerationStatusRequestTypedDict", - "GetLoanSummaryQueryParamSourceType", - "GetLoanSummaryRequest", - "GetLoanSummaryRequestTypedDict", - "GetPullOperationRequest", - "GetPullOperationRequestTypedDict", - "IsAgedCreditorsReportAvailableRequest", - "IsAgedCreditorsReportAvailableRequestTypedDict", - "IsAgedDebtorsReportAvailableRequest", - "IsAgedDebtorsReportAvailableRequestTypedDict", - "ListAccountingAccountTransactionsRequest", - "ListAccountingAccountTransactionsRequestTypedDict", - "ListAccountingAccountsRequest", - "ListAccountingAccountsRequestTypedDict", - "ListAccountingBankAccountTransactionsRequest", - "ListAccountingBankAccountTransactionsRequestTypedDict", - "ListAccountingBankAccountsRequest", - "ListAccountingBankAccountsRequestTypedDict", - "ListAccountingBillAttachmentsRequest", - "ListAccountingBillAttachmentsRequestTypedDict", - "ListAccountingBillCreditNotesRequest", - "ListAccountingBillCreditNotesRequestTypedDict", - "ListAccountingBillPaymentsRequest", - "ListAccountingBillPaymentsRequestTypedDict", - "ListAccountingBillsRequest", - "ListAccountingBillsRequestTypedDict", - "ListAccountingCreditNotesRequest", - "ListAccountingCreditNotesRequestTypedDict", - "ListAccountingCustomerAttachmentsRequest", - "ListAccountingCustomerAttachmentsRequestTypedDict", - "ListAccountingCustomersRequest", - "ListAccountingCustomersRequestTypedDict", - "ListAccountingDirectCostAttachmentsRequest", - "ListAccountingDirectCostAttachmentsRequestTypedDict", - "ListAccountingDirectCostsRequest", - "ListAccountingDirectCostsRequestTypedDict", - "ListAccountingDirectIncomeAttachmentsRequest", - "ListAccountingDirectIncomeAttachmentsRequestTypedDict", - "ListAccountingDirectIncomesRequest", - "ListAccountingDirectIncomesRequestTypedDict", - "ListAccountingInvoiceAttachmentsRequest", - "ListAccountingInvoiceAttachmentsRequestTypedDict", - "ListAccountingInvoicesRequest", - "ListAccountingInvoicesRequestTypedDict", - "ListAccountingJournalEntriesRequest", - "ListAccountingJournalEntriesRequestTypedDict", - "ListAccountingJournalsRequest", - "ListAccountingJournalsRequestTypedDict", - "ListAccountingPaymentsRequest", - "ListAccountingPaymentsRequestTypedDict", - "ListAccountingSupplierAttachmentsRequest", - "ListAccountingSupplierAttachmentsRequestTypedDict", - "ListAccountingSuppliersRequest", - "ListAccountingSuppliersRequestTypedDict", - "ListAccountingTransfersRequest", - "ListAccountingTransfersRequestTypedDict", - "ListBankingAccountBalancesRequest", - "ListBankingAccountBalancesRequestTypedDict", - "ListBankingAccountsRequest", - "ListBankingAccountsRequestTypedDict", - "ListBankingTransactionCategoriesRequest", - "ListBankingTransactionCategoriesRequestTypedDict", - "ListBankingTransactionsRequest", - "ListBankingTransactionsRequestTypedDict", - "ListCommerceCustomersRequest", - "ListCommerceCustomersRequestTypedDict", - "ListCommerceDisputesRequest", - "ListCommerceDisputesRequestTypedDict", - "ListCommerceLocationsRequest", - "ListCommerceLocationsRequestTypedDict", - "ListCommerceOrdersRequest", - "ListCommerceOrdersRequestTypedDict", - "ListCommercePaymentMethodsRequest", - "ListCommercePaymentMethodsRequestTypedDict", - "ListCommercePaymentsRequest", - "ListCommercePaymentsRequestTypedDict", - "ListCommerceProductCategoriesRequest", - "ListCommerceProductCategoriesRequestTypedDict", - "ListCommerceProductsRequest", - "ListCommerceProductsRequestTypedDict", - "ListCommerceTransactionsRequest", - "ListCommerceTransactionsRequestTypedDict", - "ListCompaniesRequest", - "ListCompaniesRequestTypedDict", - "ListConnectionsRequest", - "ListConnectionsRequestTypedDict", - "ListCreateOperationsRequest", - "ListCreateOperationsRequestTypedDict", - "ListDataIntegrityDetailsRequest", - "ListDataIntegrityDetailsRequestTypedDict", - "ListFilesRequest", - "ListFilesRequestTypedDict", - "ListLoanTransactionsQueryParamSourceType", - "ListLoanTransactionsRequest", - "ListLoanTransactionsRequestTypedDict", - "ListPullOperationsRequest", - "ListPullOperationsRequestTypedDict", - "ListReconciledInvoicesRequest", - "ListReconciledInvoicesRequestTypedDict", - "ListReportsRequest", - "ListReportsRequestTypedDict", - "QueryParamSourceType", - "RefreshAllDataTypesRequest", - "RefreshAllDataTypesRequestTypedDict", - "RefreshDataTypeRequest", - "RefreshDataTypeRequestTypedDict", - "ReplaceCompanyRequest", - "ReplaceCompanyRequestTypedDict", - "SetBankStatementUploadConfigurationRequest", - "SetBankStatementUploadConfigurationRequestTypedDict", - "SourceType", - "StartBankStatementUploadSessionRequest", - "StartBankStatementUploadSessionRequestTypedDict", - "UnlinkConnectionRequest", - "UnlinkConnectionRequestTypedDict", - "UnlinkConnectionUpdateConnection", - "UnlinkConnectionUpdateConnectionTypedDict", - "UpdateCompanyRequest", - "UpdateCompanyRequestTypedDict", - "UploadBankStatementDataRequest", - "UploadBankStatementDataRequestBody", - "UploadBankStatementDataRequestBodyTypedDict", - "UploadBankStatementDataRequestTypedDict", - "UploadFilesRequest", - "UploadFilesRequestTypedDict", -] - -_dynamic_imports: dict[str, str] = { - "CreateAccountRequest": ".create_account", - "CreateAccountRequestTypedDict": ".create_account", - "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", - "CreateConnectionRequest": ".create_connection", - "CreateConnectionRequestBody": ".create_connection", - "CreateConnectionRequestBodyTypedDict": ".create_connection", - "CreateConnectionRequestTypedDict": ".create_connection", - "CreateDirectCostRequest": ".create_direct_cost", - "CreateDirectCostRequestTypedDict": ".create_direct_cost", - "CreatePaymentRequest": ".create_payment", - "CreatePaymentRequestTypedDict": ".create_payment", - "CreateSourceAccountRequest": ".create_source_account", - "CreateSourceAccountRequestBody": ".create_source_account", - "CreateSourceAccountRequestBodyTypedDict": ".create_source_account", - "CreateSourceAccountRequestTypedDict": ".create_source_account", - "CreateSourceAccountResponseBody": ".create_source_account", - "CreateSourceAccountResponseBodyTypedDict": ".create_source_account", - "CreateSupplierRequest": ".create_supplier", - "CreateSupplierRequestTypedDict": ".create_supplier", - "CreateTransferRequest": ".create_transfer", - "CreateTransferRequestTypedDict": ".create_transfer", - "DeleteCompanyRequest": ".delete_company", - "DeleteCompanyRequestTypedDict": ".delete_company", - "DeleteConnectionRequest": ".delete_connection", - "DeleteConnectionRequestTypedDict": ".delete_connection", - "DownloadAccountingBillAttachmentRequest": ".download_accounting_bill_attachment", - "DownloadAccountingBillAttachmentRequestTypedDict": ".download_accounting_bill_attachment", - "DownloadAccountingCustomerAttachmentRequest": ".download_accounting_customer_attachment", - "DownloadAccountingCustomerAttachmentRequestTypedDict": ".download_accounting_customer_attachment", - "DownloadAccountingDirectCostAttachmentRequest": ".download_accounting_direct_cost_attachment", - "DownloadAccountingDirectCostAttachmentRequestTypedDict": ".download_accounting_direct_cost_attachment", - "DownloadAccountingDirectIncomeAttachmentRequest": ".download_accounting_direct_income_attachment", - "DownloadAccountingDirectIncomeAttachmentRequestTypedDict": ".download_accounting_direct_income_attachment", - "DownloadAccountingInvoiceAttachmentRequest": ".download_accounting_invoice_attachment", - "DownloadAccountingInvoiceAttachmentRequestTypedDict": ".download_accounting_invoice_attachment", - "DownloadAccountingInvoicePdfRequest": ".download_accounting_invoice_pdf", - "DownloadAccountingInvoicePdfRequestTypedDict": ".download_accounting_invoice_pdf", - "DownloadAccountingSupplierAttachmentRequest": ".download_accounting_supplier_attachment", - "DownloadAccountingSupplierAttachmentRequestTypedDict": ".download_accounting_supplier_attachment", - "DownloadExcelReportRequest": ".download_excel_report", - "DownloadExcelReportRequestTypedDict": ".download_excel_report", - "DownloadFilesRequest": ".download_files", - "DownloadFilesRequestTypedDict": ".download_files", - "EndBankStatementUploadSessionRequest": ".end_bank_statement_upload_session", - "EndBankStatementUploadSessionRequestTypedDict": ".end_bank_statement_upload_session", - "GenerateExcelReportRequest": ".generate_excel_report", - "GenerateExcelReportRequestTypedDict": ".generate_excel_report", - "GenerateLoanSummaryRequest": ".generate_loan_summary", - "GenerateLoanSummaryRequestTypedDict": ".generate_loan_summary", - "SourceType": ".generate_loan_summary", - "GenerateLoanTransactionsRequest": ".generate_loan_transactions", - "GenerateLoanTransactionsRequestTypedDict": ".generate_loan_transactions", - "QueryParamSourceType": ".generate_loan_transactions", - "GenerateReportRequest": ".generate_report", - "GenerateReportRequestTypedDict": ".generate_report", - "GetAccountingAccountRequest": ".get_accounting_account", - "GetAccountingAccountRequestTypedDict": ".get_accounting_account", - "GetAccountingAccountTransactionRequest": ".get_accounting_account_transaction", - "GetAccountingAccountTransactionRequestTypedDict": ".get_accounting_account_transaction", - "GetAccountingAgedCreditorsReportRequest": ".get_accounting_aged_creditors_report", - "GetAccountingAgedCreditorsReportRequestTypedDict": ".get_accounting_aged_creditors_report", - "GetAccountingAgedDebtorsReportRequest": ".get_accounting_aged_debtors_report", - "GetAccountingAgedDebtorsReportRequestTypedDict": ".get_accounting_aged_debtors_report", - "GetAccountingBalanceSheetRequest": ".get_accounting_balance_sheet", - "GetAccountingBalanceSheetRequestTypedDict": ".get_accounting_balance_sheet", - "GetAccountingBankAccountRequest": ".get_accounting_bank_account", - "GetAccountingBankAccountRequestTypedDict": ".get_accounting_bank_account", - "GetAccountingBillRequest": ".get_accounting_bill", - "GetAccountingBillRequestTypedDict": ".get_accounting_bill", - "GetAccountingBillAttachmentRequest": ".get_accounting_bill_attachment", - "GetAccountingBillAttachmentRequestTypedDict": ".get_accounting_bill_attachment", - "GetAccountingBillCreditNoteRequest": ".get_accounting_bill_credit_note", - "GetAccountingBillCreditNoteRequestTypedDict": ".get_accounting_bill_credit_note", - "GetAccountingBillPaymentRequest": ".get_accounting_bill_payment", - "GetAccountingBillPaymentRequestTypedDict": ".get_accounting_bill_payment", - "GetAccountingCashFlowStatementRequest": ".get_accounting_cash_flow_statement", - "GetAccountingCashFlowStatementRequestTypedDict": ".get_accounting_cash_flow_statement", - "GetAccountingCreditNoteRequest": ".get_accounting_credit_note", - "GetAccountingCreditNoteRequestTypedDict": ".get_accounting_credit_note", - "GetAccountingCustomerRequest": ".get_accounting_customer", - "GetAccountingCustomerRequestTypedDict": ".get_accounting_customer", - "GetAccountingCustomerAttachmentRequest": ".get_accounting_customer_attachment", - "GetAccountingCustomerAttachmentRequestTypedDict": ".get_accounting_customer_attachment", - "GetAccountingDirectCostRequest": ".get_accounting_direct_cost", - "GetAccountingDirectCostRequestTypedDict": ".get_accounting_direct_cost", - "GetAccountingDirectCostAttachmentRequest": ".get_accounting_direct_cost_attachment", - "GetAccountingDirectCostAttachmentRequestTypedDict": ".get_accounting_direct_cost_attachment", - "GetAccountingDirectIncomeRequest": ".get_accounting_direct_income", - "GetAccountingDirectIncomeRequestTypedDict": ".get_accounting_direct_income", - "GetAccountingDirectIncomeAttachmentRequest": ".get_accounting_direct_income_attachment", - "GetAccountingDirectIncomeAttachmentRequestTypedDict": ".get_accounting_direct_income_attachment", - "GetAccountingInvoiceRequest": ".get_accounting_invoice", - "GetAccountingInvoiceRequestTypedDict": ".get_accounting_invoice", - "GetAccountingInvoiceAttachmentRequest": ".get_accounting_invoice_attachment", - "GetAccountingInvoiceAttachmentRequestTypedDict": ".get_accounting_invoice_attachment", - "GetAccountingJournalRequest": ".get_accounting_journal", - "GetAccountingJournalRequestTypedDict": ".get_accounting_journal", - "GetAccountingJournalEntryRequest": ".get_accounting_journal_entry", - "GetAccountingJournalEntryRequestTypedDict": ".get_accounting_journal_entry", - "GetAccountingPaymentRequest": ".get_accounting_payment", - "GetAccountingPaymentRequestTypedDict": ".get_accounting_payment", - "GetAccountingProfileRequest": ".get_accounting_profile", - "GetAccountingProfileRequestTypedDict": ".get_accounting_profile", - "GetAccountingProfitAndLossRequest": ".get_accounting_profit_and_loss", - "GetAccountingProfitAndLossRequestTypedDict": ".get_accounting_profit_and_loss", - "GetAccountingSupplierRequest": ".get_accounting_supplier", - "GetAccountingSupplierRequestTypedDict": ".get_accounting_supplier", - "GetAccountingSupplierAttachmentRequest": ".get_accounting_supplier_attachment", - "GetAccountingSupplierAttachmentRequestTypedDict": ".get_accounting_supplier_attachment", - "GetAccountingTransferRequest": ".get_accounting_transfer", - "GetAccountingTransferRequestTypedDict": ".get_accounting_transfer", - "GetBankAccountMappingRequest": ".get_bank_account_mapping", - "GetBankAccountMappingRequestTypedDict": ".get_bank_account_mapping", - "GetBankStatementUploadConfigurationRequest": ".get_bank_statement_upload_configuration", - "GetBankStatementUploadConfigurationRequestTypedDict": ".get_bank_statement_upload_configuration", - "GetBankingAccountRequest": ".get_banking_account", - "GetBankingAccountRequestTypedDict": ".get_banking_account", - "GetBankingTransactionRequest": ".get_banking_transaction", - "GetBankingTransactionRequestTypedDict": ".get_banking_transaction", - "GetBankingTransactionCategoryRequest": ".get_banking_transaction_category", - "GetBankingTransactionCategoryRequestTypedDict": ".get_banking_transaction_category", - "GetCategorizedBalanceSheetStatementRequest": ".get_categorized_balance_sheet_statement", - "GetCategorizedBalanceSheetStatementRequestTypedDict": ".get_categorized_balance_sheet_statement", - "GetCategorizedBankStatementRequest": ".get_categorized_bank_statement", - "GetCategorizedBankStatementRequestTypedDict": ".get_categorized_bank_statement", - "GetCategorizedProfitAndLossStatementRequest": ".get_categorized_profit_and_loss_statement", - "GetCategorizedProfitAndLossStatementRequestTypedDict": ".get_categorized_profit_and_loss_statement", - "GetCommerceCustomerRequest": ".get_commerce_customer", - "GetCommerceCustomerRequestTypedDict": ".get_commerce_customer", - "GetCommerceCustomerRetentionMetricsRequest": ".get_commerce_customer_retention_metrics", - "GetCommerceCustomerRetentionMetricsRequestTypedDict": ".get_commerce_customer_retention_metrics", - "GetCommerceDisputeRequest": ".get_commerce_dispute", - "GetCommerceDisputeRequestTypedDict": ".get_commerce_dispute", - "GetCommerceLifetimeValueMetricsRequest": ".get_commerce_lifetime_value_metrics", - "GetCommerceLifetimeValueMetricsRequestTypedDict": ".get_commerce_lifetime_value_metrics", - "GetCommerceLocationRequest": ".get_commerce_location", - "GetCommerceLocationRequestTypedDict": ".get_commerce_location", - "GetCommerceOrderRequest": ".get_commerce_order", - "GetCommerceOrderRequestTypedDict": ".get_commerce_order", - "GetCommerceOrdersReportRequest": ".get_commerce_orders_report", - "GetCommerceOrdersReportRequestTypedDict": ".get_commerce_orders_report", - "GetCommercePaymentRequest": ".get_commerce_payment", - "GetCommercePaymentRequestTypedDict": ".get_commerce_payment", - "GetCommercePaymentMethodRequest": ".get_commerce_payment_method", - "GetCommercePaymentMethodRequestTypedDict": ".get_commerce_payment_method", - "GetCommerceProductRequest": ".get_commerce_product", - "GetCommerceProductRequestTypedDict": ".get_commerce_product", - "GetCommerceProductCategoryRequest": ".get_commerce_product_category", - "GetCommerceProductCategoryRequestTypedDict": ".get_commerce_product_category", - "GetCommerceProfileRequest": ".get_commerce_profile", - "GetCommerceProfileRequestTypedDict": ".get_commerce_profile", - "GetCommerceRefundsReportRequest": ".get_commerce_refunds_report", - "GetCommerceRefundsReportRequestTypedDict": ".get_commerce_refunds_report", - "GetCommerceRevenueMetricsRequest": ".get_commerce_revenue_metrics", - "GetCommerceRevenueMetricsRequestTypedDict": ".get_commerce_revenue_metrics", - "GetCommerceTransactionRequest": ".get_commerce_transaction", - "GetCommerceTransactionRequestTypedDict": ".get_commerce_transaction", - "GetCompanyRequest": ".get_company", - "GetCompanyRequestTypedDict": ".get_company", - "GetConnectionRequest": ".get_connection", - "GetConnectionRequestTypedDict": ".get_connection", - "GetCreateBankTransactionsModelRequest": ".get_create_bank_transactions_model", - "GetCreateBankTransactionsModelRequestTypedDict": ".get_create_bank_transactions_model", - "GetCreateChartOfAccountsModelRequest": ".get_create_chartofaccounts_model", - "GetCreateChartOfAccountsModelRequestTypedDict": ".get_create_chartofaccounts_model", - "GetCreateDirectCostsModelRequest": ".get_create_directcosts_model", - "GetCreateDirectCostsModelRequestTypedDict": ".get_create_directcosts_model", - "GetCreateOperationRequest": ".get_create_operation", - "GetCreateOperationRequestTypedDict": ".get_create_operation", - "GetCreatePaymentModelRequest": ".get_create_payment_model", - "GetCreatePaymentModelRequestTypedDict": ".get_create_payment_model", - "GetCreateTransfersModelRequest": ".get_create_transfers_model", - "GetCreateTransfersModelRequestTypedDict": ".get_create_transfers_model", - "GetCreateUpdateBankAccountsModelRequest": ".get_create_update_bankaccounts_model", - "GetCreateUpdateBankAccountsModelRequestTypedDict": ".get_create_update_bankaccounts_model", - "GetCreateUpdateSuppliersModelRequest": ".get_create_update_suppliers_model", - "GetCreateUpdateSuppliersModelRequestTypedDict": ".get_create_update_suppliers_model", - "GetDataIntegrityStatusRequest": ".get_data_integrity_status", - "GetDataIntegrityStatusRequestTypedDict": ".get_data_integrity_status", - "GetDataIntegritySummariesRequest": ".get_data_integrity_summaries", - "GetDataIntegritySummariesRequestTypedDict": ".get_data_integrity_summaries", - "GetDataStatusDataStatuses": ".get_data_status", - "GetDataStatusDataStatusesTypedDict": ".get_data_status", - "GetDataStatusRequest": ".get_data_status", - "GetDataStatusRequestTypedDict": ".get_data_status", - "GetExcelReportGenerationStatusRequest": ".get_excel_report_generation_status", - "GetExcelReportGenerationStatusRequestTypedDict": ".get_excel_report_generation_status", - "GetLoanSummaryQueryParamSourceType": ".get_loan_summary", - "GetLoanSummaryRequest": ".get_loan_summary", - "GetLoanSummaryRequestTypedDict": ".get_loan_summary", - "GetPullOperationRequest": ".get_pull_operation", - "GetPullOperationRequestTypedDict": ".get_pull_operation", - "IsAgedCreditorsReportAvailableRequest": ".is_aged_creditors_report_available", - "IsAgedCreditorsReportAvailableRequestTypedDict": ".is_aged_creditors_report_available", - "IsAgedDebtorsReportAvailableRequest": ".is_aged_debtors_report_available", - "IsAgedDebtorsReportAvailableRequestTypedDict": ".is_aged_debtors_report_available", - "ListAccountingAccountTransactionsRequest": ".list_accounting_account_transactions", - "ListAccountingAccountTransactionsRequestTypedDict": ".list_accounting_account_transactions", - "ListAccountingAccountsRequest": ".list_accounting_accounts", - "ListAccountingAccountsRequestTypedDict": ".list_accounting_accounts", - "ListAccountingBankAccountTransactionsRequest": ".list_accounting_bank_account_transactions", - "ListAccountingBankAccountTransactionsRequestTypedDict": ".list_accounting_bank_account_transactions", - "ListAccountingBankAccountsRequest": ".list_accounting_bank_accounts", - "ListAccountingBankAccountsRequestTypedDict": ".list_accounting_bank_accounts", - "ListAccountingBillAttachmentsRequest": ".list_accounting_bill_attachments", - "ListAccountingBillAttachmentsRequestTypedDict": ".list_accounting_bill_attachments", - "ListAccountingBillCreditNotesRequest": ".list_accounting_bill_credit_notes", - "ListAccountingBillCreditNotesRequestTypedDict": ".list_accounting_bill_credit_notes", - "ListAccountingBillPaymentsRequest": ".list_accounting_bill_payments", - "ListAccountingBillPaymentsRequestTypedDict": ".list_accounting_bill_payments", - "ListAccountingBillsRequest": ".list_accounting_bills", - "ListAccountingBillsRequestTypedDict": ".list_accounting_bills", - "ListAccountingCreditNotesRequest": ".list_accounting_credit_notes", - "ListAccountingCreditNotesRequestTypedDict": ".list_accounting_credit_notes", - "ListAccountingCustomerAttachmentsRequest": ".list_accounting_customer_attachments", - "ListAccountingCustomerAttachmentsRequestTypedDict": ".list_accounting_customer_attachments", - "ListAccountingCustomersRequest": ".list_accounting_customers", - "ListAccountingCustomersRequestTypedDict": ".list_accounting_customers", - "ListAccountingDirectCostAttachmentsRequest": ".list_accounting_direct_cost_attachments", - "ListAccountingDirectCostAttachmentsRequestTypedDict": ".list_accounting_direct_cost_attachments", - "ListAccountingDirectCostsRequest": ".list_accounting_direct_costs", - "ListAccountingDirectCostsRequestTypedDict": ".list_accounting_direct_costs", - "ListAccountingDirectIncomeAttachmentsRequest": ".list_accounting_direct_income_attachments", - "ListAccountingDirectIncomeAttachmentsRequestTypedDict": ".list_accounting_direct_income_attachments", - "ListAccountingDirectIncomesRequest": ".list_accounting_direct_incomes", - "ListAccountingDirectIncomesRequestTypedDict": ".list_accounting_direct_incomes", - "ListAccountingInvoiceAttachmentsRequest": ".list_accounting_invoice_attachments", - "ListAccountingInvoiceAttachmentsRequestTypedDict": ".list_accounting_invoice_attachments", - "ListAccountingInvoicesRequest": ".list_accounting_invoices", - "ListAccountingInvoicesRequestTypedDict": ".list_accounting_invoices", - "ListAccountingJournalEntriesRequest": ".list_accounting_journal_entries", - "ListAccountingJournalEntriesRequestTypedDict": ".list_accounting_journal_entries", - "ListAccountingJournalsRequest": ".list_accounting_journals", - "ListAccountingJournalsRequestTypedDict": ".list_accounting_journals", - "ListAccountingPaymentsRequest": ".list_accounting_payments", - "ListAccountingPaymentsRequestTypedDict": ".list_accounting_payments", - "ListAccountingSupplierAttachmentsRequest": ".list_accounting_supplier_attachments", - "ListAccountingSupplierAttachmentsRequestTypedDict": ".list_accounting_supplier_attachments", - "ListAccountingSuppliersRequest": ".list_accounting_suppliers", - "ListAccountingSuppliersRequestTypedDict": ".list_accounting_suppliers", - "ListAccountingTransfersRequest": ".list_accounting_transfers", - "ListAccountingTransfersRequestTypedDict": ".list_accounting_transfers", - "ListBankingAccountBalancesRequest": ".list_banking_account_balances", - "ListBankingAccountBalancesRequestTypedDict": ".list_banking_account_balances", - "ListBankingAccountsRequest": ".list_banking_accounts", - "ListBankingAccountsRequestTypedDict": ".list_banking_accounts", - "ListBankingTransactionCategoriesRequest": ".list_banking_transaction_categories", - "ListBankingTransactionCategoriesRequestTypedDict": ".list_banking_transaction_categories", - "ListBankingTransactionsRequest": ".list_banking_transactions", - "ListBankingTransactionsRequestTypedDict": ".list_banking_transactions", - "ListCommerceCustomersRequest": ".list_commerce_customers", - "ListCommerceCustomersRequestTypedDict": ".list_commerce_customers", - "ListCommerceDisputesRequest": ".list_commerce_disputes", - "ListCommerceDisputesRequestTypedDict": ".list_commerce_disputes", - "ListCommerceLocationsRequest": ".list_commerce_locations", - "ListCommerceLocationsRequestTypedDict": ".list_commerce_locations", - "ListCommerceOrdersRequest": ".list_commerce_orders", - "ListCommerceOrdersRequestTypedDict": ".list_commerce_orders", - "ListCommercePaymentMethodsRequest": ".list_commerce_payment_methods", - "ListCommercePaymentMethodsRequestTypedDict": ".list_commerce_payment_methods", - "ListCommercePaymentsRequest": ".list_commerce_payments", - "ListCommercePaymentsRequestTypedDict": ".list_commerce_payments", - "ListCommerceProductCategoriesRequest": ".list_commerce_product_categories", - "ListCommerceProductCategoriesRequestTypedDict": ".list_commerce_product_categories", - "ListCommerceProductsRequest": ".list_commerce_products", - "ListCommerceProductsRequestTypedDict": ".list_commerce_products", - "ListCommerceTransactionsRequest": ".list_commerce_transactions", - "ListCommerceTransactionsRequestTypedDict": ".list_commerce_transactions", - "ListCompaniesRequest": ".list_companies", - "ListCompaniesRequestTypedDict": ".list_companies", - "ListConnectionsRequest": ".list_connections", - "ListConnectionsRequestTypedDict": ".list_connections", - "ListCreateOperationsRequest": ".list_create_operations", - "ListCreateOperationsRequestTypedDict": ".list_create_operations", - "ListDataIntegrityDetailsRequest": ".list_data_integrity_details", - "ListDataIntegrityDetailsRequestTypedDict": ".list_data_integrity_details", - "ListFilesRequest": ".list_files", - "ListFilesRequestTypedDict": ".list_files", - "ListLoanTransactionsQueryParamSourceType": ".list_loan_transactions", - "ListLoanTransactionsRequest": ".list_loan_transactions", - "ListLoanTransactionsRequestTypedDict": ".list_loan_transactions", - "ListPullOperationsRequest": ".list_pull_operations", - "ListPullOperationsRequestTypedDict": ".list_pull_operations", - "ListReconciledInvoicesRequest": ".list_reconciled_invoices", - "ListReconciledInvoicesRequestTypedDict": ".list_reconciled_invoices", - "ListReportsRequest": ".list_reports", - "ListReportsRequestTypedDict": ".list_reports", - "RefreshAllDataTypesRequest": ".refresh_all_data_types", - "RefreshAllDataTypesRequestTypedDict": ".refresh_all_data_types", - "RefreshDataTypeRequest": ".refresh_data_type", - "RefreshDataTypeRequestTypedDict": ".refresh_data_type", - "ReplaceCompanyRequest": ".replace_company", - "ReplaceCompanyRequestTypedDict": ".replace_company", - "SetBankStatementUploadConfigurationRequest": ".set_bank_statement_upload_configuration", - "SetBankStatementUploadConfigurationRequestTypedDict": ".set_bank_statement_upload_configuration", - "StartBankStatementUploadSessionRequest": ".start_bank_statement_upload_session", - "StartBankStatementUploadSessionRequestTypedDict": ".start_bank_statement_upload_session", - "UnlinkConnectionRequest": ".unlink_connection", - "UnlinkConnectionRequestTypedDict": ".unlink_connection", - "UnlinkConnectionUpdateConnection": ".unlink_connection", - "UnlinkConnectionUpdateConnectionTypedDict": ".unlink_connection", - "UpdateCompanyRequest": ".update_company", - "UpdateCompanyRequestTypedDict": ".update_company", - "UploadBankStatementDataRequest": ".upload_bank_statement_data", - "UploadBankStatementDataRequestBody": ".upload_bank_statement_data", - "UploadBankStatementDataRequestBodyTypedDict": ".upload_bank_statement_data", - "UploadBankStatementDataRequestTypedDict": ".upload_bank_statement_data", - "UploadFilesRequest": ".upload_files", - "UploadFilesRequestTypedDict": ".upload_files", -} - - -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_lending.models.create_connection_request import CreateConnectionRequestTypedDict as CreateConnectionRequestBodyTypedDict +from codat_lending.models.update_connection import UpdateConnectionTypedDict as UnlinkConnectionUpdateConnectionTypedDict +from codat_lending.models.data_statuses import GetDataStatusDataStatusesTypedDict diff --git a/lending/src/codat_lending/models/operations/create_account.py b/lending/src/codat_lending/models/operations/create_account.py index 24d284c07..0ff77e1d4 100644 --- a/lending/src/codat_lending/models/operations/create_account.py +++ b/lending/src/codat_lending/models/operations/create_account.py @@ -1,80 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_account — re-export of the create_account operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import accountprototype as shared_accountprototype -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 CreateAccountRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - account_prototype: NotRequired[shared_accountprototype.AccountPrototypeTypedDict] - 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 CreateAccountRequest(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.""" - - account_prototype: Annotated[ - Optional[shared_accountprototype.AccountPrototype], - 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( - ["accountPrototype", "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_lending.api.loan_writeback_accounts import CreateAccountRequest +from codat_lending.api.loan_writeback_accounts import CreateAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_bank_account.py b/lending/src/codat_lending/models/operations/create_bank_account.py index 2c52be68c..d41048965 100644 --- a/lending/src/codat_lending/models/operations/create_bank_account.py +++ b/lending/src/codat_lending/models/operations/create_bank_account.py @@ -1,99 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_bank_account — re-export of the create_bank_account operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - accountingbankaccount as shared_accountingbankaccount, -) -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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.""" - accounting_bank_account: NotRequired[ - Nullable[shared_accountingbankaccount.AccountingBankAccountTypedDict] - ] - 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 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.""" - - accounting_bank_account: Annotated[ - OptionalNullable[shared_accountingbankaccount.AccountingBankAccount], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = UNSET - - 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( - ["AccountingBankAccount", "allowSyncOnPushComplete", "timeoutInMinutes"] - ) - nullable_fields = set(["AccountingBankAccount"]) - 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 codat_lending.api.bank_accounts import CreateBankAccountRequest +from codat_lending.api.bank_accounts import CreateBankAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_bank_account_mapping.py b/lending/src/codat_lending/models/operations/create_bank_account_mapping.py index 0946c70fc..b438d042a 100644 --- a/lending/src/codat_lending/models/operations/create_bank_account_mapping.py +++ b/lending/src/codat_lending/models/operations/create_bank_account_mapping.py @@ -1,59 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_bank_account_mapping — re-export of the create_bank_account_mapping operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - bankfeedbankaccountmapping as shared_bankfeedbankaccountmapping, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_bank_account_mapping: NotRequired[ - shared_bankfeedbankaccountmapping.BankFeedBankAccountMappingTypedDict - ] - - -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_bank_account_mapping: Annotated[ - Optional[shared_bankfeedbankaccountmapping.BankFeedBankAccountMapping], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["BankFeedBankAccountMapping"]) - 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_lending.api.source_accounts import CreateBankAccountMappingRequest +from codat_lending.api.source_accounts import CreateBankAccountMappingRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_bank_transactions.py b/lending/src/codat_lending/models/operations/create_bank_transactions.py index 0e7b847c9..db01ced97 100644 --- a/lending/src/codat_lending/models/operations/create_bank_transactions.py +++ b/lending/src/codat_lending/models/operations/create_bank_transactions.py @@ -1,99 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_bank_transactions — re-export of the create_bank_transactions operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - accountingcreatebanktransactions as shared_accountingcreatebanktransactions, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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.""" - accounting_create_bank_transactions: NotRequired[ - shared_accountingcreatebanktransactions.AccountingCreateBankTransactionsTypedDict - ] - 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.""" - - accounting_create_bank_transactions: Annotated[ - Optional[ - shared_accountingcreatebanktransactions.AccountingCreateBankTransactions - ], - 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( - [ - "AccountingCreateBankTransactions", - "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_lending.api.bank_transactions import CreateBankTransactionsRequest +from codat_lending.api.bank_transactions import CreateBankTransactionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_connection.py b/lending/src/codat_lending/models/operations/create_connection.py index 31a955284..52c43c2a7 100644 --- a/lending/src/codat_lending/models/operations/create_connection.py +++ b/lending/src/codat_lending/models/operations/create_connection.py @@ -1,77 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_connection — re-export of the create_connection operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.connections import CreateConnectionRequest +from codat_lending.models.create_connection_request import CreateConnectionRequest as CreateConnectionRequestBody +from codat_lending.models.create_connection_request import CreateConnectionRequestTypedDict as CreateConnectionRequestBodyTypedDict +from codat_lending.api.connections import CreateConnectionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_direct_cost.py b/lending/src/codat_lending/models/operations/create_direct_cost.py index fda44fb49..99c00d643 100644 --- a/lending/src/codat_lending/models/operations/create_direct_cost.py +++ b/lending/src/codat_lending/models/operations/create_direct_cost.py @@ -1,84 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_direct_cost — re-export of the create_direct_cost operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - directcostprototype as shared_directcostprototype, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 CreateDirectCostRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - allow_sync_on_push_complete: NotRequired[bool] - r"""Allow a sync upon push completion.""" - direct_cost_prototype: NotRequired[ - shared_directcostprototype.DirectCostPrototypeTypedDict - ] - timeout_in_minutes: NotRequired[int] - r"""Time limit for the push operation to complete before it is timed out.""" - - -class CreateDirectCostRequest(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.""" - - 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.""" - - direct_cost_prototype: Annotated[ - Optional[shared_directcostprototype.DirectCostPrototype], - 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( - ["allowSyncOnPushComplete", "directCostPrototype", "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_lending.api.direct_costs import CreateDirectCostRequest +from codat_lending.api.direct_costs import CreateDirectCostRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_payment.py b/lending/src/codat_lending/models/operations/create_payment.py index bcbd10b09..bfc73ef75 100644 --- a/lending/src/codat_lending/models/operations/create_payment.py +++ b/lending/src/codat_lending/models/operations/create_payment.py @@ -1,97 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_payment — re-export of the create_payment operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import accountingpayment as shared_accountingpayment -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 CreatePaymentRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - accounting_payment: NotRequired[ - Nullable[shared_accountingpayment.AccountingPaymentTypedDict] - ] - 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 CreatePaymentRequest(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.""" - - accounting_payment: Annotated[ - OptionalNullable[shared_accountingpayment.AccountingPayment], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = UNSET - - 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( - ["AccountingPayment", "allowSyncOnPushComplete", "timeoutInMinutes"] - ) - nullable_fields = set(["AccountingPayment"]) - 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 codat_lending.api.loan_writeback_payments import CreatePaymentRequest +from codat_lending.api.loan_writeback_payments import CreatePaymentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_source_account.py b/lending/src/codat_lending/models/operations/create_source_account.py index de89e1cf8..538773b41 100644 --- a/lending/src/codat_lending/models/operations/create_source_account.py +++ b/lending/src/codat_lending/models/operations/create_source_account.py @@ -1,95 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_source_account — re-export of the create_source_account operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - sourceaccount as shared_sourceaccount, - sourceaccountprototype as shared_sourceaccountprototype, - sourceaccountv2 as shared_sourceaccountv2, - sourceaccountv2prototype as shared_sourceaccountv2prototype, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.source_accounts import CreateSourceAccountRequest +from codat_lending.api.source_accounts import CreateSourceAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_source_account_request_body.py b/lending/src/codat_lending/models/operations/create_source_account_request_body.py new file mode 100644 index 000000000..03355a230 --- /dev/null +++ b/lending/src/codat_lending/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_lending.models.shared.sourceaccountprototype import SourceAccountPrototype +from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype + +CreateSourceAccountRequestBody = TypeAliasType("CreateSourceAccountRequestBody", Union[SourceAccountPrototype, SourceAccountV2Prototype]) diff --git a/lending/src/codat_lending/models/operations/create_source_account_request_body_typed_dict.py b/lending/src/codat_lending/models/operations/create_source_account_request_body_typed_dict.py new file mode 100644 index 000000000..3c7944d39 --- /dev/null +++ b/lending/src/codat_lending/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_lending.models.shared.sourceaccountprototype import SourceAccountPrototypeTypedDict +from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2PrototypeTypedDict + +CreateSourceAccountRequestBodyTypedDict = TypeAliasType("CreateSourceAccountRequestBodyTypedDict", Union[SourceAccountPrototypeTypedDict, SourceAccountV2PrototypeTypedDict]) diff --git a/lending/src/codat_lending/models/operations/create_source_account_response_body.py b/lending/src/codat_lending/models/operations/create_source_account_response_body.py new file mode 100644 index 000000000..a2f415bf5 --- /dev/null +++ b/lending/src/codat_lending/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_lending.models.shared.sourceaccount import SourceAccount +from codat_lending.models.source_account_v2 import SourceAccountV2 + +CreateSourceAccountResponseBody = TypeAliasType("CreateSourceAccountResponseBody", Union[SourceAccount, SourceAccountV2]) diff --git a/lending/src/codat_lending/models/operations/create_source_account_response_body_typed_dict.py b/lending/src/codat_lending/models/operations/create_source_account_response_body_typed_dict.py new file mode 100644 index 000000000..b6473a0c9 --- /dev/null +++ b/lending/src/codat_lending/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_lending.models.shared.sourceaccount import SourceAccountTypedDict +from codat_lending.models.source_account_v2 import SourceAccountV2TypedDict + +CreateSourceAccountResponseBodyTypedDict = TypeAliasType("CreateSourceAccountResponseBodyTypedDict", Union[SourceAccountTypedDict, SourceAccountV2TypedDict]) diff --git a/lending/src/codat_lending/models/operations/create_supplier.py b/lending/src/codat_lending/models/operations/create_supplier.py index 2291fa005..207476911 100644 --- a/lending/src/codat_lending/models/operations/create_supplier.py +++ b/lending/src/codat_lending/models/operations/create_supplier.py @@ -1,97 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_supplier — re-export of the create_supplier operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import accountingsupplier as shared_accountingsupplier -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 CreateSupplierRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - accounting_supplier: NotRequired[ - Nullable[shared_accountingsupplier.AccountingSupplierTypedDict] - ] - 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 CreateSupplierRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - connection_id: Annotated[ - str, - pydantic.Field(alias="connectionId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a connection.""" - - accounting_supplier: Annotated[ - OptionalNullable[shared_accountingsupplier.AccountingSupplier], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = UNSET - - 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( - ["AccountingSupplier", "allowSyncOnPushComplete", "timeoutInMinutes"] - ) - nullable_fields = set(["AccountingSupplier"]) - 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 codat_lending.api.loan_writeback_suppliers import CreateSupplierRequest +from codat_lending.api.loan_writeback_suppliers import CreateSupplierRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/create_transfer.py b/lending/src/codat_lending/models/operations/create_transfer.py index f4581cc19..e3d4f31a6 100644 --- a/lending/src/codat_lending/models/operations/create_transfer.py +++ b/lending/src/codat_lending/models/operations/create_transfer.py @@ -1,97 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.create_transfer — re-export of the create_transfer operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import accountingtransfer as shared_accountingtransfer -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 CreateTransferRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - accounting_transfer: NotRequired[ - Nullable[shared_accountingtransfer.AccountingTransferTypedDict] - ] - 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 CreateTransferRequest(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.""" - - accounting_transfer: Annotated[ - OptionalNullable[shared_accountingtransfer.AccountingTransfer], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = UNSET - - 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( - ["AccountingTransfer", "allowSyncOnPushComplete", "timeoutInMinutes"] - ) - nullable_fields = set(["AccountingTransfer"]) - 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 codat_lending.api.transfers import CreateTransferRequest +from codat_lending.api.transfers import CreateTransferRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/delete_company.py b/lending/src/codat_lending/models/operations/delete_company.py index b76c1ce08..bbcc4e5c3 100644 --- a/lending/src/codat_lending/models/operations/delete_company.py +++ b/lending/src/codat_lending/models/operations/delete_company.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.delete_company — re-export of the delete_company operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.companies import DeleteCompanyRequest +from codat_lending.api.companies import DeleteCompanyRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/delete_connection.py b/lending/src/codat_lending/models/operations/delete_connection.py index b4f5d7ab3..50196cbdf 100644 --- a/lending/src/codat_lending/models/operations/delete_connection.py +++ b/lending/src/codat_lending/models/operations/delete_connection.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.delete_connection — re-export of the delete_connection operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.connections import DeleteConnectionRequest +from codat_lending.api.connections import DeleteConnectionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_bill_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_bill_attachment.py index 90ae55d1c..03f955473 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_bill_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_bill_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_bill_attachment — re-export of the download_accounting_bill_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingBillAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - bill_id: str - r"""Unique identifier for a bill.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class DownloadAccountingBillAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - bill_id: Annotated[ - str, - pydantic.Field(alias="billId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill.""" - - 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_lending.api.bills import DownloadAccountingBillAttachmentRequest +from codat_lending.api.bills import DownloadAccountingBillAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_customer_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_customer_attachment.py index 8e04273df..9548e33de 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_customer_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_customer_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_customer_attachment — re-export of the download_accounting_customer_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingCustomerAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - customer_id: str - r"""Unique identifier for a customer.""" - - -class DownloadAccountingCustomerAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - customer_id: Annotated[ - str, - pydantic.Field(alias="customerId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a customer.""" +from codat_lending.api.customers import DownloadAccountingCustomerAttachmentRequest +from codat_lending.api.customers import DownloadAccountingCustomerAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_direct_cost_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_direct_cost_attachment.py index 6888e2bab..c4afe8d72 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_direct_cost_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_direct_cost_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_direct_cost_attachment — re-export of the download_accounting_direct_cost_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingDirectCostAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_cost_id: str - r"""Unique identifier for a direct cost.""" - - -class DownloadAccountingDirectCostAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - direct_cost_id: Annotated[ - str, - pydantic.Field(alias="directCostId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct cost.""" +from codat_lending.api.transactions_direct_costs import DownloadAccountingDirectCostAttachmentRequest +from codat_lending.api.transactions_direct_costs import DownloadAccountingDirectCostAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_direct_income_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_direct_income_attachment.py index 078953a4b..288e274ac 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_direct_income_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_direct_income_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_direct_income_attachment — re-export of the download_accounting_direct_income_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingDirectIncomeAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_income_id: str - r"""Unique identifier for a direct income.""" - - -class DownloadAccountingDirectIncomeAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - direct_income_id: Annotated[ - str, - pydantic.Field(alias="directIncomeId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct income.""" +from codat_lending.api.direct_incomes import DownloadAccountingDirectIncomeAttachmentRequest +from codat_lending.api.direct_incomes import DownloadAccountingDirectIncomeAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_invoice_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_invoice_attachment.py index 3841a0ce5..7c180465b 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_invoice_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_invoice_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_invoice_attachment — re-export of the download_accounting_invoice_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingInvoiceAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - invoice_id: str - r"""Unique identifier for an invoice.""" - - -class DownloadAccountingInvoiceAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - invoice_id: Annotated[ - str, - pydantic.Field(alias="invoiceId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an invoice.""" +from codat_lending.api.invoices import DownloadAccountingInvoiceAttachmentRequest +from codat_lending.api.invoices import DownloadAccountingInvoiceAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_invoice_pdf.py b/lending/src/codat_lending/models/operations/download_accounting_invoice_pdf.py index 1269201fe..a8e8b1e21 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_invoice_pdf.py +++ b/lending/src/codat_lending/models/operations/download_accounting_invoice_pdf.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_invoice_pdf — re-export of the download_accounting_invoice_pdf operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingInvoicePdfRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - invoice_id: str - r"""Unique identifier for an invoice.""" - - -class DownloadAccountingInvoicePdfRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - invoice_id: Annotated[ - str, - pydantic.Field(alias="invoiceId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an invoice.""" +from codat_lending.api.invoices import DownloadAccountingInvoicePdfRequest +from codat_lending.api.invoices import DownloadAccountingInvoicePdfRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_accounting_supplier_attachment.py b/lending/src/codat_lending/models/operations/download_accounting_supplier_attachment.py index 97cf7e17a..e71f360c5 100644 --- a/lending/src/codat_lending/models/operations/download_accounting_supplier_attachment.py +++ b/lending/src/codat_lending/models/operations/download_accounting_supplier_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_accounting_supplier_attachment — re-export of the download_accounting_supplier_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadAccountingSupplierAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - supplier_id: str - r"""Unique identifier for a supplier.""" - - -class DownloadAccountingSupplierAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - supplier_id: Annotated[ - str, - pydantic.Field(alias="supplierId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a supplier.""" +from codat_lending.api.suppliers import DownloadAccountingSupplierAttachmentRequest +from codat_lending.api.suppliers import DownloadAccountingSupplierAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_excel_report.py b/lending/src/codat_lending/models/operations/download_excel_report.py index 2f4d44601..3f59665cc 100644 --- a/lending/src/codat_lending/models/operations/download_excel_report.py +++ b/lending/src/codat_lending/models/operations/download_excel_report.py @@ -1,31 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_excel_report — re-export of the download_excel_report operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import excelreporttypes as shared_excelreporttypes -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class DownloadExcelReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - report_type: shared_excelreporttypes.ExcelReportTypes - r"""The type of report you want to generate and download.""" - - -class DownloadExcelReportRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - report_type: Annotated[ - shared_excelreporttypes.ExcelReportTypes, - pydantic.Field(alias="reportType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The type of report you want to generate and download.""" +from codat_lending.api.excel_reports import DownloadExcelReportRequest +from codat_lending.api.excel_reports import DownloadExcelReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/download_files.py b/lending/src/codat_lending/models/operations/download_files.py index d1fd00851..a6424645f 100644 --- a/lending/src/codat_lending/models/operations/download_files.py +++ b/lending/src/codat_lending/models/operations/download_files.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.download_files — re-export of the download_files operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class DownloadFilesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - date_: NotRequired[str] - r"""Only download files uploaded on this date.""" - - -class DownloadFilesRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - date_: Annotated[ - Optional[str], - pydantic.Field(alias="date"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Only download files uploaded on this date.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["date"]) - 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_lending.api.file_upload import DownloadFilesRequest +from codat_lending.api.file_upload import DownloadFilesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/end_bank_statement_upload_session.py b/lending/src/codat_lending/models/operations/end_bank_statement_upload_session.py index dda8dacad..9381c7e81 100644 --- a/lending/src/codat_lending/models/operations/end_bank_statement_upload_session.py +++ b/lending/src/codat_lending/models/operations/end_bank_statement_upload_session.py @@ -1,68 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.end_bank_statement_upload_session — re-export of the end_bank_statement_upload_session operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - enduploadsessionrequest as shared_enduploadsessionrequest, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class EndBankStatementUploadSessionRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - dataset_id: str - r"""Unique identifier for the dataset that completed its sync.""" - end_upload_session_request: NotRequired[ - shared_enduploadsessionrequest.EndUploadSessionRequestTypedDict - ] - - -class EndBankStatementUploadSessionRequest(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.""" - - dataset_id: Annotated[ - str, - pydantic.Field(alias="datasetId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for the dataset that completed its sync.""" - - end_upload_session_request: Annotated[ - Optional[shared_enduploadsessionrequest.EndUploadSessionRequest], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["EndUploadSessionRequest"]) - 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_lending.api.bank_statements import EndBankStatementUploadSessionRequest +from codat_lending.api.bank_statements import EndBankStatementUploadSessionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/generate_excel_report.py b/lending/src/codat_lending/models/operations/generate_excel_report.py index d5e01cc66..04164bc08 100644 --- a/lending/src/codat_lending/models/operations/generate_excel_report.py +++ b/lending/src/codat_lending/models/operations/generate_excel_report.py @@ -1,31 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.generate_excel_report — re-export of the generate_excel_report operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import excelreporttypes as shared_excelreporttypes -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GenerateExcelReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - report_type: shared_excelreporttypes.ExcelReportTypes - r"""The type of report you want to generate and download.""" - - -class GenerateExcelReportRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - report_type: Annotated[ - shared_excelreporttypes.ExcelReportTypes, - pydantic.Field(alias="reportType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The type of report you want to generate and download.""" +from codat_lending.api.excel_reports import GenerateExcelReportRequest +from codat_lending.api.excel_reports import GenerateExcelReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/generate_loan_summary.py b/lending/src/codat_lending/models/operations/generate_loan_summary.py index 6224d2b86..20ba90282 100644 --- a/lending/src/codat_lending/models/operations/generate_loan_summary.py +++ b/lending/src/codat_lending/models/operations/generate_loan_summary.py @@ -1,39 +1,10 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata + from enum import Enum -import pydantic -from typing_extensions import Annotated, TypedDict class SourceType(str, Enum): - r"""Data source type.""" - - BANKING = "banking" - COMMERCE = "commerce" - ACCOUNTING = "accounting" - - -class GenerateLoanSummaryRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - source_type: SourceType - r"""Data source type.""" - - -class GenerateLoanSummaryRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - source_type: Annotated[ - SourceType, - pydantic.Field(alias="sourceType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Data source type.""" + """Operation-parameter enum (lifted from inline OAS enum on generate-loan-summary).""" + BANKING = 'banking' + COMMERCE = 'commerce' + ACCOUNTING = 'accounting' diff --git a/lending/src/codat_lending/models/operations/generate_loan_transactions.py b/lending/src/codat_lending/models/operations/generate_loan_transactions.py index 7de5bb4a4..40bc25698 100644 --- a/lending/src/codat_lending/models/operations/generate_loan_transactions.py +++ b/lending/src/codat_lending/models/operations/generate_loan_transactions.py @@ -1,39 +1,10 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata + from enum import Enum -import pydantic -from typing_extensions import Annotated, TypedDict class QueryParamSourceType(str, Enum): - r"""Data source type.""" - - BANKING = "banking" - COMMERCE = "commerce" - ACCOUNTING = "accounting" - - -class GenerateLoanTransactionsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - source_type: QueryParamSourceType - r"""Data source type.""" - - -class GenerateLoanTransactionsRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - source_type: Annotated[ - QueryParamSourceType, - pydantic.Field(alias="sourceType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Data source type.""" + """Operation-parameter enum (lifted from inline OAS enum on generate-loan-transactions).""" + BANKING = 'banking' + COMMERCE = 'commerce' + ACCOUNTING = 'accounting' diff --git a/lending/src/codat_lending/models/operations/generate_report.py b/lending/src/codat_lending/models/operations/generate_report.py index 27ba4b92b..271c8dad3 100644 --- a/lending/src/codat_lending/models/operations/generate_report.py +++ b/lending/src/codat_lending/models/operations/generate_report.py @@ -1,31 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.generate_report — re-export of the generate_report operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import reporttype as shared_reporttype -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GenerateReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - report_type: shared_reporttype.ReportType - r"""The type of the report""" - - -class GenerateReportRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - report_type: Annotated[ - shared_reporttype.ReportType, - pydantic.Field(alias="reportType"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The type of the report""" +from codat_lending.api.manage_reports import GenerateReportRequest +from codat_lending.api.manage_reports import GenerateReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_account.py b/lending/src/codat_lending/models/operations/get_accounting_account.py index 7bf49b86d..ff7a87711 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_account.py +++ b/lending/src/codat_lending/models/operations/get_accounting_account.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_account — re-export of the get_accounting_account operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingAccountRequestTypedDict(TypedDict): - account_id: str - r"""Unique identifier for an account.""" - company_id: str - r"""Unique identifier for a company.""" - - -class GetAccountingAccountRequest(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.""" +from codat_lending.api.financial_statements_accounts import GetAccountingAccountRequest +from codat_lending.api.financial_statements_accounts import GetAccountingAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_account_transaction.py b/lending/src/codat_lending/models/operations/get_accounting_account_transaction.py index 6316a2853..7f546ee59 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_account_transaction.py +++ b/lending/src/codat_lending/models/operations/get_accounting_account_transaction.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_account_transaction — re-export of the get_accounting_account_transaction operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingAccountTransactionRequestTypedDict(TypedDict): - account_transaction_id: str - r"""Unique identifier for an account transaction.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetAccountingAccountTransactionRequest(BaseModel): - account_transaction_id: Annotated[ - str, - pydantic.Field(alias="accountTransactionId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an account transaction.""" - - 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_lending.api.account_transactions import GetAccountingAccountTransactionRequest +from codat_lending.api.account_transactions import GetAccountingAccountTransactionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_aged_creditors_report.py b/lending/src/codat_lending/models/operations/get_accounting_aged_creditors_report.py index b8eda28e0..e406cc3e9 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_aged_creditors_report.py +++ b/lending/src/codat_lending/models/operations/get_accounting_aged_creditors_report.py @@ -1,67 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_aged_creditors_report — re-export of the get_accounting_aged_creditors_report operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -from datetime import date -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingAgedCreditorsReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - number_of_periods: NotRequired[int] - r"""Number of periods to include in the report.""" - period_length_days: NotRequired[int] - r"""The length of period in days.""" - report_date: NotRequired[date] - r"""Date the report is generated up to.""" - - -class GetAccountingAgedCreditorsReportRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - number_of_periods: Annotated[ - Optional[int], - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Number of periods to include in the report.""" - - period_length_days: Annotated[ - Optional[int], - pydantic.Field(alias="periodLengthDays"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The length of period in days.""" - - report_date: Annotated[ - Optional[date], - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Date the report is generated up to.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["numberOfPeriods", "periodLengthDays", "reportDate"]) - 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_lending.api.reports import GetAccountingAgedCreditorsReportRequest +from codat_lending.api.reports import GetAccountingAgedCreditorsReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_aged_debtors_report.py b/lending/src/codat_lending/models/operations/get_accounting_aged_debtors_report.py index 44e211c9d..2a3c53774 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_aged_debtors_report.py +++ b/lending/src/codat_lending/models/operations/get_accounting_aged_debtors_report.py @@ -1,67 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_aged_debtors_report — re-export of the get_accounting_aged_debtors_report operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -from datetime import date -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingAgedDebtorsReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - number_of_periods: NotRequired[int] - r"""Number of periods to include in the report.""" - period_length_days: NotRequired[int] - r"""The length of period in days.""" - report_date: NotRequired[date] - r"""Date the report is generated up to.""" - - -class GetAccountingAgedDebtorsReportRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - number_of_periods: Annotated[ - Optional[int], - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Number of periods to include in the report.""" - - period_length_days: Annotated[ - Optional[int], - pydantic.Field(alias="periodLengthDays"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The length of period in days.""" - - report_date: Annotated[ - Optional[date], - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Date the report is generated up to.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["numberOfPeriods", "periodLengthDays", "reportDate"]) - 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_lending.api.reports import GetAccountingAgedDebtorsReportRequest +from codat_lending.api.reports import GetAccountingAgedDebtorsReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_balance_sheet.py b/lending/src/codat_lending/models/operations/get_accounting_balance_sheet.py index bfcb9748b..faa4ed18c 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_balance_sheet.py +++ b/lending/src/codat_lending/models/operations/get_accounting_balance_sheet.py @@ -1,66 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_balance_sheet — re-export of the get_accounting_balance_sheet operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingBalanceSheetRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - period_length: int - r"""Number of months defining the period of interest.""" - periods_to_compare: int - r"""Number of periods with `periodLength` to compare.""" - start_month: NotRequired[str] - r"""The month the report starts from.""" - - -class GetAccountingBalanceSheetRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of months defining the period of interest.""" - - periods_to_compare: Annotated[ - int, - pydantic.Field(alias="periodsToCompare"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of periods with `periodLength` to compare.""" - - start_month: Annotated[ - Optional[str], - pydantic.Field(alias="startMonth"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The month the report starts from.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["startMonth"]) - 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_lending.api.balance_sheet import GetAccountingBalanceSheetRequest +from codat_lending.api.balance_sheet import GetAccountingBalanceSheetRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_bank_account.py b/lending/src/codat_lending/models/operations/get_accounting_bank_account.py index 5dd3f2c7c..75e4d754a 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_bank_account.py +++ b/lending/src/codat_lending/models/operations/get_accounting_bank_account.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_bank_account — re-export of the get_accounting_bank_account operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingBankAccountRequestTypedDict(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 GetAccountingBankAccountRequest(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_lending.api.accounts import GetAccountingBankAccountRequest +from codat_lending.api.accounts import GetAccountingBankAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_bill.py b/lending/src/codat_lending/models/operations/get_accounting_bill.py index e8171b011..2b42bef8e 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_bill.py +++ b/lending/src/codat_lending/models/operations/get_accounting_bill.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_bill — re-export of the get_accounting_bill operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingBillRequestTypedDict(TypedDict): - bill_id: str - r"""Unique identifier for a bill.""" - company_id: str - r"""Unique identifier for a company.""" - - -class GetAccountingBillRequest(BaseModel): - bill_id: Annotated[ - str, - pydantic.Field(alias="billId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill.""" - - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.bills import GetAccountingBillRequest +from codat_lending.api.bills import GetAccountingBillRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_bill_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_bill_attachment.py index 8eaadb6bd..217d441c0 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_bill_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_bill_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_bill_attachment — re-export of the get_accounting_bill_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingBillAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - bill_id: str - r"""Unique identifier for a bill.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetAccountingBillAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - bill_id: Annotated[ - str, - pydantic.Field(alias="billId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill.""" - - 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_lending.api.bills import GetAccountingBillAttachmentRequest +from codat_lending.api.bills import GetAccountingBillAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_bill_credit_note.py b/lending/src/codat_lending/models/operations/get_accounting_bill_credit_note.py index 0827a9060..aa29bb9c3 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_bill_credit_note.py +++ b/lending/src/codat_lending/models/operations/get_accounting_bill_credit_note.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_bill_credit_note — re-export of the get_accounting_bill_credit_note operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingBillCreditNoteRequestTypedDict(TypedDict): - bill_credit_note_id: str - r"""Unique identifier for a bill credit note.""" - company_id: str - r"""Unique identifier for a company.""" - - -class GetAccountingBillCreditNoteRequest(BaseModel): - bill_credit_note_id: Annotated[ - str, - pydantic.Field(alias="billCreditNoteId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill credit note.""" - - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.bill_credit_notes import GetAccountingBillCreditNoteRequest +from codat_lending.api.bill_credit_notes import GetAccountingBillCreditNoteRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_bill_payment.py b/lending/src/codat_lending/models/operations/get_accounting_bill_payment.py index d16913a23..7ae8bbff7 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_bill_payment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_bill_payment.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_bill_payment — re-export of the get_accounting_bill_payment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingBillPaymentRequestTypedDict(TypedDict): - bill_payment_id: str - r"""Unique identifier for a bill payment.""" - company_id: str - r"""Unique identifier for a company.""" - - -class GetAccountingBillPaymentRequest(BaseModel): - bill_payment_id: Annotated[ - str, - pydantic.Field(alias="billPaymentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill payment.""" - - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.bill_payments import GetAccountingBillPaymentRequest +from codat_lending.api.bill_payments import GetAccountingBillPaymentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_cash_flow_statement.py b/lending/src/codat_lending/models/operations/get_accounting_cash_flow_statement.py index 309b20339..1bf47f224 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_cash_flow_statement.py +++ b/lending/src/codat_lending/models/operations/get_accounting_cash_flow_statement.py @@ -1,66 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_cash_flow_statement — re-export of the get_accounting_cash_flow_statement operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingCashFlowStatementRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - period_length: int - r"""Number of months defining the period of interest.""" - periods_to_compare: int - r"""Number of periods with `periodLength` to compare.""" - start_month: NotRequired[str] - r"""The month the report starts from.""" - - -class GetAccountingCashFlowStatementRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of months defining the period of interest.""" - - periods_to_compare: Annotated[ - int, - pydantic.Field(alias="periodsToCompare"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of periods with `periodLength` to compare.""" - - start_month: Annotated[ - Optional[str], - pydantic.Field(alias="startMonth"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The month the report starts from.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["startMonth"]) - 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_lending.api.cash_flow import GetAccountingCashFlowStatementRequest +from codat_lending.api.cash_flow import GetAccountingCashFlowStatementRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_credit_note.py b/lending/src/codat_lending/models/operations/get_accounting_credit_note.py index 65b83def0..9cbf37f6e 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_credit_note.py +++ b/lending/src/codat_lending/models/operations/get_accounting_credit_note.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_credit_note — re-export of the get_accounting_credit_note operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingCreditNoteRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - credit_note_id: str - r"""Unique identifier for a credit note.""" - - -class GetAccountingCreditNoteRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - credit_note_id: Annotated[ - str, - pydantic.Field(alias="creditNoteId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a credit note.""" +from codat_lending.api.credit_notes import GetAccountingCreditNoteRequest +from codat_lending.api.credit_notes import GetAccountingCreditNoteRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_customer.py b/lending/src/codat_lending/models/operations/get_accounting_customer.py index 41eb04719..10a3f3571 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_customer.py +++ b/lending/src/codat_lending/models/operations/get_accounting_customer.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_customer — re-export of the get_accounting_customer operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingCustomerRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - customer_id: str - r"""Unique identifier for a customer.""" - - -class GetAccountingCustomerRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - customer_id: Annotated[ - str, - pydantic.Field(alias="customerId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a customer.""" +from codat_lending.api.customers import GetAccountingCustomerRequest +from codat_lending.api.customers import GetAccountingCustomerRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_customer_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_customer_attachment.py index 8af6e3982..d917e8955 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_customer_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_customer_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_customer_attachment — re-export of the get_accounting_customer_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingCustomerAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - customer_id: str - r"""Unique identifier for a customer.""" - - -class GetAccountingCustomerAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - customer_id: Annotated[ - str, - pydantic.Field(alias="customerId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a customer.""" +from codat_lending.api.customers import GetAccountingCustomerAttachmentRequest +from codat_lending.api.customers import GetAccountingCustomerAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_direct_cost.py b/lending/src/codat_lending/models/operations/get_accounting_direct_cost.py index abcac1ba2..7de83b8a0 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_direct_cost.py +++ b/lending/src/codat_lending/models/operations/get_accounting_direct_cost.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_direct_cost — re-export of the get_accounting_direct_cost operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingDirectCostRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_cost_id: str - r"""Unique identifier for a direct cost.""" - - -class GetAccountingDirectCostRequest(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.""" - - direct_cost_id: Annotated[ - str, - pydantic.Field(alias="directCostId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct cost.""" +from codat_lending.api.transactions_direct_costs import GetAccountingDirectCostRequest +from codat_lending.api.transactions_direct_costs import GetAccountingDirectCostRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_direct_cost_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_direct_cost_attachment.py index b93895e46..f685b2c1e 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_direct_cost_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_direct_cost_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_direct_cost_attachment — re-export of the get_accounting_direct_cost_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingDirectCostAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_cost_id: str - r"""Unique identifier for a direct cost.""" - - -class GetAccountingDirectCostAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - direct_cost_id: Annotated[ - str, - pydantic.Field(alias="directCostId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct cost.""" +from codat_lending.api.transactions_direct_costs import GetAccountingDirectCostAttachmentRequest +from codat_lending.api.transactions_direct_costs import GetAccountingDirectCostAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_direct_income.py b/lending/src/codat_lending/models/operations/get_accounting_direct_income.py index d8e7ddd8f..f48c92491 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_direct_income.py +++ b/lending/src/codat_lending/models/operations/get_accounting_direct_income.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_direct_income — re-export of the get_accounting_direct_income operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingDirectIncomeRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_income_id: str - r"""Unique identifier for a direct income.""" - - -class GetAccountingDirectIncomeRequest(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.""" - - direct_income_id: Annotated[ - str, - pydantic.Field(alias="directIncomeId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct income.""" +from codat_lending.api.direct_incomes import GetAccountingDirectIncomeRequest +from codat_lending.api.direct_incomes import GetAccountingDirectIncomeRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_direct_income_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_direct_income_attachment.py index 5fd40592c..f9a6cdc4b 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_direct_income_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_direct_income_attachment.py @@ -1,75 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_direct_income_attachment — re-export of the get_accounting_direct_income_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingDirectIncomeAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_income_id: str - r"""Unique identifier for a direct income.""" - timeout_in_minutes: NotRequired[int] - r"""Time limit for the push operation to complete before it is timed out.""" - - -class GetAccountingDirectIncomeAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - direct_income_id: Annotated[ - str, - pydantic.Field(alias="directIncomeId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct income.""" - - 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(["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_lending.api.direct_incomes import GetAccountingDirectIncomeAttachmentRequest +from codat_lending.api.direct_incomes import GetAccountingDirectIncomeAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_invoice.py b/lending/src/codat_lending/models/operations/get_accounting_invoice.py index 83682e273..24d7a85a6 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_invoice.py +++ b/lending/src/codat_lending/models/operations/get_accounting_invoice.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_invoice — re-export of the get_accounting_invoice operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingInvoiceRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - invoice_id: str - r"""Unique identifier for an invoice.""" - - -class GetAccountingInvoiceRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - invoice_id: Annotated[ - str, - pydantic.Field(alias="invoiceId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an invoice.""" +from codat_lending.api.invoices import GetAccountingInvoiceRequest +from codat_lending.api.invoices import GetAccountingInvoiceRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_invoice_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_invoice_attachment.py index 7838d4fba..d51309cf2 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_invoice_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_invoice_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_invoice_attachment — re-export of the get_accounting_invoice_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingInvoiceAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - invoice_id: str - r"""Unique identifier for an invoice.""" - - -class GetAccountingInvoiceAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - invoice_id: Annotated[ - str, - pydantic.Field(alias="invoiceId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an invoice.""" +from codat_lending.api.invoices import GetAccountingInvoiceAttachmentRequest +from codat_lending.api.invoices import GetAccountingInvoiceAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_journal.py b/lending/src/codat_lending/models/operations/get_accounting_journal.py index 500caedba..91e6e87a9 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_journal.py +++ b/lending/src/codat_lending/models/operations/get_accounting_journal.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_journal — re-export of the get_accounting_journal operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingJournalRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - journal_id: str - r"""Unique identifier for a journal.""" - - -class GetAccountingJournalRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - journal_id: Annotated[ - str, - pydantic.Field(alias="journalId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a journal.""" +from codat_lending.api.journals import GetAccountingJournalRequest +from codat_lending.api.journals import GetAccountingJournalRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_journal_entry.py b/lending/src/codat_lending/models/operations/get_accounting_journal_entry.py index c83fce4b7..b77ef3a87 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_journal_entry.py +++ b/lending/src/codat_lending/models/operations/get_accounting_journal_entry.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_journal_entry — re-export of the get_accounting_journal_entry operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingJournalEntryRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - journal_entry_id: str - r"""Unique identifier for a journal entry.""" - - -class GetAccountingJournalEntryRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - journal_entry_id: Annotated[ - str, - pydantic.Field(alias="journalEntryId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a journal entry.""" +from codat_lending.api.journal_entries import GetAccountingJournalEntryRequest +from codat_lending.api.journal_entries import GetAccountingJournalEntryRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_payment.py b/lending/src/codat_lending/models/operations/get_accounting_payment.py index ad80b9faf..c05b85e09 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_payment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_payment.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_payment — re-export of the get_accounting_payment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingPaymentRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - payment_id: str - r"""Unique identifier for a payment.""" - - -class GetAccountingPaymentRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - payment_id: Annotated[ - str, - pydantic.Field(alias="paymentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a payment.""" +from codat_lending.api.payments import GetAccountingPaymentRequest +from codat_lending.api.payments import GetAccountingPaymentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_profile.py b/lending/src/codat_lending/models/operations/get_accounting_profile.py index 870003a1c..38d560b92 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_profile.py +++ b/lending/src/codat_lending/models/operations/get_accounting_profile.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_profile — re-export of the get_accounting_profile operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingProfileRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class GetAccountingProfileRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.company_info import GetAccountingProfileRequest +from codat_lending.api.company_info import GetAccountingProfileRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_profit_and_loss.py b/lending/src/codat_lending/models/operations/get_accounting_profit_and_loss.py index 6011b464e..cee51d997 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_profit_and_loss.py +++ b/lending/src/codat_lending/models/operations/get_accounting_profit_and_loss.py @@ -1,66 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_profit_and_loss — re-export of the get_accounting_profit_and_loss operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetAccountingProfitAndLossRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - period_length: int - r"""Number of months defining the period of interest.""" - periods_to_compare: int - r"""Number of periods with `periodLength` to compare.""" - start_month: NotRequired[str] - r"""The month the report starts from.""" - - -class GetAccountingProfitAndLossRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of months defining the period of interest.""" - - periods_to_compare: Annotated[ - int, - pydantic.Field(alias="periodsToCompare"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Number of periods with `periodLength` to compare.""" - - start_month: Annotated[ - Optional[str], - pydantic.Field(alias="startMonth"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The month the report starts from.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["startMonth"]) - 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_lending.api.profit_and_loss import GetAccountingProfitAndLossRequest +from codat_lending.api.profit_and_loss import GetAccountingProfitAndLossRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_supplier.py b/lending/src/codat_lending/models/operations/get_accounting_supplier.py index 6d488c898..bcbe49583 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_supplier.py +++ b/lending/src/codat_lending/models/operations/get_accounting_supplier.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_supplier — re-export of the get_accounting_supplier operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingSupplierRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - supplier_id: str - r"""Unique identifier for a supplier.""" - - -class GetAccountingSupplierRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - supplier_id: Annotated[ - str, - pydantic.Field(alias="supplierId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a supplier.""" +from codat_lending.api.suppliers import GetAccountingSupplierRequest +from codat_lending.api.suppliers import GetAccountingSupplierRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_supplier_attachment.py b/lending/src/codat_lending/models/operations/get_accounting_supplier_attachment.py index 675383383..37e46ed13 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_supplier_attachment.py +++ b/lending/src/codat_lending/models/operations/get_accounting_supplier_attachment.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_supplier_attachment — re-export of the get_accounting_supplier_attachment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingSupplierAttachmentRequestTypedDict(TypedDict): - attachment_id: str - r"""Unique identifier for an attachment.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - supplier_id: str - r"""Unique identifier for a supplier.""" - - -class GetAccountingSupplierAttachmentRequest(BaseModel): - attachment_id: Annotated[ - str, - pydantic.Field(alias="attachmentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an attachment.""" - - 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.""" - - supplier_id: Annotated[ - str, - pydantic.Field(alias="supplierId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a supplier.""" +from codat_lending.api.suppliers import GetAccountingSupplierAttachmentRequest +from codat_lending.api.suppliers import GetAccountingSupplierAttachmentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_accounting_transfer.py b/lending/src/codat_lending/models/operations/get_accounting_transfer.py index 9f94ee3f0..e8906f7f0 100644 --- a/lending/src/codat_lending/models/operations/get_accounting_transfer.py +++ b/lending/src/codat_lending/models/operations/get_accounting_transfer.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_accounting_transfer — re-export of the get_accounting_transfer operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetAccountingTransferRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - transfer_id: str - r"""Unique identifier for a transfer.""" - - -class GetAccountingTransferRequest(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.""" - - transfer_id: Annotated[ - str, - pydantic.Field(alias="transferId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a transfer.""" +from codat_lending.api.transactions_transfers import GetAccountingTransferRequest +from codat_lending.api.transactions_transfers import GetAccountingTransferRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_bank_account_mapping.py b/lending/src/codat_lending/models/operations/get_bank_account_mapping.py index 3541fd562..6235e9e95 100644 --- a/lending/src/codat_lending/models/operations/get_bank_account_mapping.py +++ b/lending/src/codat_lending/models/operations/get_bank_account_mapping.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_bank_account_mapping — re-export of the get_bank_account_mapping operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.source_accounts import GetBankAccountMappingRequest +from codat_lending.api.source_accounts import GetBankAccountMappingRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_bank_statement_upload_configuration.py b/lending/src/codat_lending/models/operations/get_bank_statement_upload_configuration.py index d3c9f6a06..c30d894f1 100644 --- a/lending/src/codat_lending/models/operations/get_bank_statement_upload_configuration.py +++ b/lending/src/codat_lending/models/operations/get_bank_statement_upload_configuration.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_bank_statement_upload_configuration — re-export of the get_bank_statement_upload_configuration operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetBankStatementUploadConfigurationRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetBankStatementUploadConfigurationRequest(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_lending.api.bank_statements import GetBankStatementUploadConfigurationRequest +from codat_lending.api.bank_statements import GetBankStatementUploadConfigurationRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_banking_account.py b/lending/src/codat_lending/models/operations/get_banking_account.py index 3ca2d1e04..96002a565 100644 --- a/lending/src/codat_lending/models/operations/get_banking_account.py +++ b/lending/src/codat_lending/models/operations/get_banking_account.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_banking_account — re-export of the get_banking_account operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetBankingAccountRequestTypedDict(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 GetBankingAccountRequest(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_lending.api.banking_accounts import GetBankingAccountRequest +from codat_lending.api.banking_accounts import GetBankingAccountRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_banking_transaction.py b/lending/src/codat_lending/models/operations/get_banking_transaction.py index f729c70d0..5f95b5628 100644 --- a/lending/src/codat_lending/models/operations/get_banking_transaction.py +++ b/lending/src/codat_lending/models/operations/get_banking_transaction.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_banking_transaction — re-export of the get_banking_transaction operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetBankingTransactionRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - transaction_id: str - r"""The unique identifier for a transaction""" - - -class GetBankingTransactionRequest(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.""" - - transaction_id: Annotated[ - str, - pydantic.Field(alias="transactionId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The unique identifier for a transaction""" +from codat_lending.api.transactions import GetBankingTransactionRequest +from codat_lending.api.transactions import GetBankingTransactionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_banking_transaction_category.py b/lending/src/codat_lending/models/operations/get_banking_transaction_category.py index de1d9b320..9c1e1e4ea 100644 --- a/lending/src/codat_lending/models/operations/get_banking_transaction_category.py +++ b/lending/src/codat_lending/models/operations/get_banking_transaction_category.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_banking_transaction_category — re-export of the get_banking_transaction_category operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetBankingTransactionCategoryRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - transaction_category_id: str - r"""The unique identifier for a banking transaction category""" - - -class GetBankingTransactionCategoryRequest(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.""" - - transaction_category_id: Annotated[ - str, - pydantic.Field(alias="transactionCategoryId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""The unique identifier for a banking transaction category""" +from codat_lending.api.transaction_categories import GetBankingTransactionCategoryRequest +from codat_lending.api.transaction_categories import GetBankingTransactionCategoryRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_categorized_balance_sheet_statement.py b/lending/src/codat_lending/models/operations/get_categorized_balance_sheet_statement.py index 3ee406cfd..053ca6dee 100644 --- a/lending/src/codat_lending/models/operations/get_categorized_balance_sheet_statement.py +++ b/lending/src/codat_lending/models/operations/get_categorized_balance_sheet_statement.py @@ -1,57 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_categorized_balance_sheet_statement — re-export of the get_categorized_balance_sheet_statement operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCategorizedBalanceSheetStatementRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - number_of_periods: NotRequired[int] - r"""The number of periods to return. If not provided, 12 periods will be used as the default value.""" - - -class GetCategorizedBalanceSheetStatementRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - number_of_periods: Annotated[ - Optional[int], - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The number of periods to return. If not provided, 12 periods will be used as the default value.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["numberOfPeriods"]) - 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_lending.api.balance_sheet import GetCategorizedBalanceSheetStatementRequest +from codat_lending.api.balance_sheet import GetCategorizedBalanceSheetStatementRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_categorized_bank_statement.py b/lending/src/codat_lending/models/operations/get_categorized_bank_statement.py index 9d2fae4c3..d35b32947 100644 --- a/lending/src/codat_lending/models/operations/get_categorized_bank_statement.py +++ b/lending/src/codat_lending/models/operations/get_categorized_bank_statement.py @@ -1,64 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_categorized_bank_statement — re-export of the get_categorized_bank_statement operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCategorizedBankStatementRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - page: NotRequired[int] - r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" - page_size: NotRequired[int] - r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" - query: NotRequired[str] - r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" - - -class GetCategorizedBankStatementRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - page: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 1 - r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" - - page_size: Annotated[ - Optional[int], - pydantic.Field(alias="pageSize"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 100 - r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" - - query: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["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_lending.api.categorized_statement import GetCategorizedBankStatementRequest +from codat_lending.api.categorized_statement import GetCategorizedBankStatementRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_categorized_profit_and_loss_statement.py b/lending/src/codat_lending/models/operations/get_categorized_profit_and_loss_statement.py index a9db3177f..28a5e8af7 100644 --- a/lending/src/codat_lending/models/operations/get_categorized_profit_and_loss_statement.py +++ b/lending/src/codat_lending/models/operations/get_categorized_profit_and_loss_statement.py @@ -1,57 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_categorized_profit_and_loss_statement — re-export of the get_categorized_profit_and_loss_statement operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCategorizedProfitAndLossStatementRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - number_of_periods: NotRequired[int] - r"""The number of periods to return. If not provided, 12 periods will be used as the default value.""" - report_date: NotRequired[str] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - -class GetCategorizedProfitAndLossStatementRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - number_of_periods: Annotated[ - Optional[int], - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The number of periods to return. If not provided, 12 periods will be used as the default value.""" - - report_date: Annotated[ - Optional[str], - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["numberOfPeriods", "reportDate"]) - 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_lending.api.profit_and_loss import GetCategorizedProfitAndLossStatementRequest +from codat_lending.api.profit_and_loss import GetCategorizedProfitAndLossStatementRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_customer.py b/lending/src/codat_lending/models/operations/get_commerce_customer.py index 39dd558b8..8e777ae6d 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_customer.py +++ b/lending/src/codat_lending/models/operations/get_commerce_customer.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_customer — re-export of the get_commerce_customer operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceCustomerRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - customer_id: str - r"""Unique identifier for a customer.""" - - -class GetCommerceCustomerRequest(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.""" - - customer_id: Annotated[ - str, - pydantic.Field(alias="customerId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a customer.""" +from codat_lending.api.sales_customers import GetCommerceCustomerRequest +from codat_lending.api.sales_customers import GetCommerceCustomerRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_customer_retention_metrics.py b/lending/src/codat_lending/models/operations/get_commerce_customer_retention_metrics.py index 687aecf16..e86d1cc91 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_customer_retention_metrics.py +++ b/lending/src/codat_lending/models/operations/get_commerce_customer_retention_metrics.py @@ -1,94 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_customer_retention_metrics — re-export of the get_commerce_customer_retention_metrics operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import periodunit as shared_periodunit -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCommerceCustomerRetentionMetricsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - number_of_periods: int - r"""The number of periods to return. There will be no pagination as a query parameter.""" - period_length: int - r"""The number of months per period. E.g. 2 = 2 months per period.""" - period_unit: shared_periodunit.PeriodUnit - r"""The period unit of time returned.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - include_display_names: NotRequired[bool] - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - -class GetCommerceCustomerRetentionMetricsRequest(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.""" - - number_of_periods: Annotated[ - int, - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of periods to return. There will be no pagination as a query parameter.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of months per period. E.g. 2 = 2 months per period.""" - - period_unit: Annotated[ - shared_periodunit.PeriodUnit, - pydantic.Field(alias="periodUnit"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The period unit of time returned.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - include_display_names: Annotated[ - Optional[bool], - pydantic.Field(alias="includeDisplayNames"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["includeDisplayNames"]) - 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_lending.api.metrics import GetCommerceCustomerRetentionMetricsRequest +from codat_lending.api.metrics import GetCommerceCustomerRetentionMetricsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_dispute.py b/lending/src/codat_lending/models/operations/get_commerce_dispute.py index 10a241d53..02e266e58 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_dispute.py +++ b/lending/src/codat_lending/models/operations/get_commerce_dispute.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_dispute — re-export of the get_commerce_dispute operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceDisputeRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - dispute_id: str - r"""Unique identifier for a dispute.""" - - -class GetCommerceDisputeRequest(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.""" - - dispute_id: Annotated[ - str, - pydantic.Field(alias="disputeId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a dispute.""" +from codat_lending.api.disputes import GetCommerceDisputeRequest +from codat_lending.api.disputes import GetCommerceDisputeRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_lifetime_value_metrics.py b/lending/src/codat_lending/models/operations/get_commerce_lifetime_value_metrics.py index 31962fe40..087aebcd0 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_lifetime_value_metrics.py +++ b/lending/src/codat_lending/models/operations/get_commerce_lifetime_value_metrics.py @@ -1,94 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_lifetime_value_metrics — re-export of the get_commerce_lifetime_value_metrics operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import periodunit as shared_periodunit -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCommerceLifetimeValueMetricsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - number_of_periods: int - r"""The number of periods to return. There will be no pagination as a query parameter.""" - period_length: int - r"""The number of months per period. E.g. 2 = 2 months per period.""" - period_unit: shared_periodunit.PeriodUnit - r"""The period unit of time returned.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - include_display_names: NotRequired[bool] - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - -class GetCommerceLifetimeValueMetricsRequest(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.""" - - number_of_periods: Annotated[ - int, - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of periods to return. There will be no pagination as a query parameter.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of months per period. E.g. 2 = 2 months per period.""" - - period_unit: Annotated[ - shared_periodunit.PeriodUnit, - pydantic.Field(alias="periodUnit"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The period unit of time returned.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - include_display_names: Annotated[ - Optional[bool], - pydantic.Field(alias="includeDisplayNames"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["includeDisplayNames"]) - 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_lending.api.metrics import GetCommerceLifetimeValueMetricsRequest +from codat_lending.api.metrics import GetCommerceLifetimeValueMetricsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_location.py b/lending/src/codat_lending/models/operations/get_commerce_location.py index b4bcd46f8..3499ff2eb 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_location.py +++ b/lending/src/codat_lending/models/operations/get_commerce_location.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_location — re-export of the get_commerce_location operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceLocationRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - location_id: str - r"""Unique identifier for a location.""" - - -class GetCommerceLocationRequest(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.""" - - location_id: Annotated[ - str, - pydantic.Field(alias="locationId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a location.""" +from codat_lending.api.locations import GetCommerceLocationRequest +from codat_lending.api.locations import GetCommerceLocationRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_order.py b/lending/src/codat_lending/models/operations/get_commerce_order.py index 577655fe9..338d98b13 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_order.py +++ b/lending/src/codat_lending/models/operations/get_commerce_order.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_order — re-export of the get_commerce_order operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceOrderRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - order_id: str - r"""Unique identifier for an order.""" - - -class GetCommerceOrderRequest(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_id: Annotated[ - str, - pydantic.Field(alias="orderId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an order.""" +from codat_lending.api.orders import GetCommerceOrderRequest +from codat_lending.api.orders import GetCommerceOrderRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_orders_report.py b/lending/src/codat_lending/models/operations/get_commerce_orders_report.py index c6b31b15f..2af6cdf8f 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_orders_report.py +++ b/lending/src/codat_lending/models/operations/get_commerce_orders_report.py @@ -1,94 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_orders_report — re-export of the get_commerce_orders_report operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import periodunit as shared_periodunit -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCommerceOrdersReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - number_of_periods: int - r"""The number of periods to return. There will be no pagination as a query parameter.""" - period_length: int - r"""The number of months per period. E.g. 2 = 2 months per period.""" - period_unit: shared_periodunit.PeriodUnit - r"""The period unit of time returned.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - include_display_names: NotRequired[bool] - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - -class GetCommerceOrdersReportRequest(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.""" - - number_of_periods: Annotated[ - int, - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of periods to return. There will be no pagination as a query parameter.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of months per period. E.g. 2 = 2 months per period.""" - - period_unit: Annotated[ - shared_periodunit.PeriodUnit, - pydantic.Field(alias="periodUnit"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The period unit of time returned.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - include_display_names: Annotated[ - Optional[bool], - pydantic.Field(alias="includeDisplayNames"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["includeDisplayNames"]) - 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_lending.api.sales_reports import GetCommerceOrdersReportRequest +from codat_lending.api.sales_reports import GetCommerceOrdersReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_payment.py b/lending/src/codat_lending/models/operations/get_commerce_payment.py index 4bfb5f19d..06490d6df 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_payment.py +++ b/lending/src/codat_lending/models/operations/get_commerce_payment.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_payment — re-export of the get_commerce_payment operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommercePaymentRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - payment_id: str - r"""Unique identifier for a payment.""" - - -class GetCommercePaymentRequest(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.""" - - payment_id: Annotated[ - str, - pydantic.Field(alias="paymentId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a payment.""" +from codat_lending.api.sales_payments import GetCommercePaymentRequest +from codat_lending.api.sales_payments import GetCommercePaymentRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_payment_method.py b/lending/src/codat_lending/models/operations/get_commerce_payment_method.py index 04ebab8ca..b202b65e4 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_payment_method.py +++ b/lending/src/codat_lending/models/operations/get_commerce_payment_method.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_payment_method — re-export of the get_commerce_payment_method operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommercePaymentMethodRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - payment_method_id: str - r"""Unique identifier for a payment method.""" - - -class GetCommercePaymentMethodRequest(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.""" - - payment_method_id: Annotated[ - str, - pydantic.Field(alias="paymentMethodId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a payment method.""" +from codat_lending.api.payment_methods import GetCommercePaymentMethodRequest +from codat_lending.api.payment_methods import GetCommercePaymentMethodRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_product.py b/lending/src/codat_lending/models/operations/get_commerce_product.py index 8cf161fa2..1483f60e1 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_product.py +++ b/lending/src/codat_lending/models/operations/get_commerce_product.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_product — re-export of the get_commerce_product operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceProductRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - product_id: str - r"""Unique identifier for a product.""" - - -class GetCommerceProductRequest(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.""" - - product_id: Annotated[ - str, - pydantic.Field(alias="productId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a product.""" +from codat_lending.api.products import GetCommerceProductRequest +from codat_lending.api.products import GetCommerceProductRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_product_category.py b/lending/src/codat_lending/models/operations/get_commerce_product_category.py index 0ac1a2f70..4d5456ce3 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_product_category.py +++ b/lending/src/codat_lending/models/operations/get_commerce_product_category.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_product_category — re-export of the get_commerce_product_category operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceProductCategoryRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - product_id: str - r"""Unique identifier for a product.""" - - -class GetCommerceProductCategoryRequest(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.""" - - product_id: Annotated[ - str, - pydantic.Field(alias="productId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a product.""" +from codat_lending.api.product_categories import GetCommerceProductCategoryRequest +from codat_lending.api.product_categories import GetCommerceProductCategoryRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_profile.py b/lending/src/codat_lending/models/operations/get_commerce_profile.py index 9255893d2..aeccf0d00 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_profile.py +++ b/lending/src/codat_lending/models/operations/get_commerce_profile.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_profile — re-export of the get_commerce_profile operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceProfileRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCommerceProfileRequest(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_lending.api.company_info import GetCommerceProfileRequest +from codat_lending.api.company_info import GetCommerceProfileRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_refunds_report.py b/lending/src/codat_lending/models/operations/get_commerce_refunds_report.py index d981d5876..76f369df6 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_refunds_report.py +++ b/lending/src/codat_lending/models/operations/get_commerce_refunds_report.py @@ -1,94 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_refunds_report — re-export of the get_commerce_refunds_report operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import periodunit as shared_periodunit -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCommerceRefundsReportRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - number_of_periods: int - r"""The number of periods to return. There will be no pagination as a query parameter.""" - period_length: int - r"""The number of months per period. E.g. 2 = 2 months per period.""" - period_unit: shared_periodunit.PeriodUnit - r"""The period unit of time returned.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - include_display_names: NotRequired[bool] - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - -class GetCommerceRefundsReportRequest(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.""" - - number_of_periods: Annotated[ - int, - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of periods to return. There will be no pagination as a query parameter.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of months per period. E.g. 2 = 2 months per period.""" - - period_unit: Annotated[ - shared_periodunit.PeriodUnit, - pydantic.Field(alias="periodUnit"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The period unit of time returned.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - include_display_names: Annotated[ - Optional[bool], - pydantic.Field(alias="includeDisplayNames"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["includeDisplayNames"]) - 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_lending.api.sales_reports import GetCommerceRefundsReportRequest +from codat_lending.api.sales_reports import GetCommerceRefundsReportRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_revenue_metrics.py b/lending/src/codat_lending/models/operations/get_commerce_revenue_metrics.py index 90152be59..d2de8bc19 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_revenue_metrics.py +++ b/lending/src/codat_lending/models/operations/get_commerce_revenue_metrics.py @@ -1,94 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_revenue_metrics — re-export of the get_commerce_revenue_metrics operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import periodunit as shared_periodunit -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetCommerceRevenueMetricsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - number_of_periods: int - r"""The number of periods to return. There will be no pagination as a query parameter.""" - period_length: int - r"""The number of months per period. E.g. 2 = 2 months per period.""" - period_unit: shared_periodunit.PeriodUnit - r"""The period unit of time returned.""" - report_date: str - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - include_display_names: NotRequired[bool] - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - -class GetCommerceRevenueMetricsRequest(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.""" - - number_of_periods: Annotated[ - int, - pydantic.Field(alias="numberOfPeriods"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of periods to return. There will be no pagination as a query parameter.""" - - period_length: Annotated[ - int, - pydantic.Field(alias="periodLength"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The number of months per period. E.g. 2 = 2 months per period.""" - - period_unit: Annotated[ - shared_periodunit.PeriodUnit, - pydantic.Field(alias="periodUnit"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The period unit of time returned.""" - - report_date: Annotated[ - str, - pydantic.Field(alias="reportDate"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The date in which the report is created up to. Users must specify a specific date, however the response will be provided for the full month.""" - - include_display_names: Annotated[ - Optional[bool], - pydantic.Field(alias="includeDisplayNames"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Shows the dimensionDisplayName and itemDisplayName in measures to make the report data human-readable.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["includeDisplayNames"]) - 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_lending.api.metrics import GetCommerceRevenueMetricsRequest +from codat_lending.api.metrics import GetCommerceRevenueMetricsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_commerce_transaction.py b/lending/src/codat_lending/models/operations/get_commerce_transaction.py index ea4e1421d..7dda4c44e 100644 --- a/lending/src/codat_lending/models/operations/get_commerce_transaction.py +++ b/lending/src/codat_lending/models/operations/get_commerce_transaction.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_commerce_transaction — re-export of the get_commerce_transaction operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCommerceTransactionRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - transaction_id: str - r"""Unique identifier for a transaction.""" - - -class GetCommerceTransactionRequest(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.""" - - transaction_id: Annotated[ - str, - pydantic.Field(alias="transactionId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a transaction.""" +from codat_lending.api.sales_transactions import GetCommerceTransactionRequest +from codat_lending.api.sales_transactions import GetCommerceTransactionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_company.py b/lending/src/codat_lending/models/operations/get_company.py index 9fbbfe683..445d3f903 100644 --- a/lending/src/codat_lending/models/operations/get_company.py +++ b/lending/src/codat_lending/models/operations/get_company.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_company — re-export of the get_company operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.companies import GetCompanyRequest +from codat_lending.api.companies import GetCompanyRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_connection.py b/lending/src/codat_lending/models/operations/get_connection.py index 1986a5cce..369d59fcc 100644 --- a/lending/src/codat_lending/models/operations/get_connection.py +++ b/lending/src/codat_lending/models/operations/get_connection.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_connection — re-export of the get_connection operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.connections import GetConnectionRequest +from codat_lending.api.connections import GetConnectionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_bank_transactions_model.py b/lending/src/codat_lending/models/operations/get_create_bank_transactions_model.py index 0fae0e44b..393de715d 100644 --- a/lending/src/codat_lending/models/operations/get_create_bank_transactions_model.py +++ b/lending/src/codat_lending/models/operations/get_create_bank_transactions_model.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_bank_transactions_model — re-export of the get_create_bank_transactions_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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_lending.api.bank_transactions import GetCreateBankTransactionsModelRequest +from codat_lending.api.bank_transactions import GetCreateBankTransactionsModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_chartofaccounts_model.py b/lending/src/codat_lending/models/operations/get_create_chartofaccounts_model.py index fa44294bb..cbb1656c7 100644 --- a/lending/src/codat_lending/models/operations/get_create_chartofaccounts_model.py +++ b/lending/src/codat_lending/models/operations/get_create_chartofaccounts_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_chartofaccounts_model — re-export of the get_create_chartofaccounts_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateChartOfAccountsModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateChartOfAccountsModelRequest(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_lending.api.loan_writeback_accounts import GetCreateChartOfAccountsModelRequest +from codat_lending.api.loan_writeback_accounts import GetCreateChartOfAccountsModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_directcosts_model.py b/lending/src/codat_lending/models/operations/get_create_directcosts_model.py index 4841eeead..aaa5e6419 100644 --- a/lending/src/codat_lending/models/operations/get_create_directcosts_model.py +++ b/lending/src/codat_lending/models/operations/get_create_directcosts_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_directcosts_model — re-export of the get_create_directcosts_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateDirectCostsModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateDirectCostsModelRequest(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_lending.api.direct_costs import GetCreateDirectCostsModelRequest +from codat_lending.api.direct_costs import GetCreateDirectCostsModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_operation.py b/lending/src/codat_lending/models/operations/get_create_operation.py index 577639467..c4db5b24c 100644 --- a/lending/src/codat_lending/models/operations/get_create_operation.py +++ b/lending/src/codat_lending/models/operations/get_create_operation.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_operation — re-export of the get_create_operation operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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"""Unique identifier for the push operation.""" - - -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"""Unique identifier for the push operation.""" +from codat_lending.api.create_operations import GetCreateOperationRequest +from codat_lending.api.create_operations import GetCreateOperationRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_payment_model.py b/lending/src/codat_lending/models/operations/get_create_payment_model.py index a1a6b200b..19490dcaf 100644 --- a/lending/src/codat_lending/models/operations/get_create_payment_model.py +++ b/lending/src/codat_lending/models/operations/get_create_payment_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_payment_model — re-export of the get_create_payment_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreatePaymentModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreatePaymentModelRequest(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_lending.api.loan_writeback_payments import GetCreatePaymentModelRequest +from codat_lending.api.loan_writeback_payments import GetCreatePaymentModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_transfers_model.py b/lending/src/codat_lending/models/operations/get_create_transfers_model.py index f99e35fa9..61fe1b86a 100644 --- a/lending/src/codat_lending/models/operations/get_create_transfers_model.py +++ b/lending/src/codat_lending/models/operations/get_create_transfers_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_transfers_model — re-export of the get_create_transfers_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateTransfersModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateTransfersModelRequest(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_lending.api.transfers import GetCreateTransfersModelRequest +from codat_lending.api.transfers import GetCreateTransfersModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_update_bankaccounts_model.py b/lending/src/codat_lending/models/operations/get_create_update_bankaccounts_model.py index 2021027b1..5ffaa0eac 100644 --- a/lending/src/codat_lending/models/operations/get_create_update_bankaccounts_model.py +++ b/lending/src/codat_lending/models/operations/get_create_update_bankaccounts_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_update_bankaccounts_model — re-export of the get_create_update_bankaccounts_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateUpdateBankAccountsModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateUpdateBankAccountsModelRequest(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_lending.api.bank_accounts import GetCreateUpdateBankAccountsModelRequest +from codat_lending.api.bank_accounts import GetCreateUpdateBankAccountsModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_create_update_suppliers_model.py b/lending/src/codat_lending/models/operations/get_create_update_suppliers_model.py index 878084a41..936581c13 100644 --- a/lending/src/codat_lending/models/operations/get_create_update_suppliers_model.py +++ b/lending/src/codat_lending/models/operations/get_create_update_suppliers_model.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_create_update_suppliers_model — re-export of the get_create_update_suppliers_model operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetCreateUpdateSuppliersModelRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class GetCreateUpdateSuppliersModelRequest(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_lending.api.loan_writeback_suppliers import GetCreateUpdateSuppliersModelRequest +from codat_lending.api.loan_writeback_suppliers import GetCreateUpdateSuppliersModelRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_data_integrity_status.py b/lending/src/codat_lending/models/operations/get_data_integrity_status.py index d0d2d5981..61a347ea9 100644 --- a/lending/src/codat_lending/models/operations/get_data_integrity_status.py +++ b/lending/src/codat_lending/models/operations/get_data_integrity_status.py @@ -1,33 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_data_integrity_status — re-export of the get_data_integrity_status operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - dataintegritydatatype as shared_dataintegritydatatype, -) -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetDataIntegrityStatusRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - data_type: shared_dataintegritydatatype.DataIntegrityDataType - r"""A key for a Codat data type.""" - - -class GetDataIntegrityStatusRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - data_type: Annotated[ - shared_dataintegritydatatype.DataIntegrityDataType, - pydantic.Field(alias="dataType"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""A key for a Codat data type.""" +from codat_lending.api.data_integrity import GetDataIntegrityStatusRequest +from codat_lending.api.data_integrity import GetDataIntegrityStatusRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_data_integrity_summaries.py b/lending/src/codat_lending/models/operations/get_data_integrity_summaries.py index 89a62641e..6298f0d4f 100644 --- a/lending/src/codat_lending/models/operations/get_data_integrity_summaries.py +++ b/lending/src/codat_lending/models/operations/get_data_integrity_summaries.py @@ -1,59 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_data_integrity_summaries — re-export of the get_data_integrity_summaries operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - dataintegritydatatype as shared_dataintegritydatatype, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetDataIntegritySummariesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - data_type: shared_dataintegritydatatype.DataIntegrityDataType - r"""A key for a Codat data type.""" - query: NotRequired[str] - r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" - - -class GetDataIntegritySummariesRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - data_type: Annotated[ - shared_dataintegritydatatype.DataIntegrityDataType, - pydantic.Field(alias="dataType"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""A key for a Codat data type.""" - - 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(["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_lending.api.data_integrity import GetDataIntegritySummariesRequest +from codat_lending.api.data_integrity import GetDataIntegritySummariesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_data_status.py b/lending/src/codat_lending/models/operations/get_data_status.py index b9deec8b4..5995d38a3 100644 --- a/lending/src/codat_lending/models/operations/get_data_status.py +++ b/lending/src/codat_lending/models/operations/get_data_status.py @@ -1,400 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_data_status — re-export of the get_data_status operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import datastatus as shared_datastatus -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetDataStatusRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class GetDataStatusRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - -class GetDataStatusDataStatusesTypedDict(TypedDict): - r"""OK""" - - account_transactions: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - balance_sheet: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - bank_accounts: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - bank_transactions: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - banking_account_balances: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - banking_accounts: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - banking_transaction_categories: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - banking_transactions: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - bill_credit_notes: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - bill_payments: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - bills: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - cash_flow_statement: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - chart_of_accounts: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_company_info: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_customers: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_disputes: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_locations: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_orders: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_payment_methods: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_payments: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_product_categories: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_products: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_tax_components: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - commerce_transactions: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - company: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - credit_notes: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - customers: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - direct_costs: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - direct_incomes: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - invoices: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - item_receipts: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - items: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - journal_entries: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - journals: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - payment_methods: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - payments: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - profit_and_loss: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - purchase_orders: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - sales_orders: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - suppliers: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - tax_rates: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - tracking_categories: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - transfers: NotRequired[shared_datastatus.DataStatusTypedDict] - r"""Describes the state of data in the Codat cache for a company and data type""" - - -class GetDataStatusDataStatuses(BaseModel): - r"""OK""" - - account_transactions: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="accountTransactions"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - balance_sheet: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="balanceSheet") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - bank_accounts: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="bankAccounts") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - bank_transactions: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="bankTransactions") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - banking_account_balances: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="banking-accountBalances"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - banking_accounts: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="banking-accounts") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - banking_transaction_categories: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="banking-transactionCategories"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - banking_transactions: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="banking-transactions"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - bill_credit_notes: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="billCreditNotes") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - bill_payments: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="billPayments") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - bills: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - cash_flow_statement: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="cashFlowStatement"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - chart_of_accounts: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="chartOfAccounts") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_company_info: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-companyInfo"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_customers: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-customers"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_disputes: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-disputes"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_locations: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-locations"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_orders: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="commerce-orders") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_payment_methods: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-paymentMethods"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_payments: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-payments"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_product_categories: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-productCategories"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_products: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-products"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_tax_components: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-taxComponents"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - commerce_transactions: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="commerce-transactions"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - company: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - credit_notes: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="creditNotes") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - customers: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - direct_costs: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="directCosts") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - direct_incomes: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="directIncomes") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - invoices: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - item_receipts: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="itemReceipts") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - items: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - journal_entries: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="journalEntries") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - journals: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - payment_methods: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="paymentMethods") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - payments: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - profit_and_loss: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="profitAndLoss") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - purchase_orders: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="purchaseOrders") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - sales_orders: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="salesOrders") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - suppliers: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - tax_rates: Annotated[ - Optional[shared_datastatus.DataStatus], pydantic.Field(alias="taxRates") - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - tracking_categories: Annotated[ - Optional[shared_datastatus.DataStatus], - pydantic.Field(alias="trackingCategories"), - ] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - transfers: Optional[shared_datastatus.DataStatus] = None - r"""Describes the state of data in the Codat cache for a company and data type""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountTransactions", - "balanceSheet", - "bankAccounts", - "bankTransactions", - "banking-accountBalances", - "banking-accounts", - "banking-transactionCategories", - "banking-transactions", - "billCreditNotes", - "billPayments", - "bills", - "cashFlowStatement", - "chartOfAccounts", - "commerce-companyInfo", - "commerce-customers", - "commerce-disputes", - "commerce-locations", - "commerce-orders", - "commerce-paymentMethods", - "commerce-payments", - "commerce-productCategories", - "commerce-products", - "commerce-taxComponents", - "commerce-transactions", - "company", - "creditNotes", - "customers", - "directCosts", - "directIncomes", - "invoices", - "itemReceipts", - "items", - "journalEntries", - "journals", - "paymentMethods", - "payments", - "profitAndLoss", - "purchaseOrders", - "salesOrders", - "suppliers", - "taxRates", - "trackingCategories", - "transfers", - ] - ) - 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: - GetDataStatusDataStatuses.model_rebuild() -except NameError: - pass +from codat_lending.models.data_statuses import GetDataStatusDataStatuses +from codat_lending.models.data_statuses import GetDataStatusDataStatusesTypedDict +from codat_lending.api.manage_data import GetDataStatusRequest +from codat_lending.api.manage_data import GetDataStatusRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_excel_report_generation_status.py b/lending/src/codat_lending/models/operations/get_excel_report_generation_status.py index ce7076718..4a786e133 100644 --- a/lending/src/codat_lending/models/operations/get_excel_report_generation_status.py +++ b/lending/src/codat_lending/models/operations/get_excel_report_generation_status.py @@ -1,31 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_excel_report_generation_status — re-export of the get_excel_report_generation_status operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import excelreporttypes as shared_excelreporttypes -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetExcelReportGenerationStatusRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - report_type: shared_excelreporttypes.ExcelReportTypes - r"""The type of report you want to generate and download.""" - - -class GetExcelReportGenerationStatusRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - report_type: Annotated[ - shared_excelreporttypes.ExcelReportTypes, - pydantic.Field(alias="reportType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""The type of report you want to generate and download.""" +from codat_lending.api.excel_reports import GetExcelReportGenerationStatusRequest +from codat_lending.api.excel_reports import GetExcelReportGenerationStatusRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/get_loan_summary.py b/lending/src/codat_lending/models/operations/get_loan_summary.py index 54ab4b5d7..da1073fb8 100644 --- a/lending/src/codat_lending/models/operations/get_loan_summary.py +++ b/lending/src/codat_lending/models/operations/get_loan_summary.py @@ -1,39 +1,10 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata + from enum import Enum -import pydantic -from typing_extensions import Annotated, TypedDict class GetLoanSummaryQueryParamSourceType(str, Enum): - r"""Data source type.""" - - BANKING = "banking" - COMMERCE = "commerce" - ACCOUNTING = "accounting" - - -class GetLoanSummaryRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - source_type: GetLoanSummaryQueryParamSourceType - r"""Data source type.""" - - -class GetLoanSummaryRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - source_type: Annotated[ - GetLoanSummaryQueryParamSourceType, - pydantic.Field(alias="sourceType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Data source type.""" + """Operation-parameter enum (lifted from inline OAS enum on get-loan-summary).""" + BANKING = 'banking' + COMMERCE = 'commerce' + ACCOUNTING = 'accounting' diff --git a/lending/src/codat_lending/models/operations/get_pull_operation.py b/lending/src/codat_lending/models/operations/get_pull_operation.py index 773f4de5c..34a28845c 100644 --- a/lending/src/codat_lending/models/operations/get_pull_operation.py +++ b/lending/src/codat_lending/models/operations/get_pull_operation.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.get_pull_operation — re-export of the get_pull_operation operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class GetPullOperationRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - dataset_id: str - r"""Unique identifier for the dataset that completed its sync.""" - - -class GetPullOperationRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - dataset_id: Annotated[ - str, - pydantic.Field(alias="datasetId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for the dataset that completed its sync.""" +from codat_lending.api.pull_operations import GetPullOperationRequest +from codat_lending.api.pull_operations import GetPullOperationRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/is_aged_creditors_report_available.py b/lending/src/codat_lending/models/operations/is_aged_creditors_report_available.py index a2fd5b9d4..6f623d5ee 100644 --- a/lending/src/codat_lending/models/operations/is_aged_creditors_report_available.py +++ b/lending/src/codat_lending/models/operations/is_aged_creditors_report_available.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.is_aged_creditors_report_available — re-export of the is_aged_creditors_report_available operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class IsAgedCreditorsReportAvailableRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class IsAgedCreditorsReportAvailableRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.reports import IsAgedCreditorsReportAvailableRequest +from codat_lending.api.reports import IsAgedCreditorsReportAvailableRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/is_aged_debtors_report_available.py b/lending/src/codat_lending/models/operations/is_aged_debtors_report_available.py index f722191e0..225dc914f 100644 --- a/lending/src/codat_lending/models/operations/is_aged_debtors_report_available.py +++ b/lending/src/codat_lending/models/operations/is_aged_debtors_report_available.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.is_aged_debtors_report_available — re-export of the is_aged_debtors_report_available operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class IsAgedDebtorsReportAvailableRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class IsAgedDebtorsReportAvailableRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.reports import IsAgedDebtorsReportAvailableRequest +from codat_lending.api.reports import IsAgedDebtorsReportAvailableRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_account_transactions.py b/lending/src/codat_lending/models/operations/list_accounting_account_transactions.py index 776cb3b3a..92959265a 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_account_transactions.py +++ b/lending/src/codat_lending/models/operations/list_accounting_account_transactions.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_account_transactions — re-export of the list_accounting_account_transactions operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingAccountTransactionsRequestTypedDict(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 ListAccountingAccountTransactionsRequest(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_lending.api.account_transactions import ListAccountingAccountTransactionsRequest +from codat_lending.api.account_transactions import ListAccountingAccountTransactionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_accounts.py b/lending/src/codat_lending/models/operations/list_accounting_accounts.py index b7139390a..24faf8194 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_accounts.py +++ b/lending/src/codat_lending/models/operations/list_accounting_accounts.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_accounts — re-export of the list_accounting_accounts operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingAccountsRequestTypedDict(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 ListAccountingAccountsRequest(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_lending.api.financial_statements_accounts import ListAccountingAccountsRequest +from codat_lending.api.financial_statements_accounts import ListAccountingAccountsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bank_account_transactions.py b/lending/src/codat_lending/models/operations/list_accounting_bank_account_transactions.py index 2e2d5146e..dc2d618ca 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bank_account_transactions.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bank_account_transactions.py @@ -1,91 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bank_account_transactions — re-export of the list_accounting_bank_account_transactions operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingBankAccountTransactionsRequestTypedDict(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.""" - 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 ListAccountingBankAccountTransactionsRequest(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.""" - - 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_lending.api.accounting_bank_data import ListAccountingBankAccountTransactionsRequest +from codat_lending.api.accounting_bank_data import ListAccountingBankAccountTransactionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bank_accounts.py b/lending/src/codat_lending/models/operations/list_accounting_bank_accounts.py index 492d45b3a..99ed6873c 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bank_accounts.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bank_accounts.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bank_accounts — re-export of the list_accounting_bank_accounts operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingBankAccountsRequestTypedDict(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 ListAccountingBankAccountsRequest(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_lending.api.accounts import ListAccountingBankAccountsRequest +from codat_lending.api.accounts import ListAccountingBankAccountsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bill_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_bill_attachments.py index 0cf32a183..40fb40e1f 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bill_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bill_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bill_attachments — re-export of the list_accounting_bill_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingBillAttachmentsRequestTypedDict(TypedDict): - bill_id: str - r"""Unique identifier for a bill.""" - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class ListAccountingBillAttachmentsRequest(BaseModel): - bill_id: Annotated[ - str, - pydantic.Field(alias="billId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a bill.""" - - 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_lending.api.bills import ListAccountingBillAttachmentsRequest +from codat_lending.api.bills import ListAccountingBillAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bill_credit_notes.py b/lending/src/codat_lending/models/operations/list_accounting_bill_credit_notes.py index ba242510c..367c9af99 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bill_credit_notes.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bill_credit_notes.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bill_credit_notes — re-export of the list_accounting_bill_credit_notes operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingBillCreditNotesRequestTypedDict(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 ListAccountingBillCreditNotesRequest(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_lending.api.bill_credit_notes import ListAccountingBillCreditNotesRequest +from codat_lending.api.bill_credit_notes import ListAccountingBillCreditNotesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bill_payments.py b/lending/src/codat_lending/models/operations/list_accounting_bill_payments.py index 1a6cb7550..f2abb5627 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bill_payments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bill_payments.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bill_payments — re-export of the list_accounting_bill_payments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingBillPaymentsRequestTypedDict(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 ListAccountingBillPaymentsRequest(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_lending.api.bill_payments import ListAccountingBillPaymentsRequest +from codat_lending.api.bill_payments import ListAccountingBillPaymentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_bills.py b/lending/src/codat_lending/models/operations/list_accounting_bills.py index 53ffe10f6..4c662217a 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_bills.py +++ b/lending/src/codat_lending/models/operations/list_accounting_bills.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_bills — re-export of the list_accounting_bills operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingBillsRequestTypedDict(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 ListAccountingBillsRequest(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_lending.api.bills import ListAccountingBillsRequest +from codat_lending.api.bills import ListAccountingBillsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_credit_notes.py b/lending/src/codat_lending/models/operations/list_accounting_credit_notes.py index 3eb36f52a..fc1745ccf 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_credit_notes.py +++ b/lending/src/codat_lending/models/operations/list_accounting_credit_notes.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_credit_notes — re-export of the list_accounting_credit_notes operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingCreditNotesRequestTypedDict(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 ListAccountingCreditNotesRequest(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_lending.api.credit_notes import ListAccountingCreditNotesRequest +from codat_lending.api.credit_notes import ListAccountingCreditNotesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_customer_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_customer_attachments.py index 4df6df2c5..699a58dba 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_customer_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_customer_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_customer_attachments — re-export of the list_accounting_customer_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingCustomerAttachmentsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - customer_id: str - r"""Unique identifier for a customer.""" - - -class ListAccountingCustomerAttachmentsRequest(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.""" - - customer_id: Annotated[ - str, - pydantic.Field(alias="customerId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a customer.""" +from codat_lending.api.customers import ListAccountingCustomerAttachmentsRequest +from codat_lending.api.customers import ListAccountingCustomerAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_customers.py b/lending/src/codat_lending/models/operations/list_accounting_customers.py index 903ec2741..dc16bda82 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_customers.py +++ b/lending/src/codat_lending/models/operations/list_accounting_customers.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_customers — re-export of the list_accounting_customers operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingCustomersRequestTypedDict(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 ListAccountingCustomersRequest(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_lending.api.customers import ListAccountingCustomersRequest +from codat_lending.api.customers import ListAccountingCustomersRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_direct_cost_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_direct_cost_attachments.py index a51112670..994a5e927 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_direct_cost_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_direct_cost_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_direct_cost_attachments — re-export of the list_accounting_direct_cost_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingDirectCostAttachmentsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_cost_id: str - r"""Unique identifier for a direct cost.""" - - -class ListAccountingDirectCostAttachmentsRequest(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.""" - - direct_cost_id: Annotated[ - str, - pydantic.Field(alias="directCostId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct cost.""" +from codat_lending.api.transactions_direct_costs import ListAccountingDirectCostAttachmentsRequest +from codat_lending.api.transactions_direct_costs import ListAccountingDirectCostAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_direct_costs.py b/lending/src/codat_lending/models/operations/list_accounting_direct_costs.py index 25e796e70..d78e332ab 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_direct_costs.py +++ b/lending/src/codat_lending/models/operations/list_accounting_direct_costs.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_direct_costs — re-export of the list_accounting_direct_costs operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingDirectCostsRequestTypedDict(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 ListAccountingDirectCostsRequest(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_lending.api.transactions_direct_costs import ListAccountingDirectCostsRequest +from codat_lending.api.transactions_direct_costs import ListAccountingDirectCostsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_direct_income_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_direct_income_attachments.py index 824883ec1..faeb6f548 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_direct_income_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_direct_income_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_direct_income_attachments — re-export of the list_accounting_direct_income_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingDirectIncomeAttachmentsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - direct_income_id: str - r"""Unique identifier for a direct income.""" - - -class ListAccountingDirectIncomeAttachmentsRequest(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.""" - - direct_income_id: Annotated[ - str, - pydantic.Field(alias="directIncomeId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a direct income.""" +from codat_lending.api.direct_incomes import ListAccountingDirectIncomeAttachmentsRequest +from codat_lending.api.direct_incomes import ListAccountingDirectIncomeAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_direct_incomes.py b/lending/src/codat_lending/models/operations/list_accounting_direct_incomes.py index a22e54b5f..aa5378e15 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_direct_incomes.py +++ b/lending/src/codat_lending/models/operations/list_accounting_direct_incomes.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_direct_incomes — re-export of the list_accounting_direct_incomes operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingDirectIncomesRequestTypedDict(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 ListAccountingDirectIncomesRequest(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_lending.api.direct_incomes import ListAccountingDirectIncomesRequest +from codat_lending.api.direct_incomes import ListAccountingDirectIncomesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_invoice_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_invoice_attachments.py index 6f03b94d8..953d2c6a2 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_invoice_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_invoice_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_invoice_attachments — re-export of the list_accounting_invoice_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingInvoiceAttachmentsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - invoice_id: str - r"""Unique identifier for an invoice.""" - - -class ListAccountingInvoiceAttachmentsRequest(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.""" - - invoice_id: Annotated[ - str, - pydantic.Field(alias="invoiceId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for an invoice.""" +from codat_lending.api.invoices import ListAccountingInvoiceAttachmentsRequest +from codat_lending.api.invoices import ListAccountingInvoiceAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_invoices.py b/lending/src/codat_lending/models/operations/list_accounting_invoices.py index 380313fd5..7697d5ffd 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_invoices.py +++ b/lending/src/codat_lending/models/operations/list_accounting_invoices.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_invoices — re-export of the list_accounting_invoices operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingInvoicesRequestTypedDict(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 ListAccountingInvoicesRequest(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_lending.api.invoices import ListAccountingInvoicesRequest +from codat_lending.api.invoices import ListAccountingInvoicesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_journal_entries.py b/lending/src/codat_lending/models/operations/list_accounting_journal_entries.py index ca3ea73d9..fada154c2 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_journal_entries.py +++ b/lending/src/codat_lending/models/operations/list_accounting_journal_entries.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_journal_entries — re-export of the list_accounting_journal_entries operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingJournalEntriesRequestTypedDict(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 ListAccountingJournalEntriesRequest(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_lending.api.journal_entries import ListAccountingJournalEntriesRequest +from codat_lending.api.journal_entries import ListAccountingJournalEntriesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_journals.py b/lending/src/codat_lending/models/operations/list_accounting_journals.py index 099df679e..8950a2a9c 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_journals.py +++ b/lending/src/codat_lending/models/operations/list_accounting_journals.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_journals — re-export of the list_accounting_journals operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingJournalsRequestTypedDict(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 ListAccountingJournalsRequest(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_lending.api.journals import ListAccountingJournalsRequest +from codat_lending.api.journals import ListAccountingJournalsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_payments.py b/lending/src/codat_lending/models/operations/list_accounting_payments.py index 4caea5612..5d9d35436 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_payments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_payments.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_payments — re-export of the list_accounting_payments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingPaymentsRequestTypedDict(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 ListAccountingPaymentsRequest(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_lending.api.payments import ListAccountingPaymentsRequest +from codat_lending.api.payments import ListAccountingPaymentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_supplier_attachments.py b/lending/src/codat_lending/models/operations/list_accounting_supplier_attachments.py index dcbc7eeff..a2756fbfa 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_supplier_attachments.py +++ b/lending/src/codat_lending/models/operations/list_accounting_supplier_attachments.py @@ -1,39 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_supplier_attachments — re-export of the list_accounting_supplier_attachments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListAccountingSupplierAttachmentsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - supplier_id: str - r"""Unique identifier for a supplier.""" - - -class ListAccountingSupplierAttachmentsRequest(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.""" - - supplier_id: Annotated[ - str, - pydantic.Field(alias="supplierId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a supplier.""" +from codat_lending.api.suppliers import ListAccountingSupplierAttachmentsRequest +from codat_lending.api.suppliers import ListAccountingSupplierAttachmentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_suppliers.py b/lending/src/codat_lending/models/operations/list_accounting_suppliers.py index 5ae092914..ad516b719 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_suppliers.py +++ b/lending/src/codat_lending/models/operations/list_accounting_suppliers.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_suppliers — re-export of the list_accounting_suppliers operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingSuppliersRequestTypedDict(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 ListAccountingSuppliersRequest(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_lending.api.suppliers import ListAccountingSuppliersRequest +from codat_lending.api.suppliers import ListAccountingSuppliersRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_accounting_transfers.py b/lending/src/codat_lending/models/operations/list_accounting_transfers.py index e8b52c02d..62ea2e888 100644 --- a/lending/src/codat_lending/models/operations/list_accounting_transfers.py +++ b/lending/src/codat_lending/models/operations/list_accounting_transfers.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_accounting_transfers — re-export of the list_accounting_transfers operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListAccountingTransfersRequestTypedDict(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 ListAccountingTransfersRequest(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_lending.api.transactions_transfers import ListAccountingTransfersRequest +from codat_lending.api.transactions_transfers import ListAccountingTransfersRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_banking_account_balances.py b/lending/src/codat_lending/models/operations/list_banking_account_balances.py index bfe0b213d..b7fda6d14 100644 --- a/lending/src/codat_lending/models/operations/list_banking_account_balances.py +++ b/lending/src/codat_lending/models/operations/list_banking_account_balances.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_banking_account_balances — re-export of the list_banking_account_balances operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListBankingAccountBalancesRequestTypedDict(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 ListBankingAccountBalancesRequest(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_lending.api.account_balances import ListBankingAccountBalancesRequest +from codat_lending.api.account_balances import ListBankingAccountBalancesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_banking_accounts.py b/lending/src/codat_lending/models/operations/list_banking_accounts.py index 9468ce423..37b265b91 100644 --- a/lending/src/codat_lending/models/operations/list_banking_accounts.py +++ b/lending/src/codat_lending/models/operations/list_banking_accounts.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_banking_accounts — re-export of the list_banking_accounts operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListBankingAccountsRequestTypedDict(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 ListBankingAccountsRequest(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_lending.api.banking_accounts import ListBankingAccountsRequest +from codat_lending.api.banking_accounts import ListBankingAccountsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_banking_transaction_categories.py b/lending/src/codat_lending/models/operations/list_banking_transaction_categories.py index 8cd6e18fa..a81087b7a 100644 --- a/lending/src/codat_lending/models/operations/list_banking_transaction_categories.py +++ b/lending/src/codat_lending/models/operations/list_banking_transaction_categories.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_banking_transaction_categories — re-export of the list_banking_transaction_categories operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListBankingTransactionCategoriesRequestTypedDict(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 ListBankingTransactionCategoriesRequest(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_lending.api.transaction_categories import ListBankingTransactionCategoriesRequest +from codat_lending.api.transaction_categories import ListBankingTransactionCategoriesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_banking_transactions.py b/lending/src/codat_lending/models/operations/list_banking_transactions.py index f8b72f79b..1d4d848c7 100644 --- a/lending/src/codat_lending/models/operations/list_banking_transactions.py +++ b/lending/src/codat_lending/models/operations/list_banking_transactions.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_banking_transactions — re-export of the list_banking_transactions operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListBankingTransactionsRequestTypedDict(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 ListBankingTransactionsRequest(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_lending.api.transactions import ListBankingTransactionsRequest +from codat_lending.api.transactions import ListBankingTransactionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_customers.py b/lending/src/codat_lending/models/operations/list_commerce_customers.py index b84e180aa..31a421d27 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_customers.py +++ b/lending/src/codat_lending/models/operations/list_commerce_customers.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_customers — re-export of the list_commerce_customers operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceCustomersRequestTypedDict(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 ListCommerceCustomersRequest(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_lending.api.sales_customers import ListCommerceCustomersRequest +from codat_lending.api.sales_customers import ListCommerceCustomersRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_disputes.py b/lending/src/codat_lending/models/operations/list_commerce_disputes.py index 9e16ef500..96c3e5ef2 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_disputes.py +++ b/lending/src/codat_lending/models/operations/list_commerce_disputes.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_disputes — re-export of the list_commerce_disputes operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceDisputesRequestTypedDict(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 ListCommerceDisputesRequest(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_lending.api.disputes import ListCommerceDisputesRequest +from codat_lending.api.disputes import ListCommerceDisputesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_locations.py b/lending/src/codat_lending/models/operations/list_commerce_locations.py index 829a6f1bc..d0d9b17e9 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_locations.py +++ b/lending/src/codat_lending/models/operations/list_commerce_locations.py @@ -1,30 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_locations — re-export of the list_commerce_locations operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListCommerceLocationsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - - -class ListCommerceLocationsRequest(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_lending.api.locations import ListCommerceLocationsRequest +from codat_lending.api.locations import ListCommerceLocationsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_orders.py b/lending/src/codat_lending/models/operations/list_commerce_orders.py index 38c4f657f..78e5d3cee 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_orders.py +++ b/lending/src/codat_lending/models/operations/list_commerce_orders.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_orders — re-export of the list_commerce_orders operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceOrdersRequestTypedDict(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 ListCommerceOrdersRequest(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_lending.api.orders import ListCommerceOrdersRequest +from codat_lending.api.orders import ListCommerceOrdersRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_payment_methods.py b/lending/src/codat_lending/models/operations/list_commerce_payment_methods.py index 5104ee96f..e99263ca5 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_payment_methods.py +++ b/lending/src/codat_lending/models/operations/list_commerce_payment_methods.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_payment_methods — re-export of the list_commerce_payment_methods operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommercePaymentMethodsRequestTypedDict(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 ListCommercePaymentMethodsRequest(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_lending.api.payment_methods import ListCommercePaymentMethodsRequest +from codat_lending.api.payment_methods import ListCommercePaymentMethodsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_payments.py b/lending/src/codat_lending/models/operations/list_commerce_payments.py index 74792de57..8677fc6ee 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_payments.py +++ b/lending/src/codat_lending/models/operations/list_commerce_payments.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_payments — re-export of the list_commerce_payments operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommercePaymentsRequestTypedDict(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 ListCommercePaymentsRequest(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_lending.api.sales_payments import ListCommercePaymentsRequest +from codat_lending.api.sales_payments import ListCommercePaymentsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_product_categories.py b/lending/src/codat_lending/models/operations/list_commerce_product_categories.py index 50fc5b739..b323de476 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_product_categories.py +++ b/lending/src/codat_lending/models/operations/list_commerce_product_categories.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_product_categories — re-export of the list_commerce_product_categories operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceProductCategoriesRequestTypedDict(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 ListCommerceProductCategoriesRequest(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_lending.api.product_categories import ListCommerceProductCategoriesRequest +from codat_lending.api.product_categories import ListCommerceProductCategoriesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_products.py b/lending/src/codat_lending/models/operations/list_commerce_products.py index 7364ef164..67a2209c2 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_products.py +++ b/lending/src/codat_lending/models/operations/list_commerce_products.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_products — re-export of the list_commerce_products operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceProductsRequestTypedDict(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 ListCommerceProductsRequest(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_lending.api.products import ListCommerceProductsRequest +from codat_lending.api.products import ListCommerceProductsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_commerce_transactions.py b/lending/src/codat_lending/models/operations/list_commerce_transactions.py index 5fb66ad87..2230c0734 100644 --- a/lending/src/codat_lending/models/operations/list_commerce_transactions.py +++ b/lending/src/codat_lending/models/operations/list_commerce_transactions.py @@ -1,82 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_commerce_transactions — re-export of the list_commerce_transactions operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListCommerceTransactionsRequestTypedDict(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 ListCommerceTransactionsRequest(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_lending.api.sales_transactions import ListCommerceTransactionsRequest +from codat_lending.api.sales_transactions import ListCommerceTransactionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_companies.py b/lending/src/codat_lending/models/operations/list_companies.py index 51aa39bce..bc3559012 100644 --- a/lending/src/codat_lending/models/operations/list_companies.py +++ b/lending/src/codat_lending/models/operations/list_companies.py @@ -1,72 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_companies — re-export of the list_companies operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.companies import ListCompaniesRequest +from codat_lending.api.companies import ListCompaniesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_connections.py b/lending/src/codat_lending/models/operations/list_connections.py index f414fc669..5b417df0d 100644 --- a/lending/src/codat_lending/models/operations/list_connections.py +++ b/lending/src/codat_lending/models/operations/list_connections.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_connections — re-export of the list_connections operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.connections import ListConnectionsRequest +from codat_lending.api.connections import ListConnectionsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_create_operations.py b/lending/src/codat_lending/models/operations/list_create_operations.py index 1fef21838..4e651853e 100644 --- a/lending/src/codat_lending/models/operations/list_create_operations.py +++ b/lending/src/codat_lending/models/operations/list_create_operations.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_create_operations — re-export of the list_create_operations operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.create_operations import ListCreateOperationsRequest +from codat_lending.api.create_operations import ListCreateOperationsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_data_integrity_details.py b/lending/src/codat_lending/models/operations/list_data_integrity_details.py index b88f7f68e..36cc3448b 100644 --- a/lending/src/codat_lending/models/operations/list_data_integrity_details.py +++ b/lending/src/codat_lending/models/operations/list_data_integrity_details.py @@ -1,85 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_data_integrity_details — re-export of the list_data_integrity_details operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - dataintegritydatatype as shared_dataintegritydatatype, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListDataIntegrityDetailsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - data_type: shared_dataintegritydatatype.DataIntegrityDataType - r"""A key for a Codat data type.""" - 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 ListDataIntegrityDetailsRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - data_type: Annotated[ - shared_dataintegritydatatype.DataIntegrityDataType, - pydantic.Field(alias="dataType"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""A key for a Codat data type.""" - - 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_lending.api.data_integrity import ListDataIntegrityDetailsRequest +from codat_lending.api.data_integrity import ListDataIntegrityDetailsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_files.py b/lending/src/codat_lending/models/operations/list_files.py index 4d30495a7..a85749848 100644 --- a/lending/src/codat_lending/models/operations/list_files.py +++ b/lending/src/codat_lending/models/operations/list_files.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_files — re-export of the list_files operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class ListFilesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class ListFilesRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.file_upload import ListFilesRequest +from codat_lending.api.file_upload import ListFilesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_loan_transactions.py b/lending/src/codat_lending/models/operations/list_loan_transactions.py index 4161193d6..2ab892021 100644 --- a/lending/src/codat_lending/models/operations/list_loan_transactions.py +++ b/lending/src/codat_lending/models/operations/list_loan_transactions.py @@ -1,39 +1,10 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata + from enum import Enum -import pydantic -from typing_extensions import Annotated, TypedDict class ListLoanTransactionsQueryParamSourceType(str, Enum): - r"""Data source type.""" - - BANKING = "banking" - COMMERCE = "commerce" - ACCOUNTING = "accounting" - - -class ListLoanTransactionsRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - source_type: ListLoanTransactionsQueryParamSourceType - r"""Data source type.""" - - -class ListLoanTransactionsRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - source_type: Annotated[ - ListLoanTransactionsQueryParamSourceType, - pydantic.Field(alias="sourceType"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] - r"""Data source type.""" + """Operation-parameter enum (lifted from inline OAS enum on list-loan-transactions).""" + BANKING = 'banking' + COMMERCE = 'commerce' + ACCOUNTING = 'accounting' diff --git a/lending/src/codat_lending/models/operations/list_pull_operations.py b/lending/src/codat_lending/models/operations/list_pull_operations.py index dc2c43ad8..7b7c0d892 100644 --- a/lending/src/codat_lending/models/operations/list_pull_operations.py +++ b/lending/src/codat_lending/models/operations/list_pull_operations.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_pull_operations — re-export of the list_pull_operations operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListPullOperationsRequestTypedDict(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 ListPullOperationsRequest(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_lending.api.pull_operations import ListPullOperationsRequest +from codat_lending.api.pull_operations import ListPullOperationsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_reconciled_invoices.py b/lending/src/codat_lending/models/operations/list_reconciled_invoices.py index 127c2a684..ed40983b4 100644 --- a/lending/src/codat_lending/models/operations/list_reconciled_invoices.py +++ b/lending/src/codat_lending/models/operations/list_reconciled_invoices.py @@ -1,64 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_reconciled_invoices — re-export of the list_reconciled_invoices operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListReconciledInvoicesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - page: NotRequired[int] - r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" - page_size: NotRequired[int] - r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" - query: NotRequired[str] - r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" - - -class ListReconciledInvoicesRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - page: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 1 - r"""Page number. [Read more](https://docs.codat.io/using-the-api/paging).""" - - page_size: Annotated[ - Optional[int], - pydantic.Field(alias="pageSize"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 100 - r"""Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging).""" - - query: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Codat query string. [Read more](https://docs.codat.io/using-the-api/querying).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["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_lending.api.invoices import ListReconciledInvoicesRequest +from codat_lending.api.invoices import ListReconciledInvoicesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/list_reports.py b/lending/src/codat_lending/models/operations/list_reports.py index 87b296df7..d1c78c211 100644 --- a/lending/src/codat_lending/models/operations/list_reports.py +++ b/lending/src/codat_lending/models/operations/list_reports.py @@ -1,73 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.list_reports — re-export of the list_reports operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListReportsRequestTypedDict(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 ListReportsRequest(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_lending.api.manage_reports import ListReportsRequest +from codat_lending.api.manage_reports import ListReportsRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/refresh_all_data_types.py b/lending/src/codat_lending/models/operations/refresh_all_data_types.py index 823e221df..4c85ed164 100644 --- a/lending/src/codat_lending/models/operations/refresh_all_data_types.py +++ b/lending/src/codat_lending/models/operations/refresh_all_data_types.py @@ -1,21 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.refresh_all_data_types — re-export of the refresh_all_data_types operation envelope.""" -from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, PathParamMetadata -import pydantic -from typing_extensions import Annotated, TypedDict - - -class RefreshAllDataTypesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - - -class RefreshAllDataTypesRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" +from codat_lending.api.refresh import RefreshAllDataTypesRequest +from codat_lending.api.refresh import RefreshAllDataTypesRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/refresh_data_type.py b/lending/src/codat_lending/models/operations/refresh_data_type.py index 2dadd9521..5a62887a4 100644 --- a/lending/src/codat_lending/models/operations/refresh_data_type.py +++ b/lending/src/codat_lending/models/operations/refresh_data_type.py @@ -1,58 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.refresh_data_type — re-export of the refresh_data_type operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import schema_datatype as shared_schema_datatype -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class RefreshDataTypeRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - data_type: shared_schema_datatype.SchemaDataType - r"""A key for a Codat data type.""" - connection_id: NotRequired[str] - r"""Optionally, provide a data connection id to only queue pull operations on that connection.""" - - -class RefreshDataTypeRequest(BaseModel): - company_id: Annotated[ - str, - pydantic.Field(alias="companyId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for a company.""" - - data_type: Annotated[ - shared_schema_datatype.SchemaDataType, - pydantic.Field(alias="dataType"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""A key for a Codat data type.""" - - connection_id: Annotated[ - Optional[str], - pydantic.Field(alias="connectionId"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optionally, provide a data connection id to only queue pull operations on that connection.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["connectionId"]) - 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_lending.api.refresh import RefreshDataTypeRequest +from codat_lending.api.refresh import RefreshDataTypeRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/replace_company.py b/lending/src/codat_lending/models/operations/replace_company.py index ffed2988a..e510c5edb 100644 --- a/lending/src/codat_lending/models/operations/replace_company.py +++ b/lending/src/codat_lending/models/operations/replace_company.py @@ -1,48 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.replace_company — re-export of the replace_company operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import companyrequestbody as shared_companyrequestbody -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.companies import ReplaceCompanyRequest +from codat_lending.api.companies import ReplaceCompanyRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/set_bank_statement_upload_configuration.py b/lending/src/codat_lending/models/operations/set_bank_statement_upload_configuration.py index dc4f34c91..38750ff6b 100644 --- a/lending/src/codat_lending/models/operations/set_bank_statement_upload_configuration.py +++ b/lending/src/codat_lending/models/operations/set_bank_statement_upload_configuration.py @@ -1,61 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.set_bank_statement_upload_configuration — re-export of the set_bank_statement_upload_configuration operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - bankstatementuploadconfiguration as shared_bankstatementuploadconfiguration, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class SetBankStatementUploadConfigurationRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - bank_statement_upload_configuration: NotRequired[ - shared_bankstatementuploadconfiguration.BankStatementUploadConfigurationTypedDict - ] - - -class SetBankStatementUploadConfigurationRequest(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_statement_upload_configuration: Annotated[ - Optional[ - shared_bankstatementuploadconfiguration.BankStatementUploadConfiguration - ], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["BankStatementUploadConfiguration"]) - 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_lending.api.bank_statements import SetBankStatementUploadConfigurationRequest +from codat_lending.api.bank_statements import SetBankStatementUploadConfigurationRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/start_bank_statement_upload_session.py b/lending/src/codat_lending/models/operations/start_bank_statement_upload_session.py index a69a83170..3635bd9d1 100644 --- a/lending/src/codat_lending/models/operations/start_bank_statement_upload_session.py +++ b/lending/src/codat_lending/models/operations/start_bank_statement_upload_session.py @@ -1,59 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.start_bank_statement_upload_session — re-export of the start_bank_statement_upload_session operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - startuploadsessionrequest as shared_startuploadsessionrequest, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class StartBankStatementUploadSessionRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - start_upload_session_request: NotRequired[ - shared_startuploadsessionrequest.StartUploadSessionRequestTypedDict - ] - - -class StartBankStatementUploadSessionRequest(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.""" - - start_upload_session_request: Annotated[ - Optional[shared_startuploadsessionrequest.StartUploadSessionRequest], - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["StartUploadSessionRequest"]) - 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_lending.api.bank_statements import StartBankStatementUploadSessionRequest +from codat_lending.api.bank_statements import StartBankStatementUploadSessionRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/unlink_connection.py b/lending/src/codat_lending/models/operations/unlink_connection.py index 6d99b26d2..445d1c28f 100644 --- a/lending/src/codat_lending/models/operations/unlink_connection.py +++ b/lending/src/codat_lending/models/operations/unlink_connection.py @@ -1,83 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.unlink_connection — re-export of the unlink_connection operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - dataconnectionstatus as shared_dataconnectionstatus, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.connections import UnlinkConnectionRequest +from codat_lending.api.connections import UnlinkConnectionRequestTypedDict +from codat_lending.models.update_connection import UpdateConnection as UnlinkConnectionUpdateConnection +from codat_lending.models.update_connection import UpdateConnectionTypedDict as UnlinkConnectionUpdateConnectionTypedDict diff --git a/lending/src/codat_lending/models/operations/update_company.py b/lending/src/codat_lending/models/operations/update_company.py index aa39b9eca..711e4ea62 100644 --- a/lending/src/codat_lending/models/operations/update_company.py +++ b/lending/src/codat_lending/models/operations/update_company.py @@ -1,50 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.update_company — re-export of the update_company operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - companyupdaterequest as shared_companyupdaterequest, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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_lending.api.companies import UpdateCompanyRequest +from codat_lending.api.companies import UpdateCompanyRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/upload_bank_statement_data.py b/lending/src/codat_lending/models/operations/upload_bank_statement_data.py index 3f547d2e2..e4fc943a6 100644 --- a/lending/src/codat_lending/models/operations/upload_bank_statement_data.py +++ b/lending/src/codat_lending/models/operations/upload_bank_statement_data.py @@ -1,101 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.upload_bank_statement_data — re-export of the upload_bank_statement_data operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import ( - bankingaccount as shared_bankingaccount, - bankingtransactions as shared_bankingtransactions, - path as shared_path, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import ( - FieldMetadata, - PathParamMetadata, - QueryParamMetadata, - RequestMetadata, -) -import pydantic -from pydantic import model_serializer -from typing import Any, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -UploadBankStatementDataRequestBodyTypedDict = TypeAliasType( - "UploadBankStatementDataRequestBodyTypedDict", - Union[ - shared_bankingtransactions.BankingTransactionsTypedDict, - shared_bankingaccount.BankingAccountTypedDict, - Any, - ], -) - - -UploadBankStatementDataRequestBody = TypeAliasType( - "UploadBankStatementDataRequestBody", - Union[ - shared_bankingtransactions.BankingTransactions, - shared_bankingaccount.BankingAccount, - Any, - ], -) - - -class UploadBankStatementDataRequestTypedDict(TypedDict): - request_body: UploadBankStatementDataRequestBodyTypedDict - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - dataset_id: str - r"""Unique identifier for the dataset that completed its sync.""" - path: NotRequired[shared_path.Path] - r"""The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`.""" - - -class UploadBankStatementDataRequest(BaseModel): - request_body: Annotated[ - UploadBankStatementDataRequestBody, - 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.""" - - dataset_id: Annotated[ - str, - pydantic.Field(alias="datasetId"), - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] - r"""Unique identifier for the dataset that completed its sync.""" - - path: Annotated[ - Optional[shared_path.Path], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""The endpoint path of the third-party banking service that the request body originates from. Only required if the source is not `codat`.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["path"]) - 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_lending.api.bank_statements import UploadBankStatementDataRequest +from codat_lending.api.bank_statements import UploadBankStatementDataRequestTypedDict diff --git a/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body.py b/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body.py new file mode 100644 index 000000000..fafc476a9 --- /dev/null +++ b/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, Any +from typing_extensions import TypeAliasType +from codat_lending.models.shared.bankingtransactions import BankingTransactions +from codat_lending.models.shared.bankingaccount import BankingAccount + +UploadBankStatementDataRequestBody = TypeAliasType("UploadBankStatementDataRequestBody", Union[BankingTransactions, BankingAccount, Any]) diff --git a/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body_typed_dict.py b/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body_typed_dict.py new file mode 100644 index 000000000..160ee502f --- /dev/null +++ b/lending/src/codat_lending/models/operations/upload_bank_statement_data_request_body_typed_dict.py @@ -0,0 +1,7 @@ +from __future__ import annotations +from typing import Union, Any +from typing_extensions import TypeAliasType +from codat_lending.models.shared.bankingtransactions import BankingTransactionsTypedDict +from codat_lending.models.shared.bankingaccount import BankingAccountTypedDict + +UploadBankStatementDataRequestBodyTypedDict = TypeAliasType("UploadBankStatementDataRequestBodyTypedDict", Union[BankingTransactionsTypedDict, BankingAccountTypedDict, Any]) diff --git a/lending/src/codat_lending/models/operations/upload_files.py b/lending/src/codat_lending/models/operations/upload_files.py index ac3589338..a19210e3a 100644 --- a/lending/src/codat_lending/models/operations/upload_files.py +++ b/lending/src/codat_lending/models/operations/upload_files.py @@ -1,55 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.operations.upload_files — re-export of the upload_files operation envelope.""" -from __future__ import annotations -from codat_lending.models.shared import fileupload as shared_fileupload -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, PathParamMetadata, RequestMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class UploadFilesRequestTypedDict(TypedDict): - company_id: str - r"""Unique identifier for a company.""" - connection_id: str - r"""Unique identifier for a connection.""" - file_upload: NotRequired[shared_fileupload.FileUploadTypedDict] - - -class UploadFilesRequest(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.""" - - file_upload: Annotated[ - Optional[shared_fileupload.FileUpload], - FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")), - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["FileUpload"]) - 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_lending.api.file_upload import UploadFilesRequest +from codat_lending.api.file_upload import UploadFilesRequestTypedDict diff --git a/lending/src/codat_lending/models/paging_info.py b/lending/src/codat_lending/models/paging_info.py new file mode 100644 index 000000000..3a80803e8 --- /dev/null +++ b/lending/src/codat_lending/models/paging_info.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self + +class PagingInfo(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} + """ + PagingInfo + """ # 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 PagingInfo 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 PagingInfo 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 PagingInfoTypedDict(TypedDict): + """TypedDict variant of PagingInfo, for dict-literal request/response inputs.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] diff --git a/lending/src/codat_lending/models/payment_method_type.py b/lending/src/codat_lending/models/payment_method_type.py new file mode 100644 index 000000000..a6fd766f0 --- /dev/null +++ b/lending/src/codat_lending/models/payment_method_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 PaymentMethodType(str, Enum): + """ + Method of payment. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + CASH = 'Cash' + CHECK = 'Check' + CREDIT_CARD = 'CreditCard' + DEBIT_CARD = 'DebitCard' + BANK_TRANSFER = 'BankTransfer' + OTHER = 'Other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PaymentMethodType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/phone_number.py b/lending/src/codat_lending/models/phone_number.py new file mode 100644 index 000000000..af6c4d4fa --- /dev/null +++ b/lending/src/codat_lending/models/phone_number.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.type import Type +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_lending.models._compat.phonenumber import PhoneNumberType +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PhoneNumber(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'number'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PhoneNumber + """ # noqa: E501 + number: OptionalNullable[str] = Field(default=UNSET, description="A phone number.") + type: PhoneNumberType = Field(description="The type of phone number") + __properties: ClassVar[List[str]] = ["number", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['Primary', 'Landline', 'Mobile', 'Fax', 'Unknown']): + raise ValueError("must be one of enum values ('Primary', 'Landline', 'Mobile', 'Fax', '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 PhoneNumber 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 PhoneNumber from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "number": obj.get("number"), + "type": obj.get("type") + }) + return _obj + + + + + +class PhoneNumberTypedDict(TypedDict): + """TypedDict variant of PhoneNumber, for dict-literal request/response inputs.""" + number: NotRequired[Optional[str]] + type: NotRequired[PhoneNumberType] diff --git a/lending/src/codat_lending/models/purchase_order_reference.py b/lending/src/codat_lending/models/purchase_order_reference.py new file mode 100644 index 000000000..183330699 --- /dev/null +++ b/lending/src/codat_lending/models/purchase_order_reference.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PurchaseOrderReference(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'purchaseOrderNumber', 'purchase_order_number'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PurchaseOrderReference + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the purchase order, unique for the company in the accounting software.") + purchase_order_number: OptionalNullable[str] = Field(default=UNSET, description="Friendly reference for the purchase order, commonly generated by the accounting software.", alias="purchaseOrderNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "purchaseOrderNumber"] + + 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 PurchaseOrderReference 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 PurchaseOrderReference 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"), + "purchaseOrderNumber": obj.get("purchaseOrderNumber") + }) + # 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 PurchaseOrderReferenceTypedDict(TypedDict): + """TypedDict variant of PurchaseOrderReference, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + purchase_order_number: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/record_line_reference.py b/lending/src/codat_lending/models/record_line_reference.py new file mode 100644 index 000000000..8a1f5c672 --- /dev/null +++ b/lending/src/codat_lending/models/record_line_reference.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.record_line_reference_data_type import RecordLineReferenceDataType +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_lending.models._compat.billlineitem import BillLineItemDataType +class RecordLineReference(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} + """ + Links the current record line to the underlying record line that created it. For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' of the underlying record.") + data_type: Optional[BillLineItemDataType] = Field(default=None, description="Allowed name of the 'dataType'.", alias="dataType") + line_number: Optional[str] = Field(default=None, description="Line number of the underlying record.", alias="lineNumber") + __properties: ClassVar[List[str]] = ["id", "dataType", "lineNumber"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['purchaseOrders', 'bills']): + raise ValueError("must be one of enum values ('purchaseOrders', 'bills')") + 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 RecordLineReference 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 RecordLineReference 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"), + "lineNumber": obj.get("lineNumber") + }) + return _obj + + + + + +class RecordLineReferenceTypedDict(TypedDict): + """TypedDict variant of RecordLineReference, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[BillLineItemDataType]] + line_number: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/record_line_reference_data_type.py b/lending/src/codat_lending/models/record_line_reference_data_type.py new file mode 100644 index 000000000..ee45741fd --- /dev/null +++ b/lending/src/codat_lending/models/record_line_reference_data_type.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class RecordLineReferenceDataType(str, Enum): + """RecordLineReferenceDataType enum (lifted from inline OAS enum).""" + PURCHASE_ORDERS = 'purchaseOrders' + BILLS = 'bills' diff --git a/lending/src/codat_lending/models/report_item.py b/lending/src/codat_lending/models/report_item.py new file mode 100644 index 000000000..2879fe4f0 --- /dev/null +++ b/lending/src/codat_lending/models/report_item.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.enhancedreportaccountcategory import EnhancedReportAccountCategory, EnhancedReportAccountCategoryTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class ReportItem(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} + """ + ReportItem + """ # noqa: E501 + 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="date") + balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Balance of the account as reported on the profit and loss or Balance sheet.") + account_name: Optional[str] = Field(default=None, description="Name of the account.", alias="accountName") + account_id: Optional[str] = Field(default=None, description="The unique account ID.", alias="accountId") + account_category: Optional[EnhancedReportAccountCategory] = Field(default=None, alias="accountCategory") + __properties: ClassVar[List[str]] = ["date", "balance", "accountName", "accountId", "accountCategory"] + + 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 ReportItem 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_category + if self.account_category: + _dict['accountCategory'] = self.account_category.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReportItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "balance": obj.get("balance"), + "accountName": obj.get("accountName"), + "accountId": obj.get("accountId"), + "accountCategory": EnhancedReportAccountCategory.from_dict(obj["accountCategory"]) if obj.get("accountCategory") is not None else None + }) + return _obj + + + + + +class ReportItemTypedDict(TypedDict): + """TypedDict variant of ReportItem, for dict-literal request/response inputs.""" + date_: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] + account_name: NotRequired[Optional[str]] + account_id: NotRequired[Optional[str]] + account_category: NotRequired[Optional[EnhancedReportAccountCategoryTypedDict]] diff --git a/lending/src/codat_lending/models/report_operation_status.py b/lending/src/codat_lending/models/report_operation_status.py new file mode 100644 index 000000000..8db081923 --- /dev/null +++ b/lending/src/codat_lending/models/report_operation_status.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class ReportOperationStatus(str, Enum): + """ReportOperationStatus enum (lifted from inline OAS enum).""" + IN_PROGRESS = 'InProgress' + COMPLETE = 'Complete' + ERROR = 'Error' diff --git a/lending/src/codat_lending/models/report_operation_type.py b/lending/src/codat_lending/models/report_operation_type.py new file mode 100644 index 000000000..81a91d965 --- /dev/null +++ b/lending/src/codat_lending/models/report_operation_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class ReportOperationType(str, Enum): + """ReportOperationType enum (lifted from inline OAS enum).""" + CATEGORIZED_BANK_STATEMENT = 'categorizedBankStatement' + CREDIT_MODEL = 'creditModel' + SPEND_ANALYSIS = 'spendAnalysis' diff --git a/lending/src/codat_lending/models/report_source_reference.py b/lending/src/codat_lending/models/report_source_reference.py new file mode 100644 index 000000000..25606766f --- /dev/null +++ b/lending/src/codat_lending/models/report_source_reference.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ReportSourceReference(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 source reference containing the `sourceType` object \"Banking\". + """ # noqa: E501 + source_type: Optional[str] = Field(default=None, description="The data source type.", alias="sourceType") + __properties: ClassVar[List[str]] = ["sourceType"] + + 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 ReportSourceReference 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 ReportSourceReference from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceType": obj.get("sourceType") + }) + return _obj + + + + + +class ReportSourceReferenceTypedDict(TypedDict): + """TypedDict variant of ReportSourceReference, for dict-literal request/response inputs.""" + source_type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/sales_order_reference.py b/lending/src/codat_lending/models/sales_order_reference.py new file mode 100644 index 000000000..0c7bfa2ec --- /dev/null +++ b/lending/src/codat_lending/models/sales_order_reference.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.accounting_invoice_data_type import AccountingInvoiceDataType +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 SalesOrderReference(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} + """ + SalesOrderReference + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier to a record in `dataType`.") + data_type: Optional[AccountingInvoiceDataType] = Field(default=None, description="The underlying data type associated to the reference `id`.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['salesOrders']): + raise ValueError("must be one of enum values ('salesOrders')") + 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 SalesOrderReference 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 SalesOrderReference 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") + }) + return _obj + + + + + +class SalesOrderReferenceTypedDict(TypedDict): + """TypedDict variant of SalesOrderReference, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[AccountingInvoiceDataType]] diff --git a/lending/src/codat_lending/models/shared/__init__.py b/lending/src/codat_lending/models/shared/__init__.py index 57648b7b3..a3366532c 100644 --- a/lending/src/codat_lending/models/shared/__init__.py +++ b/lending/src/codat_lending/models/shared/__init__.py @@ -1,1962 +1,1451 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.models.shared — domain-shared models.""" -from typing import Any, TYPE_CHECKING - -from codat_lending.utils.dynamic_imports import lazy_getattr, lazy_dir +from importlib import import_module +from typing import TYPE_CHECKING if TYPE_CHECKING: - from .accountbalance import AccountBalance, AccountBalanceTypedDict - from .accountbalanceamounts import ( - AccountBalanceAmounts, - AccountBalanceAmountsTypedDict, - ) - from .accountcategoriesupdatedwebhook import ( - AccountCategoriesUpdatedWebhook, - AccountCategoriesUpdatedWebhookTypedDict, - ) - from .accountcategoriesupdatedwebhookdata import ( - AccountCategoriesUpdatedWebhookData, - AccountCategoriesUpdatedWebhookDataTypedDict, - ) - from .accountcategorylevel import ( - AccountCategoryLevel, - AccountCategoryLevelTypedDict, - ) - from .accountidentifiers import AccountIdentifiers, AccountIdentifiersTypedDict - from .accountidentifiertype import AccountIdentifierType - from .accountinfo import AccountInfo, AccountInfoTypedDict - from .accountingaccount import ( - AccountingAccount, - AccountingAccountTypedDict, - AccountingAccountValidDataTypeLinks, - AccountingAccountValidDataTypeLinksTypedDict, - ) - from .accountingaccounts import AccountingAccounts, AccountingAccountsTypedDict - from .accountingaccounttransaction import ( - AccountingAccountTransaction, - AccountingAccountTransactionStatus, - AccountingAccountTransactionTypedDict, - ) - from .accountingaccounttransactions import ( - AccountingAccountTransactions, - AccountingAccountTransactionsTypedDict, - ) - from .accountingaddress import AccountingAddress, AccountingAddressTypedDict - from .accountingaddresstype import AccountingAddressType - from .accountingagedcreditorreport import ( - AccountingAgedCreditorReport, - AccountingAgedCreditorReportTypedDict, - ) - from .accountingageddebtorreport import ( - AccountingAgedDebtorReport, - AccountingAgedDebtorReportTypedDict, - ) - from .accountingattachment import ( - AccountingAttachment, - AccountingAttachmentTypedDict, - ) - from .accountingbalancesheet import ( - AccountingBalanceSheet, - AccountingBalanceSheetTypedDict, - ) - from .accountingbankaccount import ( - AccountingBankAccount, - AccountingBankAccountTypedDict, - ) - from .accountingbankaccounts import ( - AccountingBankAccounts, - AccountingBankAccountsTypedDict, - ) - from .accountingbankaccounttype import AccountingBankAccountType - from .accountingbanktransaction import ( - AccountingBankTransaction, - AccountingBankTransactionTypedDict, - ) - from .accountingbanktransactions import ( - AccountingBankTransactions, - AccountingBankTransactionsTypedDict, - ) - from .accountingbill import ( - AccountingBill, - AccountingBillTypedDict, - PurchaseOrderReference, - PurchaseOrderReferenceTypedDict, - WithholdingTax, - WithholdingTaxTypedDict, - ) - from .accountingbillcreditnote import ( - AccountingBillCreditNote, - AccountingBillCreditNoteTypedDict, - ) - from .accountingbillcreditnotes import ( - AccountingBillCreditNotes, - AccountingBillCreditNotesTypedDict, - ) - from .accountingbillpayment import ( - AccountingBillPayment, - AccountingBillPaymentTypedDict, - ) - from .accountingbillpayments import ( - AccountingBillPayments, - AccountingBillPaymentsTypedDict, - ) - from .accountingbills import AccountingBills, AccountingBillsTypedDict - from .accountingcashflowstatement import ( - AccountingCashFlowStatement, - AccountingCashFlowStatementTypedDict, - ) - from .accountingcompanyinfo import ( - AccountingCompanyInfo, - AccountingCompanyInfoTypedDict, - ) - from .accountingcreateaccountresponse import ( - AccountingCreateAccountResponse, - AccountingCreateAccountResponseAccountingAccount, - AccountingCreateAccountResponseAccountingAccountTypedDict, - AccountingCreateAccountResponseTypedDict, - AccountingCreateAccountResponseValidDataTypeLinks, - AccountingCreateAccountResponseValidDataTypeLinksTypedDict, - ) - from .accountingcreatebankaccountresponse import ( - AccountingCreateBankAccountResponse, - AccountingCreateBankAccountResponseAccountingBankAccount, - AccountingCreateBankAccountResponseAccountingBankAccountTypedDict, - AccountingCreateBankAccountResponseTypedDict, - ) - from .accountingcreatebanktransactions import ( - AccountingCreateBankTransactions, - AccountingCreateBankTransactionsTypedDict, - ) - from .accountingcreatebanktransactionsresponse import ( - AccountingCreateBankAccountTransactions, - AccountingCreateBankAccountTransactionsTypedDict, - AccountingCreateBankTransactionsResponse, - AccountingCreateBankTransactionsResponseTypedDict, - ) - from .accountingcreatedirectcostresponse import ( - AccountingCreateDirectCostResponse, - AccountingCreateDirectCostResponseAccountingDirectCost, - AccountingCreateDirectCostResponseAccountingDirectCostTypedDict, - AccountingCreateDirectCostResponseTypedDict, - ) - from .accountingcreatepaymentresponse import ( - AccountingCreatePaymentResponse, - AccountingCreatePaymentResponseAccountingPayment, - AccountingCreatePaymentResponseAccountingPaymentTypedDict, - AccountingCreatePaymentResponseTypedDict, - ) - from .accountingcreatesupplierresponse import ( - AccountingCreateSupplierResponse, - AccountingCreateSupplierResponseAccountingSupplier, - AccountingCreateSupplierResponseAccountingSupplierTypedDict, - AccountingCreateSupplierResponseTypedDict, - ) - from .accountingcreatetransferresponse import ( - AccountingCreateTransferResponse, - AccountingCreateTransferResponseAccountingTransfer, - AccountingCreateTransferResponseAccountingTransferTypedDict, - AccountingCreateTransferResponseStatus, - AccountingCreateTransferResponseTypedDict, - ) - from .accountingcreditnote import ( - AccountingCreditNote, - AccountingCreditNoteTypedDict, - ) - from .accountingcreditnotes import ( - AccountingCreditNotes, - AccountingCreditNotesTypedDict, - ) - from .accountingcustomer import AccountingCustomer, AccountingCustomerTypedDict - from .accountingcustomerref import ( - AccountingCustomerRef, - AccountingCustomerRefTypedDict, - ) - from .accountingcustomers import AccountingCustomers, AccountingCustomersTypedDict - from .accountingdirectcost import ( - AccountingDirectCost, - AccountingDirectCostTypedDict, - ) - from .accountingdirectcosts import ( - AccountingDirectCosts, - AccountingDirectCostsTypedDict, - ) - from .accountingdirectincome import ( - AccountingDirectIncome, - AccountingDirectIncomeTypedDict, - ) - from .accountingdirectincomes import ( - AccountingDirectIncomes, - AccountingDirectIncomesTypedDict, - ) - from .accountinginvoice import ( - AccountingInvoice, - AccountingInvoiceDataType, - AccountingInvoiceTypedDict, - SalesOrderReference, - SalesOrderReferenceTypedDict, - ) - from .accountinginvoices import AccountingInvoices, AccountingInvoicesTypedDict - from .accountingjournal import AccountingJournal, AccountingJournalTypedDict - from .accountingjournalentries import ( - AccountingJournalEntries, - AccountingJournalEntriesTypedDict, - ) - from .accountingjournalentry import ( - AccountingJournalEntry, - AccountingJournalEntryTypedDict, - ) - from .accountingjournals import AccountingJournals, AccountingJournalsTypedDict - from .accountingpayment import AccountingPayment, AccountingPaymentTypedDict - from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, - Allocation, - AllocationTypedDict, - ) - from .accountingpayments import AccountingPayments, AccountingPaymentsTypedDict - from .accountingprofitandlossreport import ( - AccountingProfitAndLossReport, - AccountingProfitAndLossReportTypedDict, - ) - from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict - from .accountingsupplier import AccountingSupplier, AccountingSupplierTypedDict - from .accountingsuppliers import AccountingSuppliers, AccountingSuppliersTypedDict - from .accountingtransfer import ( - AccountingTransfer, - AccountingTransferStatus, - AccountingTransferTypedDict, - ) - from .accountingtransfers import AccountingTransfers, AccountingTransfersTypedDict - from .accountinstitution import AccountInstitution, AccountInstitutionTypedDict - from .accountprototype import ( - AccountPrototype, - AccountPrototypeTypedDict, - ValidDataTypeLinks, - ValidDataTypeLinksTypedDict, - ) - from .accountref import AccountRef, AccountRefTypedDict - from .accounts import ( - Accounts, - AccountsTypedDict, - ReportSourceReference, - ReportSourceReferenceTypedDict, - ) - from .accountspayabletracking import ( - AccountsPayableTracking, - AccountsPayableTrackingTypedDict, - ) - from .accountsreceivabletracking import ( - AccountsReceivableTracking, - AccountsReceivableTrackingTypedDict, - ) - from .accountstatus import AccountStatus - from .accounttransactionline import ( - AccountTransactionLine, - AccountTransactionLineTypedDict, - ) - from .accounttransactionlinerecordref import ( - AccountTransactionLineRecordRef, - AccountTransactionLineRecordRefDataType, - AccountTransactionLineRecordRefTypedDict, - ) - from .accounttype import AccountType - from .agedcreditor import AgedCreditor, AgedCreditorTypedDict - from .agedcurrencyoutstanding import ( - AgedCurrencyOutstanding, - AgedCurrencyOutstandingTypedDict, - ) - from .ageddebtor import AgedDebtor, AgedDebtorTypedDict - from .agedoutstandingamount import ( - AgedOutstandingAmount, - AgedOutstandingAmountTypedDict, - ) - from .agedoutstandingamountdetail import ( - AgedOutstandingAmountDetail, - AgedOutstandingAmountDetailTypedDict, - ) - from .attachments import Attachments, AttachmentsTypedDict - from .balancesheet import BalanceSheet, BalanceSheetTypedDict - from .bankaccountref import BankAccountRef, BankAccountRefTypedDict - from .bankaccountstatus import BankAccountStatus - from .bankfeedbankaccountmapping import ( - BankFeedBankAccountMapping, - BankFeedBankAccountMappingTypedDict, - ) - from .bankfeedbankaccountmappingresponse import ( - BankFeedBankAccountMappingResponse, - BankFeedBankAccountMappingResponseTypedDict, - ) - from .bankfeedmapping import BankFeedMapping, BankFeedMappingTypedDict - from .bankingaccount import BankingAccount, BankingAccountTypedDict - from .bankingaccountbalance import ( - BankingAccountBalance, - BankingAccountBalanceTypedDict, - ) - from .bankingaccountbalances import ( - BankingAccountBalances, - BankingAccountBalancesTypedDict, - ) - from .bankingaccounts import BankingAccounts, BankingAccountsTypedDict - from .bankingtransaction import BankingTransaction, BankingTransactionTypedDict - from .bankingtransactioncategories import ( - BankingTransactionCategories, - BankingTransactionCategoriesTypedDict, - ) - from .bankingtransactioncategory import ( - BankingTransactionCategory, - BankingTransactionCategoryTypedDict, - ) - from .bankingtransactionref import ( - BankingTransactionRef, - BankingTransactionRefTypedDict, - ) - from .bankingtransactions import BankingTransactions, BankingTransactionsTypedDict - from .bankstatementuploadconfiguration import ( - BankStatementUploadConfiguration, - BankStatementUploadConfigurationTypedDict, - Source, - ) - from .banktransactiontype import BankTransactionType - from .billcreditnotelineitem import ( - BillCreditNoteLineItem, - BillCreditNoteLineItemTypedDict, - ItemReference, - ItemReferenceTypedDict, - TaxRateReference, - TaxRateReferenceTypedDict, - ) - from .billcreditnotestatus import BillCreditNoteStatus - from .billedtotype import BilledToType - from .billedtotype1 import BilledToType1 - from .billlineitem import ( - BillLineItem, - BillLineItemDataType, - BillLineItemTypedDict, - RecordLineReference, - RecordLineReferenceTypedDict, - ) - from .billpaymentline import BillPaymentLine, BillPaymentLineTypedDict - from .billpaymentlinelink import BillPaymentLineLink, BillPaymentLineLinkTypedDict - from .billpaymentlinelinktype import BillPaymentLineLinkType - from .billstatus import BillStatus - from .cashflowstatement import CashFlowStatement, CashFlowStatementTypedDict - from .clientratelimitwebhook import ( - ClientRateLimitWebhook, - ClientRateLimitWebhookTypedDict, - ) - from .clientratelimitwebhookpayload import ( - ClientRateLimitWebhookPayload, - ClientRateLimitWebhookPayloadTypedDict, - ) - from .codatfile import CodatFile, CodatFileTypedDict - from .commerceaddress import CommerceAddress, CommerceAddressTypedDict - from .commerceaddresstype import CommerceAddressType - from .commercecompanyinfo import CommerceCompanyInfo, CommerceCompanyInfoTypedDict - from .commercecustomer import CommerceCustomer, CommerceCustomerTypedDict - from .commercecustomerref import CommerceCustomerRef, CommerceCustomerRefTypedDict - from .commercecustomers import CommerceCustomers, CommerceCustomersTypedDict - from .commercedispute import CommerceDispute, CommerceDisputeTypedDict - from .commercedisputes import CommerceDisputes, CommerceDisputesTypedDict - from .commercelocation import CommerceLocation, CommerceLocationTypedDict - from .commercelocations import CommerceLocations, CommerceLocationsTypedDict - from .commerceorder import CommerceOrder, CommerceOrderTypedDict - from .commerceorders import CommerceOrders, CommerceOrdersTypedDict - from .commercepayment import CommercePayment, CommercePaymentTypedDict - from .commercepaymentmethod import ( - CommercePaymentMethod, - CommercePaymentMethodStatus, - CommercePaymentMethodTypedDict, - ) - from .commercepaymentmethods import ( - CommercePaymentMethods, - CommercePaymentMethodsTypedDict, - ) - from .commercepayments import CommercePayments, CommercePaymentsTypedDict - from .commerceproduct import CommerceProduct, CommerceProductTypedDict - from .commerceproductcategories import ( - CommerceProductCategories, - CommerceProductCategoriesTypedDict, - ) - from .commerceproductcategory import ( - CommerceProductCategory, - CommerceProductCategoryTypedDict, - ) - from .commerceproducts import CommerceProducts, CommerceProductsTypedDict - from .commercerecordref import CommerceRecordRef, CommerceRecordRefTypedDict - from .commercereport import CommerceReport, CommerceReportTypedDict - from .commercereportcomponent import ( - CommerceReportComponent, - CommerceReportComponentTypedDict, - ) - from .commercereportdimension import ( - CommerceReportDimension, - CommerceReportDimensionItems, - CommerceReportDimensionItemsTypedDict, - CommerceReportDimensionTypedDict, - ) - from .commercereporterror import CommerceReportError, CommerceReportErrorTypedDict - from .commercereportmeasure import ( - CommerceReportMeasure, - CommerceReportMeasureTypedDict, - ) - from .commercetransaction import CommerceTransaction, CommerceTransactionTypedDict - from .commercetransactions import ( - CommerceTransactions, - CommerceTransactionsTypedDict, - ) - from .companies import Companies, CompaniesTypedDict - from .company import Company, CompanyTypedDict - 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 .contact import Contact, ContactTypedDict - from .contactref import ContactRef, ContactRefDataType, ContactRefTypedDict - from .createbankaccounttransaction import ( - CreateBankAccountTransaction, - CreateBankAccountTransactionTypedDict, - ) - from .creditnotelineitem import CreditNoteLineItem, CreditNoteLineItemTypedDict - from .creditnotestatus import CreditNoteStatus - from .customerstatus import CustomerStatus - from .dataconnectionerror import ( - DataConnectionError, - DataConnectionErrorTypedDict, - ErrorStatus, - ) - from .dataconnectionstatus import DataConnectionStatus - from .dataintegrityamounts import ( - DataIntegrityAmounts, - DataIntegrityAmountsTypedDict, - ) - from .dataintegritybyamount import ( - DataIntegrityByAmount, - DataIntegrityByAmountTypedDict, - ) - from .dataintegritybycount import ( - DataIntegrityByCount, - DataIntegrityByCountTypedDict, - ) - from .dataintegrityconnectionid import ( - DataIntegrityConnectionID, - DataIntegrityConnectionIDTypedDict, - ) - from .dataintegritydatatype import DataIntegrityDataType - from .dataintegritydates import DataIntegrityDates, DataIntegrityDatesTypedDict - from .dataintegritydetail import DataIntegrityDetail, DataIntegrityDetailTypedDict - from .dataintegritydetails import ( - DataIntegrityDetails, - DataIntegrityDetailsTypedDict, - ) - from .dataintegritymatch import DataIntegrityMatch, DataIntegrityMatchTypedDict - from .dataintegritystatus import DataIntegrityStatus, DataIntegrityStatusTypedDict - from .dataintegritystatuses import ( - DataIntegrityStatuses, - DataIntegrityStatusesTypedDict, - ) - from .dataintegritystatusinfo import ( - DataIntegrityStatusInfo, - DataIntegrityStatusInfoTypedDict, - ) - from .dataintegritysummaries import ( - DataIntegritySummaries, - DataIntegritySummariesTypedDict, - ) - from .dataintegritysummary import ( - DataIntegritySummary, - DataIntegritySummaryTypedDict, - ) - from .datasource import DataSource, DataSourceTypedDict - from .datastatus import DataStatus, DataStatusTypedDict, DataTypes - from .datatype import DataType - from .directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict - from .directcostprototype import DirectCostPrototype, DirectCostPrototypeTypedDict - from .directincomelineitem import ( - DirectIncomeLineItem, - DirectIncomeLineItemTypedDict, - ) - from .disputestatus import DisputeStatus - from .enduploadsessionrequest import ( - EndUploadSessionRequest, - EndUploadSessionRequestStatus, - EndUploadSessionRequestTypedDict, - ) - from .enhancedcashflowitem import ( - CashFlowTransaction, - CashFlowTransactionTypedDict, - EnhancedCashFlowItem, - EnhancedCashFlowItemTypedDict, - ) - from .enhancedcashflowtransactions import ( - EnhancedCashFlowTransactions, - EnhancedCashFlowTransactionsTypedDict, - ) - from .enhancedfinancialreport import ( - EnhancedFinancialReport, - EnhancedFinancialReportTypedDict, - ReportItem, - ReportItemTypedDict, - ) - from .enhancedinvoicereportitem import ( - EnhancedInvoiceReportItem, - EnhancedInvoiceReportItemTypedDict, - ) - from .enhancedinvoicesreport import ( - EnhancedInvoicesReport, - EnhancedInvoicesReportTypedDict, - ) - from .enhancedreportaccountcategory import ( - EnhancedReportAccountCategory, - EnhancedReportAccountCategoryTypedDict, - ) - from .enhancedreportinfo import EnhancedReportInfo, EnhancedReportInfoTypedDict - from .errorvalidation import ErrorValidation, ErrorValidationTypedDict - from .errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict - from .excelreporttypes import ExcelReportTypes - from .excelstatus import ExcelStatus, ExcelStatusTypedDict - from .file import File, FileTypedDict - from .fileupload import FileUpload, FileUploadTypedDict - from .halref import HalRef, HalRefTypedDict - from .integritystatus import IntegrityStatus - from .invoicelineitem import InvoiceLineItem, InvoiceLineItemTypedDict - from .invoicestatus import InvoiceStatus - from .itemref import ItemRef, ItemRefTypedDict - from .items import Items, ItemsTypedDict - from .journalentryrecordref import ( - JournalEntryRecordRef, - JournalEntryRecordRefDataType, - JournalEntryRecordRefTypedDict, - ) - from .journalline import ( - ContactReference, - ContactReferenceTypedDict, - JournalLine, - JournalLineDataType, - JournalLineTracking, - JournalLineTrackingTypedDict, - JournalLineTypedDict, - ) - from .journalref import JournalRef, JournalRefTypedDict - from .journalstatus import JournalStatus - from .lendingcustomerref import LendingCustomerRef, LendingCustomerRefTypedDict - from .links import Links, LinksTypedDict - from .loanref import LoanRef, LoanRefTypedDict - from .loansummary import LoanSummary, LoanSummaryTypedDict - from .loansummaryintegrationtype import LoanSummaryIntegrationType - from .loansummaryrecordref import ( - LoanSummaryRecordRef, - LoanSummaryRecordRefTypedDict, - ) - from .loansummaryrecordreftype import LoanSummaryRecordRefType - from .loansummaryreportinfo import ( - LoanSummaryReportInfo, - LoanSummaryReportInfoTypedDict, - ) - from .loansummaryreportitem import ( - LoanSummaryReportItem, - LoanSummaryReportItemTypedDict, - ) - from .loantransactions import LoanTransactions, LoanTransactionsTypedDict - from .loantransactionsreportinfo import ( - LoanTransactionsReportInfo, - LoanTransactionsReportInfoTypedDict, - ) - from .locationref import LocationRef, LocationRefTypedDict - from .metadata import Metadata, MetadataTypedDict - from .orderdiscountallocation import ( - OrderDiscountAllocation, - OrderDiscountAllocationTypedDict, - ) - from .orderlineitem import OrderLineItem, OrderLineItemTypedDict - from .path import Path - from .payment import Payment, PaymentTypedDict - from .paymentallocationpayment import ( - PaymentAllocationPayment, - PaymentAllocationPaymentTypedDict, - ) - from .paymentline import PaymentLine, PaymentLineTypedDict - from .paymentlinelink import PaymentLineLink, PaymentLineLinkTypedDict - from .paymentlinktype import PaymentLinkType - from .paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict - from .paymentref import PaymentRef, PaymentRefTypedDict - from .paymentstatus import PaymentStatus - from .paymenttype import PaymentType - from .periodunit import PeriodUnit - from .phonenumber import PhoneNumber, PhoneNumberType, PhoneNumberTypedDict - from .productinventory import ProductInventory, ProductInventoryTypedDict - from .productinventorylocation import ( - ProductInventoryLocation, - ProductInventoryLocationTypedDict, - ) - from .productprice import ProductPrice, ProductPriceTypedDict - from .productref import ProductRef, ProductRefTypedDict - from .productvariant import ProductVariant, ProductVariantTypedDict - from .productvariantref import ProductVariantRef, ProductVariantRefTypedDict - from .productvariantstatus import ProductVariantStatus - from .profitandlossreport import ProfitAndLossReport, ProfitAndLossReportTypedDict - from .projectref import ProjectRef, ProjectRefTypedDict - from .propertie_accounttype import PropertieAccountType - from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict - from .pulloperation import DatasetStatus, PullOperation, PullOperationTypedDict - from .pulloperations import PullOperations, PullOperationsTypedDict - 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 .reportbasis import ReportBasis - from .reportcomponentmeasure import ( - ReportComponentMeasure, - ReportComponentMeasureTypedDict, - ) - from .reportgenerationpayload import ( - ReportGenerationPayload, - ReportGenerationPayloadTypedDict, - ) - from .reportinfo import ReportInfo, ReportInfoTypedDict - from .reportinput import ReportInput - from .reportitems import LoanTransactionType, ReportItems, ReportItemsTypedDict - from .reportline import ReportLine, ReportLineTypedDict - from .reportoperation import ( - ReportOperation, - ReportOperationStatus, - ReportOperationType, - ReportOperationTypedDict, - ) - from .reports import Reports, ReportsTypedDict - from .reporttype import ReportType - from .routinginfo import RoutingInfo, RoutingInfoTypedDict, Type - from .schema import Schema, SchemaTypedDict - from .schema_datatype import SchemaDataType from .security import Security, SecurityTypedDict - from .servicecharge import ServiceCharge, ServiceChargeTypedDict - from .servicechargetype import ServiceChargeType - from .sourceaccount import ( - SourceAccount, - SourceAccountStatus, - SourceAccountTypedDict, - ) - from .sourceaccountprototype import ( - SourceAccountPrototype, - SourceAccountPrototypeTypedDict, - ) - from .sourceaccountv2 import ( - SourceAccountV2, - SourceAccountV2AccountType, - SourceAccountV2Status, - SourceAccountV2TypedDict, - ) - from .sourceaccountv2prototype import ( - SourceAccountV2Prototype, - SourceAccountV2PrototypeTypedDict, - ) - from .sourceref import SourceRef, SourceRefTypedDict - from .startuploadsessionrequest import ( - StartUploadSessionRequest, - StartUploadSessionRequestDataType, - StartUploadSessionRequestTypedDict, - ) - from .status import Status - from .supplementaldata import SupplementalData, SupplementalDataTypedDict - from .supplierref import SupplierRef, SupplierRefTypedDict - from .supplierstatus import SupplierStatus - from .targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict - from .taxcomponentallocation import ( - TaxComponentAllocation, - TaxComponentAllocationTypedDict, - ) - from .taxcomponentref import TaxComponentRef, TaxComponentRefTypedDict - from .taxrateref import TaxRateRef, TaxRateRefTypedDict - from .tracking import Tracking, TrackingTypedDict - from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict - from .trackingrecordref import ( - TrackingRecordRef, - TrackingRecordRefDataType, - TrackingRecordRefTypedDict, - ) - from .transactioncategory import TransactionCategory, TransactionCategoryTypedDict - from .transactioncategoryref import ( - TransactionCategoryRef, - TransactionCategoryRefTypedDict, - ) - from .transactioncategorystatus import TransactionCategoryStatus - from .transactioncode import TransactionCode - from .transactionsourceref import ( - TransactionSourceRef, - TransactionSourceRefTypedDict, - ) - from .transactionsourcetype import TransactionSourceType - from .transactiontype import TransactionType - from .transferaccount import TransferAccount, TransferAccountTypedDict - from .validation import Validation, ValidationTypedDict - from .validationitem import ValidationItem, ValidationItemTypedDict - from .weblink import WebLink, WebLinkType, WebLinkTypedDict - from .zero import Zero, ZeroDataType, ZeroTypedDict - -__all__ = [ - "AccountBalance", - "AccountBalanceAmounts", - "AccountBalanceAmountsTypedDict", - "AccountBalanceTypedDict", - "AccountCategoriesUpdatedWebhook", - "AccountCategoriesUpdatedWebhookData", - "AccountCategoriesUpdatedWebhookDataTypedDict", - "AccountCategoriesUpdatedWebhookTypedDict", - "AccountCategoryLevel", - "AccountCategoryLevelTypedDict", - "AccountIdentifierType", - "AccountIdentifiers", - "AccountIdentifiersTypedDict", - "AccountInfo", - "AccountInfoTypedDict", - "AccountInstitution", - "AccountInstitutionTypedDict", - "AccountPrototype", - "AccountPrototypeTypedDict", - "AccountRef", - "AccountRefTypedDict", - "AccountStatus", - "AccountTransactionLine", - "AccountTransactionLineRecordRef", - "AccountTransactionLineRecordRefDataType", - "AccountTransactionLineRecordRefTypedDict", - "AccountTransactionLineTypedDict", - "AccountType", - "AccountingAccount", - "AccountingAccountTransaction", - "AccountingAccountTransactionStatus", - "AccountingAccountTransactionTypedDict", - "AccountingAccountTransactions", - "AccountingAccountTransactionsTypedDict", - "AccountingAccountTypedDict", - "AccountingAccountValidDataTypeLinks", - "AccountingAccountValidDataTypeLinksTypedDict", - "AccountingAccounts", - "AccountingAccountsTypedDict", - "AccountingAddress", - "AccountingAddressType", - "AccountingAddressTypedDict", - "AccountingAgedCreditorReport", - "AccountingAgedCreditorReportTypedDict", - "AccountingAgedDebtorReport", - "AccountingAgedDebtorReportTypedDict", - "AccountingAttachment", - "AccountingAttachmentTypedDict", - "AccountingBalanceSheet", - "AccountingBalanceSheetTypedDict", - "AccountingBankAccount", - "AccountingBankAccountType", - "AccountingBankAccountTypedDict", - "AccountingBankAccounts", - "AccountingBankAccountsTypedDict", - "AccountingBankTransaction", - "AccountingBankTransactionTypedDict", - "AccountingBankTransactions", - "AccountingBankTransactionsTypedDict", - "AccountingBill", - "AccountingBillCreditNote", - "AccountingBillCreditNoteTypedDict", - "AccountingBillCreditNotes", - "AccountingBillCreditNotesTypedDict", - "AccountingBillPayment", - "AccountingBillPaymentTypedDict", - "AccountingBillPayments", - "AccountingBillPaymentsTypedDict", - "AccountingBillTypedDict", - "AccountingBills", - "AccountingBillsTypedDict", - "AccountingCashFlowStatement", - "AccountingCashFlowStatementTypedDict", - "AccountingCompanyInfo", - "AccountingCompanyInfoTypedDict", - "AccountingCreateAccountResponse", - "AccountingCreateAccountResponseAccountingAccount", - "AccountingCreateAccountResponseAccountingAccountTypedDict", - "AccountingCreateAccountResponseTypedDict", - "AccountingCreateAccountResponseValidDataTypeLinks", - "AccountingCreateAccountResponseValidDataTypeLinksTypedDict", - "AccountingCreateBankAccountResponse", - "AccountingCreateBankAccountResponseAccountingBankAccount", - "AccountingCreateBankAccountResponseAccountingBankAccountTypedDict", - "AccountingCreateBankAccountResponseTypedDict", - "AccountingCreateBankAccountTransactions", - "AccountingCreateBankAccountTransactionsTypedDict", - "AccountingCreateBankTransactions", - "AccountingCreateBankTransactionsResponse", - "AccountingCreateBankTransactionsResponseTypedDict", - "AccountingCreateBankTransactionsTypedDict", - "AccountingCreateDirectCostResponse", - "AccountingCreateDirectCostResponseAccountingDirectCost", - "AccountingCreateDirectCostResponseAccountingDirectCostTypedDict", - "AccountingCreateDirectCostResponseTypedDict", - "AccountingCreatePaymentResponse", - "AccountingCreatePaymentResponseAccountingPayment", - "AccountingCreatePaymentResponseAccountingPaymentTypedDict", - "AccountingCreatePaymentResponseTypedDict", - "AccountingCreateSupplierResponse", - "AccountingCreateSupplierResponseAccountingSupplier", - "AccountingCreateSupplierResponseAccountingSupplierTypedDict", - "AccountingCreateSupplierResponseTypedDict", - "AccountingCreateTransferResponse", - "AccountingCreateTransferResponseAccountingTransfer", - "AccountingCreateTransferResponseAccountingTransferTypedDict", - "AccountingCreateTransferResponseStatus", - "AccountingCreateTransferResponseTypedDict", - "AccountingCreditNote", - "AccountingCreditNoteTypedDict", - "AccountingCreditNotes", - "AccountingCreditNotesTypedDict", - "AccountingCustomer", - "AccountingCustomerRef", - "AccountingCustomerRefTypedDict", - "AccountingCustomerTypedDict", - "AccountingCustomers", - "AccountingCustomersTypedDict", - "AccountingDirectCost", - "AccountingDirectCostTypedDict", - "AccountingDirectCosts", - "AccountingDirectCostsTypedDict", - "AccountingDirectIncome", - "AccountingDirectIncomeTypedDict", - "AccountingDirectIncomes", - "AccountingDirectIncomesTypedDict", - "AccountingInvoice", - "AccountingInvoiceDataType", - "AccountingInvoiceTypedDict", - "AccountingInvoices", - "AccountingInvoicesTypedDict", - "AccountingJournal", - "AccountingJournalEntries", - "AccountingJournalEntriesTypedDict", - "AccountingJournalEntry", - "AccountingJournalEntryTypedDict", - "AccountingJournalTypedDict", - "AccountingJournals", - "AccountingJournalsTypedDict", - "AccountingPayment", - "AccountingPaymentAllocation", - "AccountingPaymentAllocationTypedDict", - "AccountingPaymentTypedDict", - "AccountingPayments", - "AccountingPaymentsTypedDict", - "AccountingProfitAndLossReport", - "AccountingProfitAndLossReportTypedDict", - "AccountingRecordRef", - "AccountingRecordRefTypedDict", - "AccountingSupplier", - "AccountingSupplierTypedDict", - "AccountingSuppliers", - "AccountingSuppliersTypedDict", - "AccountingTransfer", - "AccountingTransferStatus", - "AccountingTransferTypedDict", - "AccountingTransfers", - "AccountingTransfersTypedDict", - "Accounts", - "AccountsPayableTracking", - "AccountsPayableTrackingTypedDict", - "AccountsReceivableTracking", - "AccountsReceivableTrackingTypedDict", - "AccountsTypedDict", - "AgedCreditor", - "AgedCreditorTypedDict", - "AgedCurrencyOutstanding", - "AgedCurrencyOutstandingTypedDict", - "AgedDebtor", - "AgedDebtorTypedDict", - "AgedOutstandingAmount", - "AgedOutstandingAmountDetail", - "AgedOutstandingAmountDetailTypedDict", - "AgedOutstandingAmountTypedDict", - "Allocation", - "AllocationTypedDict", - "Attachments", - "AttachmentsTypedDict", - "BalanceSheet", - "BalanceSheetTypedDict", - "BankAccountRef", - "BankAccountRefTypedDict", - "BankAccountStatus", - "BankFeedBankAccountMapping", - "BankFeedBankAccountMappingResponse", - "BankFeedBankAccountMappingResponseTypedDict", - "BankFeedBankAccountMappingTypedDict", - "BankFeedMapping", - "BankFeedMappingTypedDict", - "BankStatementUploadConfiguration", - "BankStatementUploadConfigurationTypedDict", - "BankTransactionType", - "BankingAccount", - "BankingAccountBalance", - "BankingAccountBalanceTypedDict", - "BankingAccountBalances", - "BankingAccountBalancesTypedDict", - "BankingAccountTypedDict", - "BankingAccounts", - "BankingAccountsTypedDict", - "BankingTransaction", - "BankingTransactionCategories", - "BankingTransactionCategoriesTypedDict", - "BankingTransactionCategory", - "BankingTransactionCategoryTypedDict", - "BankingTransactionRef", - "BankingTransactionRefTypedDict", - "BankingTransactionTypedDict", - "BankingTransactions", - "BankingTransactionsTypedDict", - "BillCreditNoteLineItem", - "BillCreditNoteLineItemTypedDict", - "BillCreditNoteStatus", - "BillLineItem", - "BillLineItemDataType", - "BillLineItemTypedDict", - "BillPaymentLine", - "BillPaymentLineLink", - "BillPaymentLineLinkType", - "BillPaymentLineLinkTypedDict", - "BillPaymentLineTypedDict", - "BillStatus", - "BilledToType", - "BilledToType1", - "CashFlowStatement", - "CashFlowStatementTypedDict", - "CashFlowTransaction", - "CashFlowTransactionTypedDict", - "ClientRateLimitWebhook", - "ClientRateLimitWebhookPayload", - "ClientRateLimitWebhookPayloadTypedDict", - "ClientRateLimitWebhookTypedDict", - "CodatFile", - "CodatFileTypedDict", - "CommerceAddress", - "CommerceAddressType", - "CommerceAddressTypedDict", - "CommerceCompanyInfo", - "CommerceCompanyInfoTypedDict", - "CommerceCustomer", - "CommerceCustomerRef", - "CommerceCustomerRefTypedDict", - "CommerceCustomerTypedDict", - "CommerceCustomers", - "CommerceCustomersTypedDict", - "CommerceDispute", - "CommerceDisputeTypedDict", - "CommerceDisputes", - "CommerceDisputesTypedDict", - "CommerceLocation", - "CommerceLocationTypedDict", - "CommerceLocations", - "CommerceLocationsTypedDict", - "CommerceOrder", - "CommerceOrderTypedDict", - "CommerceOrders", - "CommerceOrdersTypedDict", - "CommercePayment", - "CommercePaymentMethod", - "CommercePaymentMethodStatus", - "CommercePaymentMethodTypedDict", - "CommercePaymentMethods", - "CommercePaymentMethodsTypedDict", - "CommercePaymentTypedDict", - "CommercePayments", - "CommercePaymentsTypedDict", - "CommerceProduct", - "CommerceProductCategories", - "CommerceProductCategoriesTypedDict", - "CommerceProductCategory", - "CommerceProductCategoryTypedDict", - "CommerceProductTypedDict", - "CommerceProducts", - "CommerceProductsTypedDict", - "CommerceRecordRef", - "CommerceRecordRefTypedDict", - "CommerceReport", - "CommerceReportComponent", - "CommerceReportComponentTypedDict", - "CommerceReportDimension", - "CommerceReportDimensionItems", - "CommerceReportDimensionItemsTypedDict", - "CommerceReportDimensionTypedDict", - "CommerceReportError", - "CommerceReportErrorTypedDict", - "CommerceReportMeasure", - "CommerceReportMeasureTypedDict", - "CommerceReportTypedDict", - "CommerceTransaction", - "CommerceTransactionTypedDict", - "CommerceTransactions", - "CommerceTransactionsTypedDict", - "Companies", - "CompaniesTypedDict", - "Company", - "CompanyReference", - "CompanyReferenceLinks", - "CompanyReferenceLinksTypedDict", - "CompanyReferenceTypedDict", - "CompanyRequestBody", - "CompanyRequestBodyTypedDict", - "CompanyTypedDict", - "CompanyUpdateRequest", - "CompanyUpdateRequestTypedDict", - "Connection", - "ConnectionTypedDict", - "Connections", - "ConnectionsTypedDict", - "Contact", - "ContactRef", - "ContactRefDataType", - "ContactRefTypedDict", - "ContactReference", - "ContactReferenceTypedDict", - "ContactTypedDict", - "CreateBankAccountTransaction", - "CreateBankAccountTransactionTypedDict", - "CreditNoteLineItem", - "CreditNoteLineItemTypedDict", - "CreditNoteStatus", - "CustomerStatus", - "DataConnectionError", - "DataConnectionErrorTypedDict", - "DataConnectionStatus", - "DataIntegrityAmounts", - "DataIntegrityAmountsTypedDict", - "DataIntegrityByAmount", - "DataIntegrityByAmountTypedDict", - "DataIntegrityByCount", - "DataIntegrityByCountTypedDict", - "DataIntegrityConnectionID", - "DataIntegrityConnectionIDTypedDict", - "DataIntegrityDataType", - "DataIntegrityDates", - "DataIntegrityDatesTypedDict", - "DataIntegrityDetail", - "DataIntegrityDetailTypedDict", - "DataIntegrityDetails", - "DataIntegrityDetailsTypedDict", - "DataIntegrityMatch", - "DataIntegrityMatchTypedDict", - "DataIntegrityStatus", - "DataIntegrityStatusInfo", - "DataIntegrityStatusInfoTypedDict", - "DataIntegrityStatusTypedDict", - "DataIntegrityStatuses", - "DataIntegrityStatusesTypedDict", - "DataIntegritySummaries", - "DataIntegritySummariesTypedDict", - "DataIntegritySummary", - "DataIntegritySummaryTypedDict", - "DataSource", - "DataSourceTypedDict", - "DataStatus", - "DataStatusTypedDict", - "DataType", - "DataTypes", - "DatasetStatus", - "DirectCostLineItem", - "DirectCostLineItemTypedDict", - "DirectCostPrototype", - "DirectCostPrototypeTypedDict", - "DirectIncomeLineItem", - "DirectIncomeLineItemTypedDict", - "DisputeStatus", - "EndUploadSessionRequest", - "EndUploadSessionRequestStatus", - "EndUploadSessionRequestTypedDict", - "EnhancedCashFlowItem", - "EnhancedCashFlowItemTypedDict", - "EnhancedCashFlowTransactions", - "EnhancedCashFlowTransactionsTypedDict", - "EnhancedFinancialReport", - "EnhancedFinancialReportTypedDict", - "EnhancedInvoiceReportItem", - "EnhancedInvoiceReportItemTypedDict", - "EnhancedInvoicesReport", - "EnhancedInvoicesReportTypedDict", - "EnhancedReportAccountCategory", - "EnhancedReportAccountCategoryTypedDict", - "EnhancedReportInfo", - "EnhancedReportInfoTypedDict", - "ErrorStatus", - "ErrorValidation", - "ErrorValidationItem", - "ErrorValidationItemTypedDict", - "ErrorValidationTypedDict", - "ExcelReportTypes", - "ExcelStatus", - "ExcelStatusTypedDict", - "File", - "FileTypedDict", - "FileUpload", - "FileUploadTypedDict", - "HalRef", - "HalRefTypedDict", - "IntegrityStatus", - "InvoiceLineItem", - "InvoiceLineItemTypedDict", - "InvoiceStatus", - "ItemRef", - "ItemRefTypedDict", - "ItemReference", - "ItemReferenceTypedDict", - "Items", - "ItemsTypedDict", - "JournalEntryRecordRef", - "JournalEntryRecordRefDataType", - "JournalEntryRecordRefTypedDict", - "JournalLine", - "JournalLineDataType", - "JournalLineTracking", - "JournalLineTrackingTypedDict", - "JournalLineTypedDict", - "JournalRef", - "JournalRefTypedDict", - "JournalStatus", - "LendingCustomerRef", - "LendingCustomerRefTypedDict", - "Links", - "LinksTypedDict", - "LoanRef", - "LoanRefTypedDict", - "LoanSummary", - "LoanSummaryIntegrationType", - "LoanSummaryRecordRef", - "LoanSummaryRecordRefType", - "LoanSummaryRecordRefTypedDict", - "LoanSummaryReportInfo", - "LoanSummaryReportInfoTypedDict", - "LoanSummaryReportItem", - "LoanSummaryReportItemTypedDict", - "LoanSummaryTypedDict", - "LoanTransactionType", - "LoanTransactions", - "LoanTransactionsReportInfo", - "LoanTransactionsReportInfoTypedDict", - "LoanTransactionsTypedDict", - "LocationRef", - "LocationRefTypedDict", - "Metadata", - "MetadataTypedDict", - "OrderDiscountAllocation", - "OrderDiscountAllocationTypedDict", - "OrderLineItem", - "OrderLineItemTypedDict", - "Path", - "Payment", - "PaymentAllocationPayment", - "PaymentAllocationPaymentTypedDict", - "PaymentLine", - "PaymentLineLink", - "PaymentLineLinkTypedDict", - "PaymentLineTypedDict", - "PaymentLinkType", - "PaymentMethodRef", - "PaymentMethodRefTypedDict", - "PaymentRef", - "PaymentRefTypedDict", - "PaymentStatus", - "PaymentType", - "PaymentTypedDict", - "PeriodUnit", - "PhoneNumber", - "PhoneNumberType", - "PhoneNumberTypedDict", - "ProductInventory", - "ProductInventoryLocation", - "ProductInventoryLocationTypedDict", - "ProductInventoryTypedDict", - "ProductPrice", - "ProductPriceTypedDict", - "ProductRef", - "ProductRefTypedDict", - "ProductVariant", - "ProductVariantRef", - "ProductVariantRefTypedDict", - "ProductVariantStatus", - "ProductVariantTypedDict", - "ProfitAndLossReport", - "ProfitAndLossReportTypedDict", - "ProjectRef", - "ProjectRefTypedDict", - "PropertieAccountType", - "PropertieItemRef", - "PropertieItemRefTypedDict", - "PullOperation", - "PullOperationTypedDict", - "PullOperations", - "PullOperationsTypedDict", - "PurchaseOrderReference", - "PurchaseOrderReferenceTypedDict", - "PushChangeType", - "PushFieldValidation", - "PushFieldValidationTypedDict", - "PushOperation", - "PushOperationChange", - "PushOperationChangeTypedDict", - "PushOperationRef", - "PushOperationRefTypedDict", - "PushOperationStatus", - "PushOperationTypedDict", - "PushOperations", - "PushOperationsTypedDict", - "PushOption", - "PushOptionChoice", - "PushOptionChoiceTypedDict", - "PushOptionProperty", - "PushOptionPropertyTypedDict", - "PushOptionType", - "PushOptionTypedDict", - "PushValidationInfo", - "PushValidationInfoTypedDict", - "RecordLineReference", - "RecordLineReferenceTypedDict", - "ReportBasis", - "ReportComponentMeasure", - "ReportComponentMeasureTypedDict", - "ReportGenerationPayload", - "ReportGenerationPayloadTypedDict", - "ReportInfo", - "ReportInfoTypedDict", - "ReportInput", - "ReportItem", - "ReportItemTypedDict", - "ReportItems", - "ReportItemsTypedDict", - "ReportLine", - "ReportLineTypedDict", - "ReportOperation", - "ReportOperationStatus", - "ReportOperationType", - "ReportOperationTypedDict", - "ReportSourceReference", - "ReportSourceReferenceTypedDict", - "ReportType", - "Reports", - "ReportsTypedDict", - "RoutingInfo", - "RoutingInfoTypedDict", - "SalesOrderReference", - "SalesOrderReferenceTypedDict", - "Schema", - "SchemaDataType", - "SchemaTypedDict", - "Security", - "SecurityTypedDict", - "ServiceCharge", - "ServiceChargeType", - "ServiceChargeTypedDict", - "Source", - "SourceAccount", - "SourceAccountPrototype", - "SourceAccountPrototypeTypedDict", - "SourceAccountStatus", - "SourceAccountTypedDict", - "SourceAccountV2", - "SourceAccountV2AccountType", - "SourceAccountV2Prototype", - "SourceAccountV2PrototypeTypedDict", - "SourceAccountV2Status", - "SourceAccountV2TypedDict", - "SourceRef", - "SourceRefTypedDict", - "SourceType", - "StartUploadSessionRequest", - "StartUploadSessionRequestDataType", - "StartUploadSessionRequestTypedDict", - "Status", - "SupplementalData", - "SupplementalDataTypedDict", - "SupplierRef", - "SupplierRefTypedDict", - "SupplierStatus", - "TargetAccountOption", - "TargetAccountOptionTypedDict", - "TaxComponentAllocation", - "TaxComponentAllocationTypedDict", - "TaxComponentRef", - "TaxComponentRefTypedDict", - "TaxRateRef", - "TaxRateRefTypedDict", - "TaxRateReference", - "TaxRateReferenceTypedDict", - "Tracking", - "TrackingCategoryRef", - "TrackingCategoryRefTypedDict", - "TrackingRecordRef", - "TrackingRecordRefDataType", - "TrackingRecordRefTypedDict", - "TrackingTypedDict", - "TransactionCategory", - "TransactionCategoryRef", - "TransactionCategoryRefTypedDict", - "TransactionCategoryStatus", - "TransactionCategoryTypedDict", - "TransactionCode", - "TransactionSourceRef", - "TransactionSourceRefTypedDict", - "TransactionSourceType", - "TransactionType", - "TransferAccount", - "TransferAccountTypedDict", - "Type", - "ValidDataTypeLinks", - "ValidDataTypeLinksTypedDict", - "Validation", - "ValidationItem", - "ValidationItemTypedDict", - "ValidationTypedDict", - "WebLink", - "WebLinkType", - "WebLinkTypedDict", - "WithholdingTax", - "WithholdingTaxTypedDict", - "Zero", - "ZeroDataType", - "ZeroTypedDict", -] + from codat_lending.models.account import Account, AccountTypedDict + from codat_lending.models.shared.accountbalance import AccountBalance, AccountBalanceTypedDict + from codat_lending.models.shared.accountbalanceamounts import AccountBalanceAmounts, AccountBalanceAmountsTypedDict + from codat_lending.models.shared.accountcategoriesupdatedwebhook import AccountCategoriesUpdatedWebhook, AccountCategoriesUpdatedWebhookTypedDict + from codat_lending.models.shared.accountcategoriesupdatedwebhookdata import AccountCategoriesUpdatedWebhookData, AccountCategoriesUpdatedWebhookDataTypedDict + from codat_lending.models.shared.accountcategorylevel import AccountCategoryLevel, AccountCategoryLevelTypedDict + from codat_lending.models.shared.accountidentifiertype import AccountIdentifierType + from codat_lending.models.shared.accountidentifiers import AccountIdentifiers, AccountIdentifiersTypedDict + from codat_lending.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict + from codat_lending.models.shared.accountinstitution import AccountInstitution, AccountInstitutionTypedDict + from codat_lending.models.shared.accountprototype import AccountPrototype, AccountPrototypeTypedDict + from codat_lending.models.shared.accountref import AccountRef, AccountRefTypedDict + from codat_lending.models.shared.accountstatus import AccountStatus + from codat_lending.models.shared.accounttransactionline import AccountTransactionLine, AccountTransactionLineTypedDict + from codat_lending.models.account_transaction_line_record_ref import AccountTransactionLineRecordRef, AccountTransactionLineRecordRefTypedDict + from codat_lending.models.shared.accounttype import AccountType + from codat_lending.models.shared.accountingaccount import AccountingAccount, AccountingAccountTypedDict + from codat_lending.models.shared.accountingaccounttransaction import AccountingAccountTransaction, AccountingAccountTransactionTypedDict + from codat_lending.models.accounting_account_transaction_data_type import AccountingAccountTransactionDataType + from codat_lending.models.accounting_account_transaction_status import AccountingAccountTransactionStatus + from codat_lending.models.shared.accountingaccounttransactions import AccountingAccountTransactions, AccountingAccountTransactionsTypedDict + from codat_lending.models.shared.accountingaccounts import AccountingAccounts, AccountingAccountsTypedDict + from codat_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict + from codat_lending.models.shared.accountingaddresstype import AccountingAddressType + from codat_lending.models.shared.accountingagedcreditorreport import AccountingAgedCreditorReport, AccountingAgedCreditorReportTypedDict + from codat_lending.models.shared.accountingageddebtorreport import AccountingAgedDebtorReport, AccountingAgedDebtorReportTypedDict + from codat_lending.models.shared.accountingattachment import AccountingAttachment, AccountingAttachmentTypedDict + from codat_lending.models.shared.accountingbalancesheet import AccountingBalanceSheet, AccountingBalanceSheetTypedDict + from codat_lending.models.shared.accountingbankaccount import AccountingBankAccount, AccountingBankAccountTypedDict + from codat_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType + from codat_lending.models.shared.accountingbankaccounts import AccountingBankAccounts, AccountingBankAccountsTypedDict + from codat_lending.models.shared.accountingbanktransaction import AccountingBankTransaction, AccountingBankTransactionTypedDict + from codat_lending.models.shared.accountingbanktransactions import AccountingBankTransactions, AccountingBankTransactionsTypedDict + from codat_lending.models.shared.accountingbill import AccountingBill, AccountingBillTypedDict + from codat_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNote, AccountingBillCreditNoteTypedDict + from codat_lending.models.shared.accountingbillcreditnotes import AccountingBillCreditNotes, AccountingBillCreditNotesTypedDict + from codat_lending.models.shared.accountingbillpayment import AccountingBillPayment, AccountingBillPaymentTypedDict + from codat_lending.models.accounting_bill_payment_all_of_payment_method_ref import AccountingBillPaymentAllOfPaymentMethodRef, AccountingBillPaymentAllOfPaymentMethodRefTypedDict + from codat_lending.models.accounting_bill_payment_all_of_supplier_ref import AccountingBillPaymentAllOfSupplierRef, AccountingBillPaymentAllOfSupplierRefTypedDict + from codat_lending.models.shared.accountingbillpayments import AccountingBillPayments, AccountingBillPaymentsTypedDict + from codat_lending.models.shared.accountingbills import AccountingBills, AccountingBillsTypedDict + from codat_lending.models.shared.accountingcashflowstatement import AccountingCashFlowStatement, AccountingCashFlowStatementTypedDict + from codat_lending.models.shared.accountingcompanyinfo import AccountingCompanyInfo, AccountingCompanyInfoTypedDict + from codat_lending.models.shared.accountingcreateaccountresponse import AccountingCreateAccountResponse, AccountingCreateAccountResponseTypedDict + from codat_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData, AccountingCreateAccountResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreatebankaccountresponse import AccountingCreateBankAccountResponse, AccountingCreateBankAccountResponseTypedDict + from codat_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData, AccountingCreateBankAccountResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreatebanktransactions import AccountingCreateBankTransactions, AccountingCreateBankTransactionsTypedDict + from codat_lending.models.shared.accountingcreatebanktransactionsresponse import AccountingCreateBankTransactionsResponse, AccountingCreateBankTransactionsResponseTypedDict + from codat_lending.models.accounting_create_bank_transactions_response_all_of_data import AccountingCreateBankTransactionsResponseAllOfData, AccountingCreateBankTransactionsResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreatedirectcostresponse import AccountingCreateDirectCostResponse, AccountingCreateDirectCostResponseTypedDict + from codat_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData, AccountingCreateDirectCostResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreatepaymentresponse import AccountingCreatePaymentResponse, AccountingCreatePaymentResponseTypedDict + from codat_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData, AccountingCreatePaymentResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreatesupplierresponse import AccountingCreateSupplierResponse, AccountingCreateSupplierResponseTypedDict + from codat_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData, AccountingCreateSupplierResponseAllOfDataTypedDict + from codat_lending.models.accounting_create_transfer_response import AccountingCreateTransferResponse, AccountingCreateTransferResponseTypedDict + from codat_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData, AccountingCreateTransferResponseAllOfDataTypedDict + from codat_lending.models.shared.accountingcreditnote import AccountingCreditNote, AccountingCreditNoteTypedDict + from codat_lending.models.shared.accountingcreditnotes import AccountingCreditNotes, AccountingCreditNotesTypedDict + from codat_lending.models.shared.accountingcustomer import AccountingCustomer, AccountingCustomerTypedDict + from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict + from codat_lending.models.shared.accountingcustomers import AccountingCustomers, AccountingCustomersTypedDict + from codat_lending.models.shared.accountingdirectcost import AccountingDirectCost, AccountingDirectCostTypedDict + from codat_lending.models.shared.accountingdirectcosts import AccountingDirectCosts, AccountingDirectCostsTypedDict + from codat_lending.models.shared.accountingdirectincome import AccountingDirectIncome, AccountingDirectIncomeTypedDict + from codat_lending.models.shared.accountingdirectincomes import AccountingDirectIncomes, AccountingDirectIncomesTypedDict + from codat_lending.models.shared.accountinginvoice import AccountingInvoice, AccountingInvoiceTypedDict + from codat_lending.models.accounting_invoice_data_type import AccountingInvoiceDataType + from codat_lending.models.shared.accountinginvoices import AccountingInvoices, AccountingInvoicesTypedDict + from codat_lending.models.shared.accountingjournal import AccountingJournal, AccountingJournalTypedDict + from codat_lending.models.shared.accountingjournalentries import AccountingJournalEntries, AccountingJournalEntriesTypedDict + from codat_lending.models.shared.accountingjournalentry import AccountingJournalEntry, AccountingJournalEntryTypedDict + from codat_lending.models.accounting_journal_entry_data_type import AccountingJournalEntryDataType + from codat_lending.models.shared.accountingjournals import AccountingJournals, AccountingJournalsTypedDict + from codat_lending.models.shared.accountingpayment import AccountingPayment, AccountingPaymentTypedDict + from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict + from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocation, AccountingPaymentAllocationAllocationTypedDict + from codat_lending.models.accounting_payment_method import AccountingPaymentMethod, AccountingPaymentMethodTypedDict + from codat_lending.models.shared.accountingpayments import AccountingPayments, AccountingPaymentsTypedDict + from codat_lending.models.shared.accountingprofitandlossreport import AccountingProfitAndLossReport, AccountingProfitAndLossReportTypedDict + from codat_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict + from codat_lending.models.shared.accountingsupplier import AccountingSupplier, AccountingSupplierTypedDict + from codat_lending.models.shared.accountingsuppliers import AccountingSuppliers, AccountingSuppliersTypedDict + from codat_lending.models.accounting_tracking_category import AccountingTrackingCategory, AccountingTrackingCategoryTypedDict + from codat_lending.models.shared.accountingtransfer import AccountingTransfer, AccountingTransferTypedDict + from codat_lending.models.accounting_transfer_status import AccountingTransferStatus + from codat_lending.models.shared.accountingtransfers import AccountingTransfers, AccountingTransfersTypedDict + from codat_lending.models.shared.accounts import Accounts, AccountsTypedDict + from codat_lending.models.shared.accountspayabletracking import AccountsPayableTracking, AccountsPayableTrackingTypedDict + from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTracking, AccountsReceivableTrackingTypedDict + from codat_lending.models.shared.agedcreditor import AgedCreditor, AgedCreditorTypedDict + from codat_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstanding, AgedCurrencyOutstandingTypedDict + from codat_lending.models.shared.ageddebtor import AgedDebtor, AgedDebtorTypedDict + from codat_lending.models.shared.agedoutstandingamount import AgedOutstandingAmount, AgedOutstandingAmountTypedDict + from codat_lending.models.shared.agedoutstandingamountdetail import AgedOutstandingAmountDetail, AgedOutstandingAmountDetailTypedDict + from codat_lending.models.shared.attachments import Attachments, AttachmentsTypedDict + from codat_lending.models.shared.balancesheet import BalanceSheet, BalanceSheetTypedDict + from codat_lending.models.bank_account_prototype import BankAccountPrototype, BankAccountPrototypeTypedDict + from codat_lending.models.shared.bankaccountref import BankAccountRef, BankAccountRefTypedDict + from codat_lending.models.shared.bankaccountstatus import BankAccountStatus + from codat_lending.models.shared.bankfeedbankaccountmapping import BankFeedBankAccountMapping, BankFeedBankAccountMappingTypedDict + from codat_lending.models.shared.bankfeedbankaccountmappingresponse import BankFeedBankAccountMappingResponse, BankFeedBankAccountMappingResponseTypedDict + from codat_lending.models.shared.bankfeedmapping import BankFeedMapping, BankFeedMappingTypedDict + from codat_lending.models.shared.bankstatementuploadconfiguration import BankStatementUploadConfiguration, BankStatementUploadConfigurationTypedDict + from codat_lending.models.shared.banktransactiontype import BankTransactionType + from codat_lending.models.shared.bankingaccount import BankingAccount, BankingAccountTypedDict + from codat_lending.models.shared.bankingaccountbalance import BankingAccountBalance, BankingAccountBalanceTypedDict + from codat_lending.models.shared.bankingaccountbalances import BankingAccountBalances, BankingAccountBalancesTypedDict + from codat_lending.models.shared.bankingaccounts import BankingAccounts, BankingAccountsTypedDict + from codat_lending.models.shared.bankingtransaction import BankingTransaction, BankingTransactionTypedDict + from codat_lending.models.shared.bankingtransactioncategories import BankingTransactionCategories, BankingTransactionCategoriesTypedDict + from codat_lending.models.shared.bankingtransactioncategory import BankingTransactionCategory, BankingTransactionCategoryTypedDict + from codat_lending.models.shared.bankingtransactionref import BankingTransactionRef, BankingTransactionRefTypedDict + from codat_lending.models.shared.bankingtransactions import BankingTransactions, BankingTransactionsTypedDict + from codat_lending.models.shared.billcreditnotelineitem import BillCreditNoteLineItem, BillCreditNoteLineItemTypedDict + from codat_lending.models.shared.billcreditnotestatus import BillCreditNoteStatus + from codat_lending.models.bill_line_item import BillLineItem, BillLineItemTypedDict + from codat_lending.models.bill_line_item_purchase_order_line_ref import BillLineItemPurchaseOrderLineRef, BillLineItemPurchaseOrderLineRefTypedDict + from codat_lending.models.bill_line_item_purchase_order_line_ref_data_type import BillLineItemPurchaseOrderLineRefDataType + from codat_lending.models.shared.billpaymentline import BillPaymentLine, BillPaymentLineTypedDict + from codat_lending.models.shared.billpaymentlinelink import BillPaymentLineLink, BillPaymentLineLinkTypedDict + from codat_lending.models.shared.billpaymentlinelinktype import BillPaymentLineLinkType + from codat_lending.models.shared.billstatus import BillStatus + from codat_lending.models.shared.billedtotype import BilledToType + from codat_lending.models.shared.billedtotype1 import BilledToType1 + from codat_lending.models.shared.cashflowstatement import CashFlowStatement, CashFlowStatementTypedDict + from codat_lending.models.cash_flow_transaction import CashFlowTransaction, CashFlowTransactionTypedDict + from codat_lending.models.categorized_bank_statement_accounts import CategorizedBankStatementAccounts, CategorizedBankStatementAccountsTypedDict + from codat_lending.models.categorized_bank_statement_transactions import CategorizedBankStatementTransactions, CategorizedBankStatementTransactionsTypedDict + from codat_lending.models.shared.clientratelimitwebhook import ClientRateLimitWebhook, ClientRateLimitWebhookTypedDict + from codat_lending.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayload, ClientRateLimitWebhookPayloadTypedDict + from codat_lending.models.shared.commerceaddress import CommerceAddress, CommerceAddressTypedDict + from codat_lending.models.shared.commerceaddresstype import CommerceAddressType + from codat_lending.models.shared.commercecompanyinfo import CommerceCompanyInfo, CommerceCompanyInfoTypedDict + from codat_lending.models.shared.commercecustomer import CommerceCustomer, CommerceCustomerTypedDict + from codat_lending.models.shared.commercecustomerref import CommerceCustomerRef, CommerceCustomerRefTypedDict + from codat_lending.models.shared.commercecustomers import CommerceCustomers, CommerceCustomersTypedDict + from codat_lending.models.shared.commercedispute import CommerceDispute, CommerceDisputeTypedDict + from codat_lending.models.shared.commercedisputes import CommerceDisputes, CommerceDisputesTypedDict + from codat_lending.models.shared.commercelocation import CommerceLocation, CommerceLocationTypedDict + from codat_lending.models.shared.commercelocations import CommerceLocations, CommerceLocationsTypedDict + from codat_lending.models.shared.commerceorder import CommerceOrder, CommerceOrderTypedDict + from codat_lending.models.shared.commerceorders import CommerceOrders, CommerceOrdersTypedDict + from codat_lending.models.shared.commercepayment import CommercePayment, CommercePaymentTypedDict + from codat_lending.models.shared.commercepaymentmethod import CommercePaymentMethod, CommercePaymentMethodTypedDict + from codat_lending.models.commerce_payment_method_status import CommercePaymentMethodStatus + from codat_lending.models.shared.commercepaymentmethods import CommercePaymentMethods, CommercePaymentMethodsTypedDict + from codat_lending.models.shared.commercepayments import CommercePayments, CommercePaymentsTypedDict + from codat_lending.models.shared.commerceproduct import CommerceProduct, CommerceProductTypedDict + from codat_lending.models.shared.commerceproductcategories import CommerceProductCategories, CommerceProductCategoriesTypedDict + from codat_lending.models.shared.commerceproductcategory import CommerceProductCategory, CommerceProductCategoryTypedDict + from codat_lending.models.shared.commerceproducts import CommerceProducts, CommerceProductsTypedDict + from codat_lending.models.shared.commercerecordref import CommerceRecordRef, CommerceRecordRefTypedDict + from codat_lending.models.shared.commercereport import CommerceReport, CommerceReportTypedDict + from codat_lending.models.shared.commercereportcomponent import CommerceReportComponent, CommerceReportComponentTypedDict + from codat_lending.models.shared.commercereportdimension import CommerceReportDimension, CommerceReportDimensionTypedDict + from codat_lending.models.commerce_report_dimension_items import CommerceReportDimensionItems, CommerceReportDimensionItemsTypedDict + from codat_lending.models.shared.commercereporterror import CommerceReportError, CommerceReportErrorTypedDict + from codat_lending.models.shared.commercereportmeasure import CommerceReportMeasure, CommerceReportMeasureTypedDict + from codat_lending.models.commerce_tax_component import CommerceTaxComponent, CommerceTaxComponentTypedDict + from codat_lending.models.shared.commercetransaction import CommerceTransaction, CommerceTransactionTypedDict + from codat_lending.models.shared.commercetransactions import CommerceTransactions, CommerceTransactionsTypedDict + from codat_lending.models.shared.companies import Companies, CompaniesTypedDict + from codat_lending.models.shared.company import Company, CompanyTypedDict + from codat_lending.models.company_details import CompanyDetails, CompanyDetailsTypedDict + from codat_lending.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict + from codat_lending.models.company_reference_links import CompanyReferenceLinks, CompanyReferenceLinksTypedDict + from codat_lending.models.shared.companyrequestbody import CompanyRequestBody, CompanyRequestBodyTypedDict + from codat_lending.models.shared.companyupdaterequest import CompanyUpdateRequest, CompanyUpdateRequestTypedDict + from codat_lending.models.shared.connection import Connection, ConnectionTypedDict + from codat_lending.models.shared.connections import Connections, ConnectionsTypedDict + from codat_lending.models.shared.contact import Contact, ContactTypedDict + from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict + from codat_lending.models.contact_reference import ContactReference, ContactReferenceTypedDict + from codat_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransaction, CreateBankAccountTransactionTypedDict + from codat_lending.models.create_connection_request import CreateConnectionRequest, CreateConnectionRequestTypedDict + from codat_lending.models.create_source_account200_response import CreateSourceAccount200Response, CreateSourceAccount200ResponseTypedDict + from codat_lending.models.create_source_account_request import CreateSourceAccountRequest, CreateSourceAccountRequestTypedDict + from codat_lending.models.created_date import CreatedDate, CreatedDateTypedDict + from codat_lending.models.shared.creditnotelineitem import CreditNoteLineItem, CreditNoteLineItemTypedDict + from codat_lending.models.shared.creditnotestatus import CreditNoteStatus + from codat_lending.models.current_status import CurrentStatus + from codat_lending.models.shared.customerstatus import CustomerStatus + from codat_lending.models.shared.dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict + from codat_lending.models.shared.dataconnectionstatus import DataConnectionStatus + from codat_lending.models.shared.dataintegrityamounts import DataIntegrityAmounts, DataIntegrityAmountsTypedDict + from codat_lending.models.shared.dataintegritybyamount import DataIntegrityByAmount, DataIntegrityByAmountTypedDict + from codat_lending.models.shared.dataintegritybycount import DataIntegrityByCount, DataIntegrityByCountTypedDict + from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionId, DataIntegrityConnectionIdTypedDict + from codat_lending.models.shared.dataintegritydates import DataIntegrityDates, DataIntegrityDatesTypedDict + from codat_lending.models.shared.dataintegritydetail import DataIntegrityDetail, DataIntegrityDetailTypedDict + from codat_lending.models.shared.dataintegritydetails import DataIntegrityDetails, DataIntegrityDetailsTypedDict + from codat_lending.models.shared.dataintegritymatch import DataIntegrityMatch, DataIntegrityMatchTypedDict + from codat_lending.models.shared.dataintegritystatus import DataIntegrityStatus, DataIntegrityStatusTypedDict + from codat_lending.models.shared.dataintegritystatusinfo import DataIntegrityStatusInfo, DataIntegrityStatusInfoTypedDict + from codat_lending.models.shared.dataintegritystatuses import DataIntegrityStatuses, DataIntegrityStatusesTypedDict + from codat_lending.models.shared.dataintegritysummaries import DataIntegritySummaries, DataIntegritySummariesTypedDict + from codat_lending.models.shared.dataintegritysummary import DataIntegritySummary, DataIntegritySummaryTypedDict + from codat_lending.models.data_integrity_type import DataIntegrityType, DataIntegrityTypeTypedDict + from codat_lending.models.shared.datasource import DataSource, DataSourceTypedDict + from codat_lending.models.shared.datastatus import DataStatus, DataStatusTypedDict + from codat_lending.models.data_statuses import DataStatuses, DataStatusesTypedDict + from codat_lending.models.shared.datatype import DataType + from codat_lending.models.data_types import DataTypes + from codat_lending.models.dataset_status import DatasetStatus + from codat_lending.models.shared.directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict + from codat_lending.models.shared.directcostprototype import DirectCostPrototype, DirectCostPrototypeTypedDict + from codat_lending.models.shared.directincomelineitem import DirectIncomeLineItem, DirectIncomeLineItemTypedDict + from codat_lending.models.shared.disputestatus import DisputeStatus + from codat_lending.models.shared.enduploadsessionrequest import EndUploadSessionRequest, EndUploadSessionRequestTypedDict + from codat_lending.models.end_upload_session_request_status import EndUploadSessionRequestStatus + from codat_lending.models.shared.enhancedcashflowitem import EnhancedCashFlowItem, EnhancedCashFlowItemTypedDict + from codat_lending.models.shared.enhancedcashflowtransactions import EnhancedCashFlowTransactions, EnhancedCashFlowTransactionsTypedDict + from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReport, EnhancedFinancialReportTypedDict + from codat_lending.models.shared.enhancedinvoicereportitem import EnhancedInvoiceReportItem, EnhancedInvoiceReportItemTypedDict + from codat_lending.models.shared.enhancedinvoicesreport import EnhancedInvoicesReport, EnhancedInvoicesReportTypedDict + from codat_lending.models.shared.enhancedreportaccountcategory import EnhancedReportAccountCategory, EnhancedReportAccountCategoryTypedDict + from codat_lending.models.shared.enhancedreportinfo import EnhancedReportInfo, EnhancedReportInfoTypedDict + from codat_lending.models.error_message import ErrorMessage, ErrorMessageTypedDict + from codat_lending.models.error_status import ErrorStatus + from codat_lending.models.shared.errorvalidation import ErrorValidation, ErrorValidationTypedDict + from codat_lending.models.shared.errorvalidationitem import ErrorValidationItem, ErrorValidationItemTypedDict + from codat_lending.models.shared.excelreporttypes import ExcelReportTypes + from codat_lending.models.shared.excelstatus import ExcelStatus, ExcelStatusTypedDict + from codat_lending.models.shared.file import File, FileTypedDict + from codat_lending.models.financial_summary import FinancialSummary, FinancialSummaryTypedDict + from codat_lending.models.financial_summary_accounting_score import FinancialSummaryAccountingScore, FinancialSummaryAccountingScoreTypedDict + from codat_lending.models.financial_summary_books_closed_date import FinancialSummaryBooksClosedDate, FinancialSummaryBooksClosedDateTypedDict + from codat_lending.models.get_report_status_report_id_parameter import GetReportStatusReportIdParameter, GetReportStatusReportIdParameterTypedDict + from codat_lending.models.shared.halref import HalRef, HalRefTypedDict + from codat_lending.models.shared.integritystatus import IntegrityStatus + from codat_lending.models.shared.invoicelineitem import InvoiceLineItem, InvoiceLineItemTypedDict + from codat_lending.models.shared.invoicestatus import InvoiceStatus + from codat_lending.models.shared.itemref import ItemRef, ItemRefTypedDict + from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict + from codat_lending.models.shared.items import Items, ItemsTypedDict + from codat_lending.models.shared.journalentryrecordref import JournalEntryRecordRef, JournalEntryRecordRefTypedDict + from codat_lending.models.journal_entry_record_ref_data_type import JournalEntryRecordRefDataType + from codat_lending.models.journal_line import JournalLine, JournalLineTypedDict + from codat_lending.models.journal_line_tracking import JournalLineTracking, JournalLineTrackingTypedDict + from codat_lending.models.journal_line_tracking_data_type import JournalLineTrackingDataType + from codat_lending.models.journal_prototype import JournalPrototype, JournalPrototypeTypedDict + from codat_lending.models.shared.journalref import JournalRef, JournalRefTypedDict + from codat_lending.models.shared.journalstatus import JournalStatus + from codat_lending.models.shared.lendingcustomerref import LendingCustomerRef, LendingCustomerRefTypedDict + from codat_lending.models.shared.links import Links, LinksTypedDict + from codat_lending.models.shared.loanref import LoanRef, LoanRefTypedDict + from codat_lending.models.shared.loansummary import LoanSummary, LoanSummaryTypedDict + from codat_lending.models.shared.loansummaryintegrationtype import LoanSummaryIntegrationType + from codat_lending.models.shared.loansummaryrecordref import LoanSummaryRecordRef, LoanSummaryRecordRefTypedDict + from codat_lending.models.shared.loansummaryrecordreftype import LoanSummaryRecordRefType + from codat_lending.models.shared.loansummaryreportinfo import LoanSummaryReportInfo, LoanSummaryReportInfoTypedDict + from codat_lending.models.shared.loansummaryreportitem import LoanSummaryReportItem, LoanSummaryReportItemTypedDict + from codat_lending.models.loan_transaction_type import LoanTransactionType + from codat_lending.models.shared.loantransactions import LoanTransactions, LoanTransactionsTypedDict + from codat_lending.models.shared.loantransactionsreportinfo import LoanTransactionsReportInfo, LoanTransactionsReportInfoTypedDict + from codat_lending.models.shared.locationref import LocationRef, LocationRefTypedDict + from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict + from codat_lending.models.model0 import Model0, Model0TypedDict + from codat_lending.models.model3 import Model3, Model3TypedDict + from codat_lending.models.shared.orderdiscountallocation import OrderDiscountAllocation, OrderDiscountAllocationTypedDict + from codat_lending.models.shared.orderlineitem import OrderLineItem, OrderLineItemTypedDict + from codat_lending.models.paging_info import PagingInfo, PagingInfoTypedDict + from codat_lending.models.shared.payment import Payment, PaymentTypedDict + from codat_lending.models.shared.paymentallocationpayment import PaymentAllocationPayment, PaymentAllocationPaymentTypedDict + from codat_lending.models.shared.paymentline import PaymentLine, PaymentLineTypedDict + from codat_lending.models.shared.paymentlinelink import PaymentLineLink, PaymentLineLinkTypedDict + from codat_lending.models.shared.paymentlinktype import PaymentLinkType + from codat_lending.models.shared.paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict + from codat_lending.models.payment_method_type import PaymentMethodType + from codat_lending.models.shared.paymentref import PaymentRef, PaymentRefTypedDict + from codat_lending.models.shared.paymentstatus import PaymentStatus + from codat_lending.models.shared.paymenttype import PaymentType + from codat_lending.models.phone_number import PhoneNumber, PhoneNumberTypedDict + from codat_lending.models.shared.productinventory import ProductInventory, ProductInventoryTypedDict + from codat_lending.models.shared.productinventorylocation import ProductInventoryLocation, ProductInventoryLocationTypedDict + from codat_lending.models.shared.productprice import ProductPrice, ProductPriceTypedDict + from codat_lending.models.shared.productref import ProductRef, ProductRefTypedDict + from codat_lending.models.shared.productvariant import ProductVariant, ProductVariantTypedDict + from codat_lending.models.shared.productvariantref import ProductVariantRef, ProductVariantRefTypedDict + from codat_lending.models.shared.productvariantstatus import ProductVariantStatus + from codat_lending.models.shared.profitandlossreport import ProfitAndLossReport, ProfitAndLossReportTypedDict + from codat_lending.models.shared.projectref import ProjectRef, ProjectRefTypedDict + from codat_lending.models.shared.pulloperation import PullOperation, PullOperationTypedDict + from codat_lending.models.shared.pulloperations import PullOperations, PullOperationsTypedDict + from codat_lending.models.purchase_order_reference import PurchaseOrderReference, PurchaseOrderReferenceTypedDict + from codat_lending.models.shared.pushchangetype import PushChangeType + from codat_lending.models.shared.pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict + from codat_lending.models.shared.pushoperation import PushOperation, PushOperationTypedDict + from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict + from codat_lending.models.shared.pushoperationref import PushOperationRef, PushOperationRefTypedDict + from codat_lending.models.shared.pushoperationstatus import PushOperationStatus + from codat_lending.models.shared.pushoperations import PushOperations, PushOperationsTypedDict + from codat_lending.models.shared.pushoption import PushOption, PushOptionTypedDict + from codat_lending.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict + from codat_lending.models.shared.pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict + from codat_lending.models.shared.pushoptiontype import PushOptionType + from codat_lending.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict + from codat_lending.models.record_line_reference import RecordLineReference, RecordLineReferenceTypedDict + from codat_lending.models.record_line_reference_data_type import RecordLineReferenceDataType + from codat_lending.models.shared.reportbasis import ReportBasis + from codat_lending.models.shared.reportcomponentmeasure import ReportComponentMeasure, ReportComponentMeasureTypedDict + from codat_lending.models.shared.reportinfo import ReportInfo, ReportInfoTypedDict + from codat_lending.models.shared.reportinput import ReportInput + from codat_lending.models.report_item import ReportItem, ReportItemTypedDict + from codat_lending.models.shared.reportitems import ReportItems, ReportItemsTypedDict + from codat_lending.models.shared.reportline import ReportLine, ReportLineTypedDict + from codat_lending.models.shared.reportoperation import ReportOperation, ReportOperationTypedDict + from codat_lending.models.report_operation_status import ReportOperationStatus + from codat_lending.models.report_operation_type import ReportOperationType + from codat_lending.models.report_source_reference import ReportSourceReference, ReportSourceReferenceTypedDict + from codat_lending.models.shared.reports import Reports, ReportsTypedDict + from codat_lending.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict + from codat_lending.models.sales_order_reference import SalesOrderReference, SalesOrderReferenceTypedDict + from codat_lending.models.shared.servicecharge import ServiceCharge, ServiceChargeTypedDict + from codat_lending.models.shared.servicechargetype import ServiceChargeType + from codat_lending.models.source import Source + from codat_lending.models.shared.sourceaccount import SourceAccount, SourceAccountTypedDict + from codat_lending.models.shared.sourceaccountprototype import SourceAccountPrototype, SourceAccountPrototypeTypedDict + from codat_lending.models.source_account_status import SourceAccountStatus + from codat_lending.models.source_account_v2 import SourceAccountV2, SourceAccountV2TypedDict + from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2Prototype, SourceAccountV2PrototypeTypedDict + from codat_lending.models.source_account_v2_status import SourceAccountV2Status + from codat_lending.models.source_account_v2_type import SourceAccountV2Type + from codat_lending.models.shared.sourceref import SourceRef, SourceRefTypedDict + from codat_lending.models.source_type import SourceType + from codat_lending.models.shared.startuploadsessionrequest import StartUploadSessionRequest, StartUploadSessionRequestTypedDict + from codat_lending.models.start_upload_session_request_data_type import StartUploadSessionRequestDataType + from codat_lending.models.shared.status import Status + from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict + from codat_lending.models.shared.supplierref import SupplierRef, SupplierRefTypedDict + from codat_lending.models.shared.supplierstatus import SupplierStatus + from codat_lending.models.shared.targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict + from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocation, TaxComponentAllocationTypedDict + from codat_lending.models.shared.taxcomponentref import TaxComponentRef, TaxComponentRefTypedDict + from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict + from codat_lending.models.tax_rate_reference import TaxRateReference, TaxRateReferenceTypedDict + from codat_lending.models.shared.tracking import Tracking, TrackingTypedDict + from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict + from codat_lending.models.tracking_record_ref import TrackingRecordRef, TrackingRecordRefTypedDict + from codat_lending.models.shared.transactioncategory import TransactionCategory, TransactionCategoryTypedDict + from codat_lending.models.shared.transactioncategoryref import TransactionCategoryRef, TransactionCategoryRefTypedDict + from codat_lending.models.shared.transactioncategorystatus import TransactionCategoryStatus + from codat_lending.models.shared.transactioncode import TransactionCode + from codat_lending.models.shared.transactionsourceref import TransactionSourceRef, TransactionSourceRefTypedDict + from codat_lending.models.shared.transactionsourcetype import TransactionSourceType + from codat_lending.models.shared.transactiontype import TransactionType + from codat_lending.models.shared.transferaccount import TransferAccount, TransferAccountTypedDict + from codat_lending.models.type import Type + from codat_lending.models.update_connection import UpdateConnection, UpdateConnectionTypedDict + from codat_lending.models.upload_bank_statement_data_request import UploadBankStatementDataRequest, UploadBankStatementDataRequestTypedDict + from codat_lending.models.valid_data_type_links import ValidDataTypeLinks, ValidDataTypeLinksTypedDict + from codat_lending.models.shared.validation import Validation, ValidationTypedDict + from codat_lending.models.shared.validationitem import ValidationItem, ValidationItemTypedDict + from codat_lending.models.shared.weblink import WebLink, WebLinkTypedDict + from codat_lending.models.web_link_type import WebLinkType + from codat_lending.models.withholding_tax import WithholdingTax, WithholdingTaxTypedDict + from codat_lending.models.shared.accountingcreatetransferresponse import AccountingCreateTransferResponseStatus + from codat_lending.models.shared.accounttransactionlinerecordref import AccountTransactionLineRecordRefDataType + from codat_lending.models.shared.billlineitem import BillLineItemDataType + from codat_lending.models.shared.contactref import ContactRefDataType + from codat_lending.models.shared.journalline import JournalLineDataType + from codat_lending.models.shared.propertie_accounttype import PropertieAccountType + from codat_lending.models.shared.schema_datatype import SchemaDataType + from codat_lending.models.shared.sourceaccountv2 import SourceAccountV2AccountType + from codat_lending.models.shared.trackingrecordref import TrackingRecordRefDataType + from codat_lending.models.shared.zero import ZeroDataType + from codat_lending.models.shared.accountbalanceamounts import AccountBalanceAmountsTypedDict as AccountBalanceAmountsTypedDict + from codat_lending.models.shared.accountbalance import AccountBalanceTypedDict as AccountBalanceTypedDict + from codat_lending.models.shared.accountcategoriesupdatedwebhookdata import AccountCategoriesUpdatedWebhookDataTypedDict as AccountCategoriesUpdatedWebhookDataTypedDict + from codat_lending.models.shared.accountcategoriesupdatedwebhook import AccountCategoriesUpdatedWebhookTypedDict as AccountCategoriesUpdatedWebhookTypedDict + from codat_lending.models.shared.accountcategorylevel import AccountCategoryLevelTypedDict as AccountCategoryLevelTypedDict + from codat_lending.models.shared.accountidentifiertype import AccountIdentifierType as AccountIdentifierType + from codat_lending.models.shared.accountidentifiers import AccountIdentifiersTypedDict as AccountIdentifiersTypedDict + from codat_lending.models.shared.accountinfo import AccountInfoTypedDict as AccountInfoTypedDict + from codat_lending.models.shared.accountinstitution import AccountInstitutionTypedDict as AccountInstitutionTypedDict + from codat_lending.models.shared.accountprototype import AccountPrototypeTypedDict as AccountPrototypeTypedDict + from codat_lending.models.shared.accountref import AccountRefTypedDict as AccountRefTypedDict + from codat_lending.models.shared.accountstatus import AccountStatus as AccountStatus + from codat_lending.models.shared.accounttransactionlinerecordref import AccountTransactionLineRecordRefDataType as AccountTransactionLineRecordRefDataType + from codat_lending.models.account_transaction_line_record_ref import AccountTransactionLineRecordRefTypedDict as AccountTransactionLineRecordRefTypedDict + from codat_lending.models.shared.accounttransactionline import AccountTransactionLineTypedDict as AccountTransactionLineTypedDict + from codat_lending.models.shared.accounttype import AccountType as AccountType + from codat_lending.models.accounting_account_transaction_status import AccountingAccountTransactionStatus as AccountingAccountTransactionStatus + from codat_lending.models.shared.accountingaccounttransaction import AccountingAccountTransactionTypedDict as AccountingAccountTransactionTypedDict + from codat_lending.models.shared.accountingaccounttransactions import AccountingAccountTransactionsTypedDict as AccountingAccountTransactionsTypedDict + from codat_lending.models.shared.accountingaccount import AccountingAccountTypedDict as AccountingAccountTypedDict + from codat_lending.models.valid_data_type_links import ValidDataTypeLinks as AccountingAccountValidDataTypeLinks + from codat_lending.models.valid_data_type_links import ValidDataTypeLinksTypedDict as AccountingAccountValidDataTypeLinksTypedDict + from codat_lending.models.shared.accountingaccounts import AccountingAccountsTypedDict as AccountingAccountsTypedDict + from codat_lending.models.shared.accountingaddresstype import AccountingAddressType as AccountingAddressType + from codat_lending.models.shared.accountingaddress import AccountingAddressTypedDict as AccountingAddressTypedDict + from codat_lending.models.shared.accountingagedcreditorreport import AccountingAgedCreditorReportTypedDict as AccountingAgedCreditorReportTypedDict + from codat_lending.models.shared.accountingageddebtorreport import AccountingAgedDebtorReportTypedDict as AccountingAgedDebtorReportTypedDict + from codat_lending.models.shared.accountingattachment import AccountingAttachmentTypedDict as AccountingAttachmentTypedDict + from codat_lending.models.shared.accountingbalancesheet import AccountingBalanceSheetTypedDict as AccountingBalanceSheetTypedDict + from codat_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType as AccountingBankAccountType + from codat_lending.models.shared.accountingbankaccount import AccountingBankAccountTypedDict as AccountingBankAccountTypedDict + from codat_lending.models.shared.accountingbankaccounts import AccountingBankAccountsTypedDict as AccountingBankAccountsTypedDict + from codat_lending.models.shared.accountingbanktransaction import AccountingBankTransactionTypedDict as AccountingBankTransactionTypedDict + from codat_lending.models.shared.accountingbanktransactions import AccountingBankTransactionsTypedDict as AccountingBankTransactionsTypedDict + from codat_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNoteTypedDict as AccountingBillCreditNoteTypedDict + from codat_lending.models.shared.accountingbillcreditnotes import AccountingBillCreditNotesTypedDict as AccountingBillCreditNotesTypedDict + from codat_lending.models.shared.accountingbillpayment import AccountingBillPaymentTypedDict as AccountingBillPaymentTypedDict + from codat_lending.models.shared.accountingbillpayments import AccountingBillPaymentsTypedDict as AccountingBillPaymentsTypedDict + from codat_lending.models.shared.accountingbill import AccountingBillTypedDict as AccountingBillTypedDict + from codat_lending.models.shared.accountingbills import AccountingBillsTypedDict as AccountingBillsTypedDict + from codat_lending.models.shared.accountingcashflowstatement import AccountingCashFlowStatementTypedDict as AccountingCashFlowStatementTypedDict + from codat_lending.models.shared.accountingcompanyinfo import AccountingCompanyInfoTypedDict as AccountingCompanyInfoTypedDict + from codat_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData as AccountingCreateAccountResponseAccountingAccount + from codat_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData as AccountingCreateAccountResponseAccountingAccountTypedDict + from codat_lending.models.shared.accountingcreateaccountresponse import AccountingCreateAccountResponseTypedDict as AccountingCreateAccountResponseTypedDict + from codat_lending.models.valid_data_type_links import ValidDataTypeLinks as AccountingCreateAccountResponseValidDataTypeLinks + from codat_lending.models.valid_data_type_links import ValidDataTypeLinksTypedDict as AccountingCreateAccountResponseValidDataTypeLinksTypedDict + from codat_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData as AccountingCreateBankAccountResponseAccountingBankAccount + from codat_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData as AccountingCreateBankAccountResponseAccountingBankAccountTypedDict + from codat_lending.models.shared.accountingcreatebankaccountresponse import AccountingCreateBankAccountResponseTypedDict as AccountingCreateBankAccountResponseTypedDict + from codat_lending.models.shared.accountingcreatebanktransactionsresponse import AccountingCreateBankTransactionsResponseTypedDict as AccountingCreateBankTransactionsResponseTypedDict + from codat_lending.models.shared.accountingcreatebanktransactions import AccountingCreateBankTransactionsTypedDict as AccountingCreateBankTransactionsTypedDict + from codat_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData as AccountingCreateDirectCostResponseAccountingDirectCost + from codat_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData as AccountingCreateDirectCostResponseAccountingDirectCostTypedDict + from codat_lending.models.shared.accountingcreatedirectcostresponse import AccountingCreateDirectCostResponseTypedDict as AccountingCreateDirectCostResponseTypedDict + from codat_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData as AccountingCreatePaymentResponseAccountingPayment + from codat_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData as AccountingCreatePaymentResponseAccountingPaymentTypedDict + from codat_lending.models.shared.accountingcreatepaymentresponse import AccountingCreatePaymentResponseTypedDict as AccountingCreatePaymentResponseTypedDict + from codat_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData as AccountingCreateSupplierResponseAccountingSupplier + from codat_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData as AccountingCreateSupplierResponseAccountingSupplierTypedDict + from codat_lending.models.shared.accountingcreatesupplierresponse import AccountingCreateSupplierResponseTypedDict as AccountingCreateSupplierResponseTypedDict + from codat_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData as AccountingCreateTransferResponseAccountingTransfer + from codat_lending.models.accounting_create_transfer_response_all_of_data import AccountingCreateTransferResponseAllOfData as AccountingCreateTransferResponseAccountingTransferTypedDict + from codat_lending.models.shared.accountingcreatetransferresponse import AccountingCreateTransferResponseStatus as AccountingCreateTransferResponseStatus + from codat_lending.models.accounting_create_transfer_response import AccountingCreateTransferResponseTypedDict as AccountingCreateTransferResponseTypedDict + from codat_lending.models.shared.accountingcreditnote import AccountingCreditNoteTypedDict as AccountingCreditNoteTypedDict + from codat_lending.models.shared.accountingcreditnotes import AccountingCreditNotesTypedDict as AccountingCreditNotesTypedDict + from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRefTypedDict as AccountingCustomerRefTypedDict + from codat_lending.models.shared.accountingcustomer import AccountingCustomerTypedDict as AccountingCustomerTypedDict + from codat_lending.models.shared.accountingcustomers import AccountingCustomersTypedDict as AccountingCustomersTypedDict + from codat_lending.models.shared.accountingdirectcost import AccountingDirectCostTypedDict as AccountingDirectCostTypedDict + from codat_lending.models.shared.accountingdirectcosts import AccountingDirectCostsTypedDict as AccountingDirectCostsTypedDict + from codat_lending.models.shared.accountingdirectincome import AccountingDirectIncomeTypedDict as AccountingDirectIncomeTypedDict + from codat_lending.models.shared.accountingdirectincomes import AccountingDirectIncomesTypedDict as AccountingDirectIncomesTypedDict + from codat_lending.models.accounting_invoice_data_type import AccountingInvoiceDataType as AccountingInvoiceDataType + from codat_lending.models.shared.accountinginvoice import AccountingInvoiceTypedDict as AccountingInvoiceTypedDict + from codat_lending.models.shared.accountinginvoices import AccountingInvoicesTypedDict as AccountingInvoicesTypedDict + from codat_lending.models.shared.accountingjournalentries import AccountingJournalEntriesTypedDict as AccountingJournalEntriesTypedDict + from codat_lending.models.shared.accountingjournalentry import AccountingJournalEntryTypedDict as AccountingJournalEntryTypedDict + from codat_lending.models.shared.accountingjournal import AccountingJournalTypedDict as AccountingJournalTypedDict + from codat_lending.models.shared.accountingjournals import AccountingJournalsTypedDict as AccountingJournalsTypedDict + from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocationTypedDict as AccountingPaymentAllocationTypedDict + from codat_lending.models.shared.accountingpayment import AccountingPaymentTypedDict as AccountingPaymentTypedDict + from codat_lending.models.shared.accountingpayments import AccountingPaymentsTypedDict as AccountingPaymentsTypedDict + from codat_lending.models.shared.accountingprofitandlossreport import AccountingProfitAndLossReportTypedDict as AccountingProfitAndLossReportTypedDict + from codat_lending.models.shared.accountingrecordref import AccountingRecordRefTypedDict as AccountingRecordRefTypedDict + from codat_lending.models.shared.accountingsupplier import AccountingSupplierTypedDict as AccountingSupplierTypedDict + from codat_lending.models.shared.accountingsuppliers import AccountingSuppliersTypedDict as AccountingSuppliersTypedDict + from codat_lending.models.accounting_transfer_status import AccountingTransferStatus as AccountingTransferStatus + from codat_lending.models.shared.accountingtransfer import AccountingTransferTypedDict as AccountingTransferTypedDict + from codat_lending.models.shared.accountingtransfers import AccountingTransfersTypedDict as AccountingTransfersTypedDict + from codat_lending.models.shared.accountspayabletracking import AccountsPayableTrackingTypedDict as AccountsPayableTrackingTypedDict + from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTrackingTypedDict as AccountsReceivableTrackingTypedDict + from codat_lending.models.shared.accounts import AccountsTypedDict as AccountsTypedDict + from codat_lending.models.shared.agedcreditor import AgedCreditorTypedDict as AgedCreditorTypedDict + from codat_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstandingTypedDict as AgedCurrencyOutstandingTypedDict + from codat_lending.models.shared.ageddebtor import AgedDebtorTypedDict as AgedDebtorTypedDict + from codat_lending.models.shared.agedoutstandingamountdetail import AgedOutstandingAmountDetailTypedDict as AgedOutstandingAmountDetailTypedDict + from codat_lending.models.shared.agedoutstandingamount import AgedOutstandingAmountTypedDict as AgedOutstandingAmountTypedDict + from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocation as Allocation + from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocationTypedDict as AllocationTypedDict + from codat_lending.models.shared.attachments import AttachmentsTypedDict as AttachmentsTypedDict + from codat_lending.models.shared.balancesheet import BalanceSheetTypedDict as BalanceSheetTypedDict + from codat_lending.models.shared.bankaccountref import BankAccountRefTypedDict as BankAccountRefTypedDict + from codat_lending.models.shared.bankaccountstatus import BankAccountStatus as BankAccountStatus + from codat_lending.models.shared.bankfeedbankaccountmappingresponse import BankFeedBankAccountMappingResponseTypedDict as BankFeedBankAccountMappingResponseTypedDict + from codat_lending.models.shared.bankfeedbankaccountmapping import BankFeedBankAccountMappingTypedDict as BankFeedBankAccountMappingTypedDict + from codat_lending.models.shared.bankfeedmapping import BankFeedMappingTypedDict as BankFeedMappingTypedDict + from codat_lending.models.shared.bankstatementuploadconfiguration import BankStatementUploadConfigurationTypedDict as BankStatementUploadConfigurationTypedDict + from codat_lending.models.shared.banktransactiontype import BankTransactionType as BankTransactionType + from codat_lending.models.shared.bankingaccountbalance import BankingAccountBalanceTypedDict as BankingAccountBalanceTypedDict + from codat_lending.models.shared.bankingaccountbalances import BankingAccountBalancesTypedDict as BankingAccountBalancesTypedDict + from codat_lending.models.shared.bankingaccount import BankingAccountTypedDict as BankingAccountTypedDict + from codat_lending.models.shared.bankingaccounts import BankingAccountsTypedDict as BankingAccountsTypedDict + from codat_lending.models.shared.bankingtransactioncategories import BankingTransactionCategoriesTypedDict as BankingTransactionCategoriesTypedDict + from codat_lending.models.shared.bankingtransactioncategory import BankingTransactionCategoryTypedDict as BankingTransactionCategoryTypedDict + from codat_lending.models.shared.bankingtransactionref import BankingTransactionRefTypedDict as BankingTransactionRefTypedDict + from codat_lending.models.shared.bankingtransaction import BankingTransactionTypedDict as BankingTransactionTypedDict + from codat_lending.models.shared.bankingtransactions import BankingTransactionsTypedDict as BankingTransactionsTypedDict + from codat_lending.models.shared.billcreditnotelineitem import BillCreditNoteLineItemTypedDict as BillCreditNoteLineItemTypedDict + from codat_lending.models.shared.billcreditnotestatus import BillCreditNoteStatus as BillCreditNoteStatus + from codat_lending.models.shared.billlineitem import BillLineItemDataType as BillLineItemDataType + from codat_lending.models.bill_line_item import BillLineItemTypedDict as BillLineItemTypedDict + from codat_lending.models.shared.billpaymentlinelinktype import BillPaymentLineLinkType as BillPaymentLineLinkType + from codat_lending.models.shared.billpaymentlinelink import BillPaymentLineLinkTypedDict as BillPaymentLineLinkTypedDict + from codat_lending.models.shared.billpaymentline import BillPaymentLineTypedDict as BillPaymentLineTypedDict + from codat_lending.models.shared.billstatus import BillStatus as BillStatus + from codat_lending.models.shared.billedtotype import BilledToType as BilledToType + from codat_lending.models.shared.billedtotype1 import BilledToType1 as BilledToType1 + from codat_lending.models.shared.cashflowstatement import CashFlowStatementTypedDict as CashFlowStatementTypedDict + from codat_lending.models.cash_flow_transaction import CashFlowTransactionTypedDict as CashFlowTransactionTypedDict + from codat_lending.models.shared.clientratelimitwebhookpayload import ClientRateLimitWebhookPayloadTypedDict as ClientRateLimitWebhookPayloadTypedDict + from codat_lending.models.shared.clientratelimitwebhook import ClientRateLimitWebhookTypedDict as ClientRateLimitWebhookTypedDict + from codat_lending.models.shared.commerceaddresstype import CommerceAddressType as CommerceAddressType + from codat_lending.models.shared.commerceaddress import CommerceAddressTypedDict as CommerceAddressTypedDict + from codat_lending.models.shared.commercecompanyinfo import CommerceCompanyInfoTypedDict as CommerceCompanyInfoTypedDict + from codat_lending.models.shared.commercecustomerref import CommerceCustomerRefTypedDict as CommerceCustomerRefTypedDict + from codat_lending.models.shared.commercecustomer import CommerceCustomerTypedDict as CommerceCustomerTypedDict + from codat_lending.models.shared.commercecustomers import CommerceCustomersTypedDict as CommerceCustomersTypedDict + from codat_lending.models.shared.commercedispute import CommerceDisputeTypedDict as CommerceDisputeTypedDict + from codat_lending.models.shared.commercedisputes import CommerceDisputesTypedDict as CommerceDisputesTypedDict + from codat_lending.models.shared.commercelocation import CommerceLocationTypedDict as CommerceLocationTypedDict + from codat_lending.models.shared.commercelocations import CommerceLocationsTypedDict as CommerceLocationsTypedDict + from codat_lending.models.shared.commerceorder import CommerceOrderTypedDict as CommerceOrderTypedDict + from codat_lending.models.shared.commerceorders import CommerceOrdersTypedDict as CommerceOrdersTypedDict + from codat_lending.models.commerce_payment_method_status import CommercePaymentMethodStatus as CommercePaymentMethodStatus + from codat_lending.models.shared.commercepaymentmethod import CommercePaymentMethodTypedDict as CommercePaymentMethodTypedDict + from codat_lending.models.shared.commercepaymentmethods import CommercePaymentMethodsTypedDict as CommercePaymentMethodsTypedDict + from codat_lending.models.shared.commercepayment import CommercePaymentTypedDict as CommercePaymentTypedDict + from codat_lending.models.shared.commercepayments import CommercePaymentsTypedDict as CommercePaymentsTypedDict + from codat_lending.models.shared.commerceproductcategories import CommerceProductCategoriesTypedDict as CommerceProductCategoriesTypedDict + from codat_lending.models.shared.commerceproductcategory import CommerceProductCategoryTypedDict as CommerceProductCategoryTypedDict + from codat_lending.models.shared.commerceproduct import CommerceProductTypedDict as CommerceProductTypedDict + from codat_lending.models.shared.commerceproducts import CommerceProductsTypedDict as CommerceProductsTypedDict + from codat_lending.models.shared.commercerecordref import CommerceRecordRefTypedDict as CommerceRecordRefTypedDict + from codat_lending.models.shared.commercereportcomponent import CommerceReportComponentTypedDict as CommerceReportComponentTypedDict + from codat_lending.models.commerce_report_dimension_items import CommerceReportDimensionItemsTypedDict as CommerceReportDimensionItemsTypedDict + from codat_lending.models.shared.commercereportdimension import CommerceReportDimensionTypedDict as CommerceReportDimensionTypedDict + from codat_lending.models.shared.commercereporterror import CommerceReportErrorTypedDict as CommerceReportErrorTypedDict + from codat_lending.models.shared.commercereportmeasure import CommerceReportMeasureTypedDict as CommerceReportMeasureTypedDict + from codat_lending.models.shared.commercereport import CommerceReportTypedDict as CommerceReportTypedDict + from codat_lending.models.shared.commercetransaction import CommerceTransactionTypedDict as CommerceTransactionTypedDict + from codat_lending.models.shared.commercetransactions import CommerceTransactionsTypedDict as CommerceTransactionsTypedDict + from codat_lending.models.shared.companies import CompaniesTypedDict as CompaniesTypedDict + from codat_lending.models.company_reference_links import CompanyReferenceLinksTypedDict as CompanyReferenceLinksTypedDict + from codat_lending.models.shared.companyreference import CompanyReferenceTypedDict as CompanyReferenceTypedDict + from codat_lending.models.shared.companyrequestbody import CompanyRequestBodyTypedDict as CompanyRequestBodyTypedDict + from codat_lending.models.shared.company import CompanyTypedDict as CompanyTypedDict + from codat_lending.models.shared.companyupdaterequest import CompanyUpdateRequestTypedDict as CompanyUpdateRequestTypedDict + from codat_lending.models.shared.connection import ConnectionTypedDict as ConnectionTypedDict + from codat_lending.models.shared.connections import ConnectionsTypedDict as ConnectionsTypedDict + from codat_lending.models.shared.contactref import ContactRefDataType as ContactRefDataType + from codat_lending.models.contact_ref import ContactRefTypedDict as ContactRefTypedDict + from codat_lending.models.contact_reference import ContactReferenceTypedDict as ContactReferenceTypedDict + from codat_lending.models.shared.contact import ContactTypedDict as ContactTypedDict + from codat_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransactionTypedDict as CreateBankAccountTransactionTypedDict + from codat_lending.models.shared.creditnotelineitem import CreditNoteLineItemTypedDict as CreditNoteLineItemTypedDict + from codat_lending.models.shared.creditnotestatus import CreditNoteStatus as CreditNoteStatus + from codat_lending.models.shared.customerstatus import CustomerStatus as CustomerStatus + from codat_lending.models.shared.dataconnectionerror import DataConnectionErrorTypedDict as DataConnectionErrorTypedDict + from codat_lending.models.shared.dataconnectionstatus import DataConnectionStatus as DataConnectionStatus + from codat_lending.models.shared.dataintegrityamounts import DataIntegrityAmountsTypedDict as DataIntegrityAmountsTypedDict + from codat_lending.models.shared.dataintegritybyamount import DataIntegrityByAmountTypedDict as DataIntegrityByAmountTypedDict + from codat_lending.models.shared.dataintegritybycount import DataIntegrityByCountTypedDict as DataIntegrityByCountTypedDict + from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionId as DataIntegrityConnectionID + from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionIdTypedDict as DataIntegrityConnectionIDTypedDict + from codat_lending.models.shared.dataintegritydatatype import DataIntegrityDataType as DataIntegrityDataType + from codat_lending.models.shared.dataintegritydates import DataIntegrityDatesTypedDict as DataIntegrityDatesTypedDict + from codat_lending.models.shared.dataintegritydetail import DataIntegrityDetailTypedDict as DataIntegrityDetailTypedDict + from codat_lending.models.shared.dataintegritydetails import DataIntegrityDetailsTypedDict as DataIntegrityDetailsTypedDict + from codat_lending.models.shared.dataintegritymatch import DataIntegrityMatchTypedDict as DataIntegrityMatchTypedDict + from codat_lending.models.shared.dataintegritystatusinfo import DataIntegrityStatusInfoTypedDict as DataIntegrityStatusInfoTypedDict + from codat_lending.models.shared.dataintegritystatus import DataIntegrityStatusTypedDict as DataIntegrityStatusTypedDict + from codat_lending.models.shared.dataintegritystatuses import DataIntegrityStatusesTypedDict as DataIntegrityStatusesTypedDict + from codat_lending.models.shared.dataintegritysummaries import DataIntegritySummariesTypedDict as DataIntegritySummariesTypedDict + from codat_lending.models.shared.dataintegritysummary import DataIntegritySummaryTypedDict as DataIntegritySummaryTypedDict + from codat_lending.models.shared.datasource import DataSourceTypedDict as DataSourceTypedDict + from codat_lending.models.shared.datastatus import DataStatusTypedDict as DataStatusTypedDict + from codat_lending.models.shared.datatype import DataType as DataType + from codat_lending.models.data_types import DataTypes as DataTypes + from codat_lending.models.dataset_status import DatasetStatus as DatasetStatus + from codat_lending.models.shared.directcostlineitem import DirectCostLineItemTypedDict as DirectCostLineItemTypedDict + from codat_lending.models.shared.directcostprototype import DirectCostPrototypeTypedDict as DirectCostPrototypeTypedDict + from codat_lending.models.shared.directincomelineitem import DirectIncomeLineItemTypedDict as DirectIncomeLineItemTypedDict + from codat_lending.models.shared.disputestatus import DisputeStatus as DisputeStatus + from codat_lending.models.end_upload_session_request_status import EndUploadSessionRequestStatus as EndUploadSessionRequestStatus + from codat_lending.models.shared.enduploadsessionrequest import EndUploadSessionRequestTypedDict as EndUploadSessionRequestTypedDict + from codat_lending.models.shared.enhancedcashflowitem import EnhancedCashFlowItemTypedDict as EnhancedCashFlowItemTypedDict + from codat_lending.models.shared.enhancedcashflowtransactions import EnhancedCashFlowTransactionsTypedDict as EnhancedCashFlowTransactionsTypedDict + from codat_lending.models.shared.enhancedfinancialreport import EnhancedFinancialReportTypedDict as EnhancedFinancialReportTypedDict + from codat_lending.models.shared.enhancedinvoicereportitem import EnhancedInvoiceReportItemTypedDict as EnhancedInvoiceReportItemTypedDict + from codat_lending.models.shared.enhancedinvoicesreport import EnhancedInvoicesReportTypedDict as EnhancedInvoicesReportTypedDict + from codat_lending.models.shared.enhancedreportaccountcategory import EnhancedReportAccountCategoryTypedDict as EnhancedReportAccountCategoryTypedDict + from codat_lending.models.shared.enhancedreportinfo import EnhancedReportInfoTypedDict as EnhancedReportInfoTypedDict + from codat_lending.models.error_status import ErrorStatus as ErrorStatus + from codat_lending.models.shared.errorvalidationitem import ErrorValidationItemTypedDict as ErrorValidationItemTypedDict + from codat_lending.models.shared.errorvalidation import ErrorValidationTypedDict as ErrorValidationTypedDict + from codat_lending.models.shared.excelreporttypes import ExcelReportTypes as ExcelReportTypes + from codat_lending.models.shared.excelstatus import ExcelStatusTypedDict as ExcelStatusTypedDict + from codat_lending.models.shared.file import FileTypedDict as FileTypedDict + from codat_lending.models.shared.halref import HalRefTypedDict as HalRefTypedDict + from codat_lending.models.shared.integritystatus import IntegrityStatus as IntegrityStatus + from codat_lending.models.shared.invoicelineitem import InvoiceLineItemTypedDict as InvoiceLineItemTypedDict + from codat_lending.models.shared.invoicestatus import InvoiceStatus as InvoiceStatus + from codat_lending.models.shared.itemref import ItemRefTypedDict as ItemRefTypedDict + from codat_lending.models.item_reference import ItemReferenceTypedDict as ItemReferenceTypedDict + from codat_lending.models.shared.items import ItemsTypedDict as ItemsTypedDict + from codat_lending.models.journal_entry_record_ref_data_type import JournalEntryRecordRefDataType as JournalEntryRecordRefDataType + from codat_lending.models.shared.journalentryrecordref import JournalEntryRecordRefTypedDict as JournalEntryRecordRefTypedDict + from codat_lending.models.shared.journalline import JournalLineDataType as JournalLineDataType + from codat_lending.models.journal_line_tracking import JournalLineTrackingTypedDict as JournalLineTrackingTypedDict + from codat_lending.models.journal_line import JournalLineTypedDict as JournalLineTypedDict + from codat_lending.models.shared.journalref import JournalRefTypedDict as JournalRefTypedDict + from codat_lending.models.shared.journalstatus import JournalStatus as JournalStatus + from codat_lending.models.shared.lendingcustomerref import LendingCustomerRefTypedDict as LendingCustomerRefTypedDict + from codat_lending.models.shared.links import LinksTypedDict as LinksTypedDict + from codat_lending.models.shared.loanref import LoanRefTypedDict as LoanRefTypedDict + from codat_lending.models.shared.loansummaryintegrationtype import LoanSummaryIntegrationType as LoanSummaryIntegrationType + from codat_lending.models.shared.loansummaryrecordreftype import LoanSummaryRecordRefType as LoanSummaryRecordRefType + from codat_lending.models.shared.loansummaryrecordref import LoanSummaryRecordRefTypedDict as LoanSummaryRecordRefTypedDict + from codat_lending.models.shared.loansummaryreportinfo import LoanSummaryReportInfoTypedDict as LoanSummaryReportInfoTypedDict + from codat_lending.models.shared.loansummaryreportitem import LoanSummaryReportItemTypedDict as LoanSummaryReportItemTypedDict + from codat_lending.models.shared.loansummary import LoanSummaryTypedDict as LoanSummaryTypedDict + from codat_lending.models.loan_transaction_type import LoanTransactionType as LoanTransactionType + from codat_lending.models.shared.loantransactionsreportinfo import LoanTransactionsReportInfoTypedDict as LoanTransactionsReportInfoTypedDict + from codat_lending.models.shared.loantransactions import LoanTransactionsTypedDict as LoanTransactionsTypedDict + from codat_lending.models.shared.locationref import LocationRefTypedDict as LocationRefTypedDict + from codat_lending.models.shared.metadata import MetadataTypedDict as MetadataTypedDict + from codat_lending.models.shared.orderdiscountallocation import OrderDiscountAllocationTypedDict as OrderDiscountAllocationTypedDict + from codat_lending.models.shared.orderlineitem import OrderLineItemTypedDict as OrderLineItemTypedDict + from codat_lending.models.shared.path import Path as Path + from codat_lending.models.shared.paymentallocationpayment import PaymentAllocationPaymentTypedDict as PaymentAllocationPaymentTypedDict + from codat_lending.models.shared.paymentlinelink import PaymentLineLinkTypedDict as PaymentLineLinkTypedDict + from codat_lending.models.shared.paymentline import PaymentLineTypedDict as PaymentLineTypedDict + from codat_lending.models.shared.paymentlinktype import PaymentLinkType as PaymentLinkType + from codat_lending.models.shared.paymentmethodref import PaymentMethodRefTypedDict as PaymentMethodRefTypedDict + from codat_lending.models.shared.paymentref import PaymentRefTypedDict as PaymentRefTypedDict + from codat_lending.models.shared.paymentstatus import PaymentStatus as PaymentStatus + from codat_lending.models.shared.paymenttype import PaymentType as PaymentType + from codat_lending.models.shared.payment import PaymentTypedDict as PaymentTypedDict + from codat_lending.models.shared.periodunit import PeriodUnit as PeriodUnit + from codat_lending.models.shared.phonenumber import PhoneNumberType as PhoneNumberType + from codat_lending.models.phone_number import PhoneNumberTypedDict as PhoneNumberTypedDict + from codat_lending.models.shared.productinventorylocation import ProductInventoryLocationTypedDict as ProductInventoryLocationTypedDict + from codat_lending.models.shared.productinventory import ProductInventoryTypedDict as ProductInventoryTypedDict + from codat_lending.models.shared.productprice import ProductPriceTypedDict as ProductPriceTypedDict + from codat_lending.models.shared.productref import ProductRefTypedDict as ProductRefTypedDict + from codat_lending.models.shared.productvariantref import ProductVariantRefTypedDict as ProductVariantRefTypedDict + from codat_lending.models.shared.productvariantstatus import ProductVariantStatus as ProductVariantStatus + from codat_lending.models.shared.productvariant import ProductVariantTypedDict as ProductVariantTypedDict + from codat_lending.models.shared.profitandlossreport import ProfitAndLossReportTypedDict as ProfitAndLossReportTypedDict + from codat_lending.models.shared.projectref import ProjectRefTypedDict as ProjectRefTypedDict + from codat_lending.models.shared.propertie_accounttype import PropertieAccountType as PropertieAccountType + from codat_lending.models.item_reference import ItemReference as PropertieItemRef + from codat_lending.models.item_reference import ItemReferenceTypedDict as PropertieItemRefTypedDict + from codat_lending.models.shared.pulloperation import PullOperationTypedDict as PullOperationTypedDict + from codat_lending.models.shared.pulloperations import PullOperationsTypedDict as PullOperationsTypedDict + from codat_lending.models.purchase_order_reference import PurchaseOrderReferenceTypedDict as PurchaseOrderReferenceTypedDict + from codat_lending.models.shared.pushchangetype import PushChangeType as PushChangeType + from codat_lending.models.shared.pushfieldvalidation import PushFieldValidationTypedDict as PushFieldValidationTypedDict + from codat_lending.models.shared.pushoperationchange import PushOperationChangeTypedDict as PushOperationChangeTypedDict + from codat_lending.models.shared.pushoperationref import PushOperationRefTypedDict as PushOperationRefTypedDict + from codat_lending.models.shared.pushoperationstatus import PushOperationStatus as PushOperationStatus + from codat_lending.models.shared.pushoperation import PushOperationTypedDict as PushOperationTypedDict + from codat_lending.models.shared.pushoperations import PushOperationsTypedDict as PushOperationsTypedDict + from codat_lending.models.shared.pushoptionchoice import PushOptionChoiceTypedDict as PushOptionChoiceTypedDict + from codat_lending.models.shared.pushoptionproperty import PushOptionPropertyTypedDict as PushOptionPropertyTypedDict + from codat_lending.models.shared.pushoptiontype import PushOptionType as PushOptionType + from codat_lending.models.shared.pushoption import PushOptionTypedDict as PushOptionTypedDict + from codat_lending.models.shared.pushvalidationinfo import PushValidationInfoTypedDict as PushValidationInfoTypedDict + from codat_lending.models.record_line_reference import RecordLineReferenceTypedDict as RecordLineReferenceTypedDict + from codat_lending.models.shared.reportbasis import ReportBasis as ReportBasis + from codat_lending.models.shared.reportcomponentmeasure import ReportComponentMeasureTypedDict as ReportComponentMeasureTypedDict + from codat_lending.models.shared.reportinfo import ReportInfoTypedDict as ReportInfoTypedDict + from codat_lending.models.shared.reportinput import ReportInput as ReportInput + from codat_lending.models.report_item import ReportItemTypedDict as ReportItemTypedDict + from codat_lending.models.shared.reportitems import ReportItemsTypedDict as ReportItemsTypedDict + from codat_lending.models.shared.reportline import ReportLineTypedDict as ReportLineTypedDict + from codat_lending.models.report_operation_status import ReportOperationStatus as ReportOperationStatus + from codat_lending.models.report_operation_type import ReportOperationType as ReportOperationType + from codat_lending.models.shared.reportoperation import ReportOperationTypedDict as ReportOperationTypedDict + from codat_lending.models.report_source_reference import ReportSourceReferenceTypedDict as ReportSourceReferenceTypedDict + from codat_lending.models.shared.reporttype import ReportType as ReportType + from codat_lending.models.shared.reports import ReportsTypedDict as ReportsTypedDict + from codat_lending.models.shared.routinginfo import RoutingInfoTypedDict as RoutingInfoTypedDict + from codat_lending.models.sales_order_reference import SalesOrderReferenceTypedDict as SalesOrderReferenceTypedDict + from codat_lending.models.shared.schema_datatype import SchemaDataType as SchemaDataType + from codat_lending.models.shared.security import Security as Security + from codat_lending.models.shared.security import SecurityTypedDict as SecurityTypedDict + from codat_lending.models.shared.servicechargetype import ServiceChargeType as ServiceChargeType + from codat_lending.models.shared.servicecharge import ServiceChargeTypedDict as ServiceChargeTypedDict + from codat_lending.models.source import Source as Source + from codat_lending.models.shared.sourceaccountprototype import SourceAccountPrototypeTypedDict as SourceAccountPrototypeTypedDict + from codat_lending.models.source_account_status import SourceAccountStatus as SourceAccountStatus + from codat_lending.models.shared.sourceaccount import SourceAccountTypedDict as SourceAccountTypedDict + from codat_lending.models.shared.sourceaccountv2 import SourceAccountV2AccountType as SourceAccountV2AccountType + from codat_lending.models.shared.sourceaccountv2prototype import SourceAccountV2PrototypeTypedDict as SourceAccountV2PrototypeTypedDict + from codat_lending.models.source_account_v2_status import SourceAccountV2Status as SourceAccountV2Status + from codat_lending.models.source_account_v2 import SourceAccountV2TypedDict as SourceAccountV2TypedDict + from codat_lending.models.shared.sourceref import SourceRefTypedDict as SourceRefTypedDict + from codat_lending.models.start_upload_session_request_data_type import StartUploadSessionRequestDataType as StartUploadSessionRequestDataType + from codat_lending.models.shared.startuploadsessionrequest import StartUploadSessionRequestTypedDict as StartUploadSessionRequestTypedDict + from codat_lending.models.shared.status import Status as Status + from codat_lending.models.shared.supplementaldata import SupplementalDataTypedDict as SupplementalDataTypedDict + from codat_lending.models.shared.supplierref import SupplierRefTypedDict as SupplierRefTypedDict + from codat_lending.models.shared.supplierstatus import SupplierStatus as SupplierStatus + from codat_lending.models.shared.targetaccountoption import TargetAccountOptionTypedDict as TargetAccountOptionTypedDict + from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocationTypedDict as TaxComponentAllocationTypedDict + from codat_lending.models.shared.taxcomponentref import TaxComponentRefTypedDict as TaxComponentRefTypedDict + from codat_lending.models.shared.taxrateref import TaxRateRefTypedDict as TaxRateRefTypedDict + from codat_lending.models.tax_rate_reference import TaxRateReferenceTypedDict as TaxRateReferenceTypedDict + from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRefTypedDict as TrackingCategoryRefTypedDict + from codat_lending.models.shared.trackingrecordref import TrackingRecordRefDataType as TrackingRecordRefDataType + from codat_lending.models.tracking_record_ref import TrackingRecordRefTypedDict as TrackingRecordRefTypedDict + from codat_lending.models.shared.tracking import TrackingTypedDict as TrackingTypedDict + from codat_lending.models.shared.transactioncategoryref import TransactionCategoryRefTypedDict as TransactionCategoryRefTypedDict + from codat_lending.models.shared.transactioncategorystatus import TransactionCategoryStatus as TransactionCategoryStatus + from codat_lending.models.shared.transactioncategory import TransactionCategoryTypedDict as TransactionCategoryTypedDict + from codat_lending.models.shared.transactioncode import TransactionCode as TransactionCode + from codat_lending.models.shared.transactionsourceref import TransactionSourceRefTypedDict as TransactionSourceRefTypedDict + from codat_lending.models.shared.transactionsourcetype import TransactionSourceType as TransactionSourceType + from codat_lending.models.shared.transactiontype import TransactionType as TransactionType + from codat_lending.models.shared.transferaccount import TransferAccountTypedDict as TransferAccountTypedDict + from codat_lending.models.type import Type as Type + from codat_lending.models.valid_data_type_links import ValidDataTypeLinksTypedDict as ValidDataTypeLinksTypedDict + from codat_lending.models.shared.validationitem import ValidationItemTypedDict as ValidationItemTypedDict + from codat_lending.models.shared.validation import ValidationTypedDict as ValidationTypedDict + from codat_lending.models.web_link_type import WebLinkType as WebLinkType + from codat_lending.models.shared.weblink import WebLinkTypedDict as WebLinkTypedDict + from codat_lending.models.withholding_tax import WithholdingTaxTypedDict as WithholdingTaxTypedDict + from codat_lending.models.record_line_reference import RecordLineReference as Zero + from codat_lending.models.shared.zero import ZeroDataType as ZeroDataType + from codat_lending.models.record_line_reference import RecordLineReferenceTypedDict as ZeroTypedDict + from codat_lending.models.shared.reportgenerationpayload import ReportGenerationPayload, ReportGenerationPayloadTypedDict + from codat_lending.models.shared.schema import Schema, SchemaTypedDict + from codat_lending.models.accountingcreatebankaccounttransactions import AccountingCreateBankAccountTransactions, AccountingCreateBankAccountTransactionsTypedDict + from codat_lending.models.shared.fileupload import FileUpload, FileUploadTypedDict + from codat_lending.models.shared.codatfile import CodatFile, CodatFileTypedDict -_dynamic_imports: dict[str, str] = { - "AccountBalance": ".accountbalance", - "AccountBalanceTypedDict": ".accountbalance", - "AccountBalanceAmounts": ".accountbalanceamounts", - "AccountBalanceAmountsTypedDict": ".accountbalanceamounts", - "AccountCategoriesUpdatedWebhook": ".accountcategoriesupdatedwebhook", - "AccountCategoriesUpdatedWebhookTypedDict": ".accountcategoriesupdatedwebhook", - "AccountCategoriesUpdatedWebhookData": ".accountcategoriesupdatedwebhookdata", - "AccountCategoriesUpdatedWebhookDataTypedDict": ".accountcategoriesupdatedwebhookdata", - "AccountCategoryLevel": ".accountcategorylevel", - "AccountCategoryLevelTypedDict": ".accountcategorylevel", - "AccountIdentifiers": ".accountidentifiers", - "AccountIdentifiersTypedDict": ".accountidentifiers", - "AccountIdentifierType": ".accountidentifiertype", - "AccountInfo": ".accountinfo", - "AccountInfoTypedDict": ".accountinfo", - "AccountingAccount": ".accountingaccount", - "AccountingAccountTypedDict": ".accountingaccount", - "AccountingAccountValidDataTypeLinks": ".accountingaccount", - "AccountingAccountValidDataTypeLinksTypedDict": ".accountingaccount", - "AccountingAccounts": ".accountingaccounts", - "AccountingAccountsTypedDict": ".accountingaccounts", - "AccountingAccountTransaction": ".accountingaccounttransaction", - "AccountingAccountTransactionStatus": ".accountingaccounttransaction", - "AccountingAccountTransactionTypedDict": ".accountingaccounttransaction", - "AccountingAccountTransactions": ".accountingaccounttransactions", - "AccountingAccountTransactionsTypedDict": ".accountingaccounttransactions", - "AccountingAddress": ".accountingaddress", - "AccountingAddressTypedDict": ".accountingaddress", - "AccountingAddressType": ".accountingaddresstype", - "AccountingAgedCreditorReport": ".accountingagedcreditorreport", - "AccountingAgedCreditorReportTypedDict": ".accountingagedcreditorreport", - "AccountingAgedDebtorReport": ".accountingageddebtorreport", - "AccountingAgedDebtorReportTypedDict": ".accountingageddebtorreport", - "AccountingAttachment": ".accountingattachment", - "AccountingAttachmentTypedDict": ".accountingattachment", - "AccountingBalanceSheet": ".accountingbalancesheet", - "AccountingBalanceSheetTypedDict": ".accountingbalancesheet", - "AccountingBankAccount": ".accountingbankaccount", - "AccountingBankAccountTypedDict": ".accountingbankaccount", - "AccountingBankAccounts": ".accountingbankaccounts", - "AccountingBankAccountsTypedDict": ".accountingbankaccounts", - "AccountingBankAccountType": ".accountingbankaccounttype", - "AccountingBankTransaction": ".accountingbanktransaction", - "AccountingBankTransactionTypedDict": ".accountingbanktransaction", - "AccountingBankTransactions": ".accountingbanktransactions", - "AccountingBankTransactionsTypedDict": ".accountingbanktransactions", - "AccountingBill": ".accountingbill", - "AccountingBillTypedDict": ".accountingbill", - "PurchaseOrderReference": ".accountingbill", - "PurchaseOrderReferenceTypedDict": ".accountingbill", - "WithholdingTax": ".accountingbill", - "WithholdingTaxTypedDict": ".accountingbill", - "AccountingBillCreditNote": ".accountingbillcreditnote", - "AccountingBillCreditNoteTypedDict": ".accountingbillcreditnote", - "AccountingBillCreditNotes": ".accountingbillcreditnotes", - "AccountingBillCreditNotesTypedDict": ".accountingbillcreditnotes", - "AccountingBillPayment": ".accountingbillpayment", - "AccountingBillPaymentTypedDict": ".accountingbillpayment", - "AccountingBillPayments": ".accountingbillpayments", - "AccountingBillPaymentsTypedDict": ".accountingbillpayments", - "AccountingBills": ".accountingbills", - "AccountingBillsTypedDict": ".accountingbills", - "AccountingCashFlowStatement": ".accountingcashflowstatement", - "AccountingCashFlowStatementTypedDict": ".accountingcashflowstatement", - "AccountingCompanyInfo": ".accountingcompanyinfo", - "AccountingCompanyInfoTypedDict": ".accountingcompanyinfo", - "AccountingCreateAccountResponse": ".accountingcreateaccountresponse", - "AccountingCreateAccountResponseAccountingAccount": ".accountingcreateaccountresponse", - "AccountingCreateAccountResponseAccountingAccountTypedDict": ".accountingcreateaccountresponse", - "AccountingCreateAccountResponseTypedDict": ".accountingcreateaccountresponse", - "AccountingCreateAccountResponseValidDataTypeLinks": ".accountingcreateaccountresponse", - "AccountingCreateAccountResponseValidDataTypeLinksTypedDict": ".accountingcreateaccountresponse", - "AccountingCreateBankAccountResponse": ".accountingcreatebankaccountresponse", - "AccountingCreateBankAccountResponseAccountingBankAccount": ".accountingcreatebankaccountresponse", - "AccountingCreateBankAccountResponseAccountingBankAccountTypedDict": ".accountingcreatebankaccountresponse", - "AccountingCreateBankAccountResponseTypedDict": ".accountingcreatebankaccountresponse", - "AccountingCreateBankTransactions": ".accountingcreatebanktransactions", - "AccountingCreateBankTransactionsTypedDict": ".accountingcreatebanktransactions", - "AccountingCreateBankAccountTransactions": ".accountingcreatebanktransactionsresponse", - "AccountingCreateBankAccountTransactionsTypedDict": ".accountingcreatebanktransactionsresponse", - "AccountingCreateBankTransactionsResponse": ".accountingcreatebanktransactionsresponse", - "AccountingCreateBankTransactionsResponseTypedDict": ".accountingcreatebanktransactionsresponse", - "AccountingCreateDirectCostResponse": ".accountingcreatedirectcostresponse", - "AccountingCreateDirectCostResponseAccountingDirectCost": ".accountingcreatedirectcostresponse", - "AccountingCreateDirectCostResponseAccountingDirectCostTypedDict": ".accountingcreatedirectcostresponse", - "AccountingCreateDirectCostResponseTypedDict": ".accountingcreatedirectcostresponse", - "AccountingCreatePaymentResponse": ".accountingcreatepaymentresponse", - "AccountingCreatePaymentResponseAccountingPayment": ".accountingcreatepaymentresponse", - "AccountingCreatePaymentResponseAccountingPaymentTypedDict": ".accountingcreatepaymentresponse", - "AccountingCreatePaymentResponseTypedDict": ".accountingcreatepaymentresponse", - "AccountingCreateSupplierResponse": ".accountingcreatesupplierresponse", - "AccountingCreateSupplierResponseAccountingSupplier": ".accountingcreatesupplierresponse", - "AccountingCreateSupplierResponseAccountingSupplierTypedDict": ".accountingcreatesupplierresponse", - "AccountingCreateSupplierResponseTypedDict": ".accountingcreatesupplierresponse", - "AccountingCreateTransferResponse": ".accountingcreatetransferresponse", - "AccountingCreateTransferResponseAccountingTransfer": ".accountingcreatetransferresponse", - "AccountingCreateTransferResponseAccountingTransferTypedDict": ".accountingcreatetransferresponse", - "AccountingCreateTransferResponseStatus": ".accountingcreatetransferresponse", - "AccountingCreateTransferResponseTypedDict": ".accountingcreatetransferresponse", - "AccountingCreditNote": ".accountingcreditnote", - "AccountingCreditNoteTypedDict": ".accountingcreditnote", - "AccountingCreditNotes": ".accountingcreditnotes", - "AccountingCreditNotesTypedDict": ".accountingcreditnotes", - "AccountingCustomer": ".accountingcustomer", - "AccountingCustomerTypedDict": ".accountingcustomer", - "AccountingCustomerRef": ".accountingcustomerref", - "AccountingCustomerRefTypedDict": ".accountingcustomerref", - "AccountingCustomers": ".accountingcustomers", - "AccountingCustomersTypedDict": ".accountingcustomers", - "AccountingDirectCost": ".accountingdirectcost", - "AccountingDirectCostTypedDict": ".accountingdirectcost", - "AccountingDirectCosts": ".accountingdirectcosts", - "AccountingDirectCostsTypedDict": ".accountingdirectcosts", - "AccountingDirectIncome": ".accountingdirectincome", - "AccountingDirectIncomeTypedDict": ".accountingdirectincome", - "AccountingDirectIncomes": ".accountingdirectincomes", - "AccountingDirectIncomesTypedDict": ".accountingdirectincomes", - "AccountingInvoice": ".accountinginvoice", - "AccountingInvoiceDataType": ".accountinginvoice", - "AccountingInvoiceTypedDict": ".accountinginvoice", - "SalesOrderReference": ".accountinginvoice", - "SalesOrderReferenceTypedDict": ".accountinginvoice", - "AccountingInvoices": ".accountinginvoices", - "AccountingInvoicesTypedDict": ".accountinginvoices", - "AccountingJournal": ".accountingjournal", - "AccountingJournalTypedDict": ".accountingjournal", - "AccountingJournalEntries": ".accountingjournalentries", - "AccountingJournalEntriesTypedDict": ".accountingjournalentries", - "AccountingJournalEntry": ".accountingjournalentry", - "AccountingJournalEntryTypedDict": ".accountingjournalentry", - "AccountingJournals": ".accountingjournals", - "AccountingJournalsTypedDict": ".accountingjournals", - "AccountingPayment": ".accountingpayment", - "AccountingPaymentTypedDict": ".accountingpayment", - "AccountingPaymentAllocation": ".accountingpaymentallocation", - "AccountingPaymentAllocationTypedDict": ".accountingpaymentallocation", - "Allocation": ".accountingpaymentallocation", - "AllocationTypedDict": ".accountingpaymentallocation", - "AccountingPayments": ".accountingpayments", - "AccountingPaymentsTypedDict": ".accountingpayments", - "AccountingProfitAndLossReport": ".accountingprofitandlossreport", - "AccountingProfitAndLossReportTypedDict": ".accountingprofitandlossreport", - "AccountingRecordRef": ".accountingrecordref", - "AccountingRecordRefTypedDict": ".accountingrecordref", - "AccountingSupplier": ".accountingsupplier", - "AccountingSupplierTypedDict": ".accountingsupplier", - "AccountingSuppliers": ".accountingsuppliers", - "AccountingSuppliersTypedDict": ".accountingsuppliers", - "AccountingTransfer": ".accountingtransfer", - "AccountingTransferStatus": ".accountingtransfer", - "AccountingTransferTypedDict": ".accountingtransfer", - "AccountingTransfers": ".accountingtransfers", - "AccountingTransfersTypedDict": ".accountingtransfers", - "AccountInstitution": ".accountinstitution", - "AccountInstitutionTypedDict": ".accountinstitution", - "AccountPrototype": ".accountprototype", - "AccountPrototypeTypedDict": ".accountprototype", - "ValidDataTypeLinks": ".accountprototype", - "ValidDataTypeLinksTypedDict": ".accountprototype", - "AccountRef": ".accountref", - "AccountRefTypedDict": ".accountref", - "Accounts": ".accounts", - "AccountsTypedDict": ".accounts", - "ReportSourceReference": ".accounts", - "ReportSourceReferenceTypedDict": ".accounts", - "AccountsPayableTracking": ".accountspayabletracking", - "AccountsPayableTrackingTypedDict": ".accountspayabletracking", - "AccountsReceivableTracking": ".accountsreceivabletracking", - "AccountsReceivableTrackingTypedDict": ".accountsreceivabletracking", - "AccountStatus": ".accountstatus", - "AccountTransactionLine": ".accounttransactionline", - "AccountTransactionLineTypedDict": ".accounttransactionline", - "AccountTransactionLineRecordRef": ".accounttransactionlinerecordref", - "AccountTransactionLineRecordRefDataType": ".accounttransactionlinerecordref", - "AccountTransactionLineRecordRefTypedDict": ".accounttransactionlinerecordref", - "AccountType": ".accounttype", - "AgedCreditor": ".agedcreditor", - "AgedCreditorTypedDict": ".agedcreditor", - "AgedCurrencyOutstanding": ".agedcurrencyoutstanding", - "AgedCurrencyOutstandingTypedDict": ".agedcurrencyoutstanding", - "AgedDebtor": ".ageddebtor", - "AgedDebtorTypedDict": ".ageddebtor", - "AgedOutstandingAmount": ".agedoutstandingamount", - "AgedOutstandingAmountTypedDict": ".agedoutstandingamount", - "AgedOutstandingAmountDetail": ".agedoutstandingamountdetail", - "AgedOutstandingAmountDetailTypedDict": ".agedoutstandingamountdetail", - "Attachments": ".attachments", - "AttachmentsTypedDict": ".attachments", - "BalanceSheet": ".balancesheet", - "BalanceSheetTypedDict": ".balancesheet", - "BankAccountRef": ".bankaccountref", - "BankAccountRefTypedDict": ".bankaccountref", - "BankAccountStatus": ".bankaccountstatus", - "BankFeedBankAccountMapping": ".bankfeedbankaccountmapping", - "BankFeedBankAccountMappingTypedDict": ".bankfeedbankaccountmapping", - "BankFeedBankAccountMappingResponse": ".bankfeedbankaccountmappingresponse", - "BankFeedBankAccountMappingResponseTypedDict": ".bankfeedbankaccountmappingresponse", - "BankFeedMapping": ".bankfeedmapping", - "BankFeedMappingTypedDict": ".bankfeedmapping", - "BankingAccount": ".bankingaccount", - "BankingAccountTypedDict": ".bankingaccount", - "BankingAccountBalance": ".bankingaccountbalance", - "BankingAccountBalanceTypedDict": ".bankingaccountbalance", - "BankingAccountBalances": ".bankingaccountbalances", - "BankingAccountBalancesTypedDict": ".bankingaccountbalances", - "BankingAccounts": ".bankingaccounts", - "BankingAccountsTypedDict": ".bankingaccounts", - "BankingTransaction": ".bankingtransaction", - "BankingTransactionTypedDict": ".bankingtransaction", - "BankingTransactionCategories": ".bankingtransactioncategories", - "BankingTransactionCategoriesTypedDict": ".bankingtransactioncategories", - "BankingTransactionCategory": ".bankingtransactioncategory", - "BankingTransactionCategoryTypedDict": ".bankingtransactioncategory", - "BankingTransactionRef": ".bankingtransactionref", - "BankingTransactionRefTypedDict": ".bankingtransactionref", - "BankingTransactions": ".bankingtransactions", - "BankingTransactionsTypedDict": ".bankingtransactions", - "BankStatementUploadConfiguration": ".bankstatementuploadconfiguration", - "BankStatementUploadConfigurationTypedDict": ".bankstatementuploadconfiguration", - "Source": ".bankstatementuploadconfiguration", - "BankTransactionType": ".banktransactiontype", - "BillCreditNoteLineItem": ".billcreditnotelineitem", - "BillCreditNoteLineItemTypedDict": ".billcreditnotelineitem", - "ItemReference": ".billcreditnotelineitem", - "ItemReferenceTypedDict": ".billcreditnotelineitem", - "TaxRateReference": ".billcreditnotelineitem", - "TaxRateReferenceTypedDict": ".billcreditnotelineitem", - "BillCreditNoteStatus": ".billcreditnotestatus", - "BilledToType": ".billedtotype", - "BilledToType1": ".billedtotype1", - "BillLineItem": ".billlineitem", - "BillLineItemDataType": ".billlineitem", - "BillLineItemTypedDict": ".billlineitem", - "RecordLineReference": ".billlineitem", - "RecordLineReferenceTypedDict": ".billlineitem", - "BillPaymentLine": ".billpaymentline", - "BillPaymentLineTypedDict": ".billpaymentline", - "BillPaymentLineLink": ".billpaymentlinelink", - "BillPaymentLineLinkTypedDict": ".billpaymentlinelink", - "BillPaymentLineLinkType": ".billpaymentlinelinktype", - "BillStatus": ".billstatus", - "CashFlowStatement": ".cashflowstatement", - "CashFlowStatementTypedDict": ".cashflowstatement", - "ClientRateLimitWebhook": ".clientratelimitwebhook", - "ClientRateLimitWebhookTypedDict": ".clientratelimitwebhook", - "ClientRateLimitWebhookPayload": ".clientratelimitwebhookpayload", - "ClientRateLimitWebhookPayloadTypedDict": ".clientratelimitwebhookpayload", - "CodatFile": ".codatfile", - "CodatFileTypedDict": ".codatfile", - "CommerceAddress": ".commerceaddress", - "CommerceAddressTypedDict": ".commerceaddress", - "CommerceAddressType": ".commerceaddresstype", - "CommerceCompanyInfo": ".commercecompanyinfo", - "CommerceCompanyInfoTypedDict": ".commercecompanyinfo", - "CommerceCustomer": ".commercecustomer", - "CommerceCustomerTypedDict": ".commercecustomer", - "CommerceCustomerRef": ".commercecustomerref", - "CommerceCustomerRefTypedDict": ".commercecustomerref", - "CommerceCustomers": ".commercecustomers", - "CommerceCustomersTypedDict": ".commercecustomers", - "CommerceDispute": ".commercedispute", - "CommerceDisputeTypedDict": ".commercedispute", - "CommerceDisputes": ".commercedisputes", - "CommerceDisputesTypedDict": ".commercedisputes", - "CommerceLocation": ".commercelocation", - "CommerceLocationTypedDict": ".commercelocation", - "CommerceLocations": ".commercelocations", - "CommerceLocationsTypedDict": ".commercelocations", - "CommerceOrder": ".commerceorder", - "CommerceOrderTypedDict": ".commerceorder", - "CommerceOrders": ".commerceorders", - "CommerceOrdersTypedDict": ".commerceorders", - "CommercePayment": ".commercepayment", - "CommercePaymentTypedDict": ".commercepayment", - "CommercePaymentMethod": ".commercepaymentmethod", - "CommercePaymentMethodStatus": ".commercepaymentmethod", - "CommercePaymentMethodTypedDict": ".commercepaymentmethod", - "CommercePaymentMethods": ".commercepaymentmethods", - "CommercePaymentMethodsTypedDict": ".commercepaymentmethods", - "CommercePayments": ".commercepayments", - "CommercePaymentsTypedDict": ".commercepayments", - "CommerceProduct": ".commerceproduct", - "CommerceProductTypedDict": ".commerceproduct", - "CommerceProductCategories": ".commerceproductcategories", - "CommerceProductCategoriesTypedDict": ".commerceproductcategories", - "CommerceProductCategory": ".commerceproductcategory", - "CommerceProductCategoryTypedDict": ".commerceproductcategory", - "CommerceProducts": ".commerceproducts", - "CommerceProductsTypedDict": ".commerceproducts", - "CommerceRecordRef": ".commercerecordref", - "CommerceRecordRefTypedDict": ".commercerecordref", - "CommerceReport": ".commercereport", - "CommerceReportTypedDict": ".commercereport", - "CommerceReportComponent": ".commercereportcomponent", - "CommerceReportComponentTypedDict": ".commercereportcomponent", - "CommerceReportDimension": ".commercereportdimension", - "CommerceReportDimensionItems": ".commercereportdimension", - "CommerceReportDimensionItemsTypedDict": ".commercereportdimension", - "CommerceReportDimensionTypedDict": ".commercereportdimension", - "CommerceReportError": ".commercereporterror", - "CommerceReportErrorTypedDict": ".commercereporterror", - "CommerceReportMeasure": ".commercereportmeasure", - "CommerceReportMeasureTypedDict": ".commercereportmeasure", - "CommerceTransaction": ".commercetransaction", - "CommerceTransactionTypedDict": ".commercetransaction", - "CommerceTransactions": ".commercetransactions", - "CommerceTransactionsTypedDict": ".commercetransactions", - "Companies": ".companies", - "CompaniesTypedDict": ".companies", - "Company": ".company", - "CompanyTypedDict": ".company", - "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", - "Contact": ".contact", - "ContactTypedDict": ".contact", - "ContactRef": ".contactref", - "ContactRefDataType": ".contactref", - "ContactRefTypedDict": ".contactref", - "CreateBankAccountTransaction": ".createbankaccounttransaction", - "CreateBankAccountTransactionTypedDict": ".createbankaccounttransaction", - "CreditNoteLineItem": ".creditnotelineitem", - "CreditNoteLineItemTypedDict": ".creditnotelineitem", - "CreditNoteStatus": ".creditnotestatus", - "CustomerStatus": ".customerstatus", - "DataConnectionError": ".dataconnectionerror", - "DataConnectionErrorTypedDict": ".dataconnectionerror", - "ErrorStatus": ".dataconnectionerror", - "DataConnectionStatus": ".dataconnectionstatus", - "DataIntegrityAmounts": ".dataintegrityamounts", - "DataIntegrityAmountsTypedDict": ".dataintegrityamounts", - "DataIntegrityByAmount": ".dataintegritybyamount", - "DataIntegrityByAmountTypedDict": ".dataintegritybyamount", - "DataIntegrityByCount": ".dataintegritybycount", - "DataIntegrityByCountTypedDict": ".dataintegritybycount", - "DataIntegrityConnectionID": ".dataintegrityconnectionid", - "DataIntegrityConnectionIDTypedDict": ".dataintegrityconnectionid", - "DataIntegrityDataType": ".dataintegritydatatype", - "DataIntegrityDates": ".dataintegritydates", - "DataIntegrityDatesTypedDict": ".dataintegritydates", - "DataIntegrityDetail": ".dataintegritydetail", - "DataIntegrityDetailTypedDict": ".dataintegritydetail", - "DataIntegrityDetails": ".dataintegritydetails", - "DataIntegrityDetailsTypedDict": ".dataintegritydetails", - "DataIntegrityMatch": ".dataintegritymatch", - "DataIntegrityMatchTypedDict": ".dataintegritymatch", - "DataIntegrityStatus": ".dataintegritystatus", - "DataIntegrityStatusTypedDict": ".dataintegritystatus", - "DataIntegrityStatuses": ".dataintegritystatuses", - "DataIntegrityStatusesTypedDict": ".dataintegritystatuses", - "DataIntegrityStatusInfo": ".dataintegritystatusinfo", - "DataIntegrityStatusInfoTypedDict": ".dataintegritystatusinfo", - "DataIntegritySummaries": ".dataintegritysummaries", - "DataIntegritySummariesTypedDict": ".dataintegritysummaries", - "DataIntegritySummary": ".dataintegritysummary", - "DataIntegritySummaryTypedDict": ".dataintegritysummary", - "DataSource": ".datasource", - "DataSourceTypedDict": ".datasource", - "DataStatus": ".datastatus", - "DataStatusTypedDict": ".datastatus", - "DataTypes": ".datastatus", - "DataType": ".datatype", - "DirectCostLineItem": ".directcostlineitem", - "DirectCostLineItemTypedDict": ".directcostlineitem", - "DirectCostPrototype": ".directcostprototype", - "DirectCostPrototypeTypedDict": ".directcostprototype", - "DirectIncomeLineItem": ".directincomelineitem", - "DirectIncomeLineItemTypedDict": ".directincomelineitem", - "DisputeStatus": ".disputestatus", - "EndUploadSessionRequest": ".enduploadsessionrequest", - "EndUploadSessionRequestStatus": ".enduploadsessionrequest", - "EndUploadSessionRequestTypedDict": ".enduploadsessionrequest", - "CashFlowTransaction": ".enhancedcashflowitem", - "CashFlowTransactionTypedDict": ".enhancedcashflowitem", - "EnhancedCashFlowItem": ".enhancedcashflowitem", - "EnhancedCashFlowItemTypedDict": ".enhancedcashflowitem", - "EnhancedCashFlowTransactions": ".enhancedcashflowtransactions", - "EnhancedCashFlowTransactionsTypedDict": ".enhancedcashflowtransactions", - "EnhancedFinancialReport": ".enhancedfinancialreport", - "EnhancedFinancialReportTypedDict": ".enhancedfinancialreport", - "ReportItem": ".enhancedfinancialreport", - "ReportItemTypedDict": ".enhancedfinancialreport", - "EnhancedInvoiceReportItem": ".enhancedinvoicereportitem", - "EnhancedInvoiceReportItemTypedDict": ".enhancedinvoicereportitem", - "EnhancedInvoicesReport": ".enhancedinvoicesreport", - "EnhancedInvoicesReportTypedDict": ".enhancedinvoicesreport", - "EnhancedReportAccountCategory": ".enhancedreportaccountcategory", - "EnhancedReportAccountCategoryTypedDict": ".enhancedreportaccountcategory", - "EnhancedReportInfo": ".enhancedreportinfo", - "EnhancedReportInfoTypedDict": ".enhancedreportinfo", - "ErrorValidation": ".errorvalidation", - "ErrorValidationTypedDict": ".errorvalidation", - "ErrorValidationItem": ".errorvalidationitem", - "ErrorValidationItemTypedDict": ".errorvalidationitem", - "ExcelReportTypes": ".excelreporttypes", - "ExcelStatus": ".excelstatus", - "ExcelStatusTypedDict": ".excelstatus", - "File": ".file", - "FileTypedDict": ".file", - "FileUpload": ".fileupload", - "FileUploadTypedDict": ".fileupload", - "HalRef": ".halref", - "HalRefTypedDict": ".halref", - "IntegrityStatus": ".integritystatus", - "InvoiceLineItem": ".invoicelineitem", - "InvoiceLineItemTypedDict": ".invoicelineitem", - "InvoiceStatus": ".invoicestatus", - "ItemRef": ".itemref", - "ItemRefTypedDict": ".itemref", - "Items": ".items", - "ItemsTypedDict": ".items", - "JournalEntryRecordRef": ".journalentryrecordref", - "JournalEntryRecordRefDataType": ".journalentryrecordref", - "JournalEntryRecordRefTypedDict": ".journalentryrecordref", - "ContactReference": ".journalline", - "ContactReferenceTypedDict": ".journalline", - "JournalLine": ".journalline", - "JournalLineDataType": ".journalline", - "JournalLineTracking": ".journalline", - "JournalLineTrackingTypedDict": ".journalline", - "JournalLineTypedDict": ".journalline", - "JournalRef": ".journalref", - "JournalRefTypedDict": ".journalref", - "JournalStatus": ".journalstatus", - "LendingCustomerRef": ".lendingcustomerref", - "LendingCustomerRefTypedDict": ".lendingcustomerref", - "Links": ".links", - "LinksTypedDict": ".links", - "LoanRef": ".loanref", - "LoanRefTypedDict": ".loanref", - "LoanSummary": ".loansummary", - "LoanSummaryTypedDict": ".loansummary", - "LoanSummaryIntegrationType": ".loansummaryintegrationtype", - "LoanSummaryRecordRef": ".loansummaryrecordref", - "LoanSummaryRecordRefTypedDict": ".loansummaryrecordref", - "LoanSummaryRecordRefType": ".loansummaryrecordreftype", - "LoanSummaryReportInfo": ".loansummaryreportinfo", - "LoanSummaryReportInfoTypedDict": ".loansummaryreportinfo", - "LoanSummaryReportItem": ".loansummaryreportitem", - "LoanSummaryReportItemTypedDict": ".loansummaryreportitem", - "LoanTransactions": ".loantransactions", - "LoanTransactionsTypedDict": ".loantransactions", - "LoanTransactionsReportInfo": ".loantransactionsreportinfo", - "LoanTransactionsReportInfoTypedDict": ".loantransactionsreportinfo", - "LocationRef": ".locationref", - "LocationRefTypedDict": ".locationref", - "Metadata": ".metadata", - "MetadataTypedDict": ".metadata", - "OrderDiscountAllocation": ".orderdiscountallocation", - "OrderDiscountAllocationTypedDict": ".orderdiscountallocation", - "OrderLineItem": ".orderlineitem", - "OrderLineItemTypedDict": ".orderlineitem", - "Path": ".path", - "Payment": ".payment", - "PaymentTypedDict": ".payment", - "PaymentAllocationPayment": ".paymentallocationpayment", - "PaymentAllocationPaymentTypedDict": ".paymentallocationpayment", - "PaymentLine": ".paymentline", - "PaymentLineTypedDict": ".paymentline", - "PaymentLineLink": ".paymentlinelink", - "PaymentLineLinkTypedDict": ".paymentlinelink", - "PaymentLinkType": ".paymentlinktype", - "PaymentMethodRef": ".paymentmethodref", - "PaymentMethodRefTypedDict": ".paymentmethodref", - "PaymentRef": ".paymentref", - "PaymentRefTypedDict": ".paymentref", - "PaymentStatus": ".paymentstatus", - "PaymentType": ".paymenttype", - "PeriodUnit": ".periodunit", - "PhoneNumber": ".phonenumber", - "PhoneNumberType": ".phonenumber", - "PhoneNumberTypedDict": ".phonenumber", - "ProductInventory": ".productinventory", - "ProductInventoryTypedDict": ".productinventory", - "ProductInventoryLocation": ".productinventorylocation", - "ProductInventoryLocationTypedDict": ".productinventorylocation", - "ProductPrice": ".productprice", - "ProductPriceTypedDict": ".productprice", - "ProductRef": ".productref", - "ProductRefTypedDict": ".productref", - "ProductVariant": ".productvariant", - "ProductVariantTypedDict": ".productvariant", - "ProductVariantRef": ".productvariantref", - "ProductVariantRefTypedDict": ".productvariantref", - "ProductVariantStatus": ".productvariantstatus", - "ProfitAndLossReport": ".profitandlossreport", - "ProfitAndLossReportTypedDict": ".profitandlossreport", - "ProjectRef": ".projectref", - "ProjectRefTypedDict": ".projectref", - "PropertieAccountType": ".propertie_accounttype", - "PropertieItemRef": ".propertie_itemref", - "PropertieItemRefTypedDict": ".propertie_itemref", - "DatasetStatus": ".pulloperation", - "PullOperation": ".pulloperation", - "PullOperationTypedDict": ".pulloperation", - "PullOperations": ".pulloperations", - "PullOperationsTypedDict": ".pulloperations", - "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", - "ReportBasis": ".reportbasis", - "ReportComponentMeasure": ".reportcomponentmeasure", - "ReportComponentMeasureTypedDict": ".reportcomponentmeasure", - "ReportGenerationPayload": ".reportgenerationpayload", - "ReportGenerationPayloadTypedDict": ".reportgenerationpayload", - "ReportInfo": ".reportinfo", - "ReportInfoTypedDict": ".reportinfo", - "ReportInput": ".reportinput", - "LoanTransactionType": ".reportitems", - "ReportItems": ".reportitems", - "ReportItemsTypedDict": ".reportitems", - "ReportLine": ".reportline", - "ReportLineTypedDict": ".reportline", - "ReportOperation": ".reportoperation", - "ReportOperationStatus": ".reportoperation", - "ReportOperationType": ".reportoperation", - "ReportOperationTypedDict": ".reportoperation", - "Reports": ".reports", - "ReportsTypedDict": ".reports", - "ReportType": ".reporttype", - "RoutingInfo": ".routinginfo", - "RoutingInfoTypedDict": ".routinginfo", - "Type": ".routinginfo", - "Schema": ".schema", - "SchemaTypedDict": ".schema", - "SchemaDataType": ".schema_datatype", - "Security": ".security", - "SecurityTypedDict": ".security", - "ServiceCharge": ".servicecharge", - "ServiceChargeTypedDict": ".servicecharge", - "ServiceChargeType": ".servicechargetype", - "SourceAccount": ".sourceaccount", - "SourceAccountStatus": ".sourceaccount", - "SourceAccountTypedDict": ".sourceaccount", - "SourceAccountPrototype": ".sourceaccountprototype", - "SourceAccountPrototypeTypedDict": ".sourceaccountprototype", - "SourceAccountV2": ".sourceaccountv2", - "SourceAccountV2AccountType": ".sourceaccountv2", - "SourceAccountV2Status": ".sourceaccountv2", - "SourceAccountV2TypedDict": ".sourceaccountv2", - "SourceAccountV2Prototype": ".sourceaccountv2prototype", - "SourceAccountV2PrototypeTypedDict": ".sourceaccountv2prototype", - "SourceRef": ".sourceref", - "SourceRefTypedDict": ".sourceref", - "StartUploadSessionRequest": ".startuploadsessionrequest", - "StartUploadSessionRequestDataType": ".startuploadsessionrequest", - "StartUploadSessionRequestTypedDict": ".startuploadsessionrequest", - "Status": ".status", - "SupplementalData": ".supplementaldata", - "SupplementalDataTypedDict": ".supplementaldata", - "SupplierRef": ".supplierref", - "SupplierRefTypedDict": ".supplierref", - "SupplierStatus": ".supplierstatus", - "TargetAccountOption": ".targetaccountoption", - "TargetAccountOptionTypedDict": ".targetaccountoption", - "TaxComponentAllocation": ".taxcomponentallocation", - "TaxComponentAllocationTypedDict": ".taxcomponentallocation", - "TaxComponentRef": ".taxcomponentref", - "TaxComponentRefTypedDict": ".taxcomponentref", - "TaxRateRef": ".taxrateref", - "TaxRateRefTypedDict": ".taxrateref", - "Tracking": ".tracking", - "TrackingTypedDict": ".tracking", - "TrackingCategoryRef": ".trackingcategoryref", - "TrackingCategoryRefTypedDict": ".trackingcategoryref", - "TrackingRecordRef": ".trackingrecordref", - "TrackingRecordRefDataType": ".trackingrecordref", - "TrackingRecordRefTypedDict": ".trackingrecordref", - "TransactionCategory": ".transactioncategory", - "TransactionCategoryTypedDict": ".transactioncategory", - "TransactionCategoryRef": ".transactioncategoryref", - "TransactionCategoryRefTypedDict": ".transactioncategoryref", - "TransactionCategoryStatus": ".transactioncategorystatus", - "TransactionCode": ".transactioncode", - "TransactionSourceRef": ".transactionsourceref", - "TransactionSourceRefTypedDict": ".transactionsourceref", - "TransactionSourceType": ".transactionsourcetype", - "TransactionType": ".transactiontype", - "TransferAccount": ".transferaccount", - "TransferAccountTypedDict": ".transferaccount", - "Validation": ".validation", - "ValidationTypedDict": ".validation", - "ValidationItem": ".validationitem", - "ValidationItemTypedDict": ".validationitem", - "WebLink": ".weblink", - "WebLinkType": ".weblink", - "WebLinkTypedDict": ".weblink", - "Zero": ".zero", - "ZeroDataType": ".zero", - "ZeroTypedDict": ".zero", +_dynamic_imports: dict[str, tuple[str, str]] = { + 'Account': ('codat_lending.models.account', 'Account'), + 'AccountBalance': ('codat_lending.models.shared.accountbalance', 'AccountBalance'), + 'AccountBalanceAmounts': ('codat_lending.models.shared.accountbalanceamounts', 'AccountBalanceAmounts'), + 'AccountBalanceAmountsTypedDict': ('codat_lending.models.shared.accountbalanceamounts', 'AccountBalanceAmountsTypedDict'), + 'AccountBalanceTypedDict': ('codat_lending.models.shared.accountbalance', 'AccountBalanceTypedDict'), + 'AccountCategoriesUpdatedWebhook': ('codat_lending.models.shared.accountcategoriesupdatedwebhook', 'AccountCategoriesUpdatedWebhook'), + 'AccountCategoriesUpdatedWebhookData': ('codat_lending.models.shared.accountcategoriesupdatedwebhookdata', 'AccountCategoriesUpdatedWebhookData'), + 'AccountCategoriesUpdatedWebhookDataTypedDict': ('codat_lending.models.shared.accountcategoriesupdatedwebhookdata', 'AccountCategoriesUpdatedWebhookDataTypedDict'), + 'AccountCategoriesUpdatedWebhookTypedDict': ('codat_lending.models.shared.accountcategoriesupdatedwebhook', 'AccountCategoriesUpdatedWebhookTypedDict'), + 'AccountCategoryLevel': ('codat_lending.models.shared.accountcategorylevel', 'AccountCategoryLevel'), + 'AccountCategoryLevelTypedDict': ('codat_lending.models.shared.accountcategorylevel', 'AccountCategoryLevelTypedDict'), + 'AccountIdentifierType': ('codat_lending.models.shared.accountidentifiertype', 'AccountIdentifierType'), + 'AccountIdentifiers': ('codat_lending.models.shared.accountidentifiers', 'AccountIdentifiers'), + 'AccountIdentifiersTypedDict': ('codat_lending.models.shared.accountidentifiers', 'AccountIdentifiersTypedDict'), + 'AccountInfo': ('codat_lending.models.shared.accountinfo', 'AccountInfo'), + 'AccountInfoTypedDict': ('codat_lending.models.shared.accountinfo', 'AccountInfoTypedDict'), + 'AccountInstitution': ('codat_lending.models.shared.accountinstitution', 'AccountInstitution'), + 'AccountInstitutionTypedDict': ('codat_lending.models.shared.accountinstitution', 'AccountInstitutionTypedDict'), + 'AccountPrototype': ('codat_lending.models.shared.accountprototype', 'AccountPrototype'), + 'AccountPrototypeTypedDict': ('codat_lending.models.shared.accountprototype', 'AccountPrototypeTypedDict'), + 'AccountRef': ('codat_lending.models.shared.accountref', 'AccountRef'), + 'AccountRefTypedDict': ('codat_lending.models.shared.accountref', 'AccountRefTypedDict'), + 'AccountStatus': ('codat_lending.models.shared.accountstatus', 'AccountStatus'), + 'AccountTransactionLine': ('codat_lending.models.shared.accounttransactionline', 'AccountTransactionLine'), + 'AccountTransactionLineRecordRef': ('codat_lending.models.account_transaction_line_record_ref', 'AccountTransactionLineRecordRef'), + 'AccountTransactionLineRecordRefDataType': ('codat_lending.models.shared.accounttransactionlinerecordref', 'AccountTransactionLineRecordRefDataType'), + 'AccountTransactionLineRecordRefTypedDict': ('codat_lending.models.account_transaction_line_record_ref', 'AccountTransactionLineRecordRefTypedDict'), + 'AccountTransactionLineTypedDict': ('codat_lending.models.shared.accounttransactionline', 'AccountTransactionLineTypedDict'), + 'AccountType': ('codat_lending.models.shared.accounttype', 'AccountType'), + 'AccountTypedDict': ('codat_lending.models.account', 'AccountTypedDict'), + 'AccountingAccount': ('codat_lending.models.shared.accountingaccount', 'AccountingAccount'), + 'AccountingAccountTransaction': ('codat_lending.models.shared.accountingaccounttransaction', 'AccountingAccountTransaction'), + 'AccountingAccountTransactionDataType': ('codat_lending.models.accounting_account_transaction_data_type', 'AccountingAccountTransactionDataType'), + 'AccountingAccountTransactionStatus': ('codat_lending.models.accounting_account_transaction_status', 'AccountingAccountTransactionStatus'), + 'AccountingAccountTransactionTypedDict': ('codat_lending.models.shared.accountingaccounttransaction', 'AccountingAccountTransactionTypedDict'), + 'AccountingAccountTransactions': ('codat_lending.models.shared.accountingaccounttransactions', 'AccountingAccountTransactions'), + 'AccountingAccountTransactionsTypedDict': ('codat_lending.models.shared.accountingaccounttransactions', 'AccountingAccountTransactionsTypedDict'), + 'AccountingAccountTypedDict': ('codat_lending.models.shared.accountingaccount', 'AccountingAccountTypedDict'), + 'AccountingAccountValidDataTypeLinks': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinks'), + 'AccountingAccountValidDataTypeLinksTypedDict': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinksTypedDict'), + 'AccountingAccounts': ('codat_lending.models.shared.accountingaccounts', 'AccountingAccounts'), + 'AccountingAccountsTypedDict': ('codat_lending.models.shared.accountingaccounts', 'AccountingAccountsTypedDict'), + 'AccountingAddress': ('codat_lending.models.shared.accountingaddress', 'AccountingAddress'), + 'AccountingAddressType': ('codat_lending.models.shared.accountingaddresstype', 'AccountingAddressType'), + 'AccountingAddressTypedDict': ('codat_lending.models.shared.accountingaddress', 'AccountingAddressTypedDict'), + 'AccountingAgedCreditorReport': ('codat_lending.models.shared.accountingagedcreditorreport', 'AccountingAgedCreditorReport'), + 'AccountingAgedCreditorReportTypedDict': ('codat_lending.models.shared.accountingagedcreditorreport', 'AccountingAgedCreditorReportTypedDict'), + 'AccountingAgedDebtorReport': ('codat_lending.models.shared.accountingageddebtorreport', 'AccountingAgedDebtorReport'), + 'AccountingAgedDebtorReportTypedDict': ('codat_lending.models.shared.accountingageddebtorreport', 'AccountingAgedDebtorReportTypedDict'), + 'AccountingAttachment': ('codat_lending.models.shared.accountingattachment', 'AccountingAttachment'), + 'AccountingAttachmentTypedDict': ('codat_lending.models.shared.accountingattachment', 'AccountingAttachmentTypedDict'), + 'AccountingBalanceSheet': ('codat_lending.models.shared.accountingbalancesheet', 'AccountingBalanceSheet'), + 'AccountingBalanceSheetTypedDict': ('codat_lending.models.shared.accountingbalancesheet', 'AccountingBalanceSheetTypedDict'), + 'AccountingBankAccount': ('codat_lending.models.shared.accountingbankaccount', 'AccountingBankAccount'), + 'AccountingBankAccountType': ('codat_lending.models.shared.accountingbankaccounttype', 'AccountingBankAccountType'), + 'AccountingBankAccountTypedDict': ('codat_lending.models.shared.accountingbankaccount', 'AccountingBankAccountTypedDict'), + 'AccountingBankAccounts': ('codat_lending.models.shared.accountingbankaccounts', 'AccountingBankAccounts'), + 'AccountingBankAccountsTypedDict': ('codat_lending.models.shared.accountingbankaccounts', 'AccountingBankAccountsTypedDict'), + 'AccountingBankTransaction': ('codat_lending.models.shared.accountingbanktransaction', 'AccountingBankTransaction'), + 'AccountingBankTransactionTypedDict': ('codat_lending.models.shared.accountingbanktransaction', 'AccountingBankTransactionTypedDict'), + 'AccountingBankTransactions': ('codat_lending.models.shared.accountingbanktransactions', 'AccountingBankTransactions'), + 'AccountingBankTransactionsTypedDict': ('codat_lending.models.shared.accountingbanktransactions', 'AccountingBankTransactionsTypedDict'), + 'AccountingBill': ('codat_lending.models.shared.accountingbill', 'AccountingBill'), + 'AccountingBillCreditNote': ('codat_lending.models.shared.accountingbillcreditnote', 'AccountingBillCreditNote'), + 'AccountingBillCreditNoteTypedDict': ('codat_lending.models.shared.accountingbillcreditnote', 'AccountingBillCreditNoteTypedDict'), + 'AccountingBillCreditNotes': ('codat_lending.models.shared.accountingbillcreditnotes', 'AccountingBillCreditNotes'), + 'AccountingBillCreditNotesTypedDict': ('codat_lending.models.shared.accountingbillcreditnotes', 'AccountingBillCreditNotesTypedDict'), + 'AccountingBillPayment': ('codat_lending.models.shared.accountingbillpayment', 'AccountingBillPayment'), + 'AccountingBillPaymentAllOfPaymentMethodRef': ('codat_lending.models.accounting_bill_payment_all_of_payment_method_ref', 'AccountingBillPaymentAllOfPaymentMethodRef'), + 'AccountingBillPaymentAllOfPaymentMethodRefTypedDict': ('codat_lending.models.accounting_bill_payment_all_of_payment_method_ref', 'AccountingBillPaymentAllOfPaymentMethodRefTypedDict'), + 'AccountingBillPaymentAllOfSupplierRef': ('codat_lending.models.accounting_bill_payment_all_of_supplier_ref', 'AccountingBillPaymentAllOfSupplierRef'), + 'AccountingBillPaymentAllOfSupplierRefTypedDict': ('codat_lending.models.accounting_bill_payment_all_of_supplier_ref', 'AccountingBillPaymentAllOfSupplierRefTypedDict'), + 'AccountingBillPaymentTypedDict': ('codat_lending.models.shared.accountingbillpayment', 'AccountingBillPaymentTypedDict'), + 'AccountingBillPayments': ('codat_lending.models.shared.accountingbillpayments', 'AccountingBillPayments'), + 'AccountingBillPaymentsTypedDict': ('codat_lending.models.shared.accountingbillpayments', 'AccountingBillPaymentsTypedDict'), + 'AccountingBillTypedDict': ('codat_lending.models.shared.accountingbill', 'AccountingBillTypedDict'), + 'AccountingBills': ('codat_lending.models.shared.accountingbills', 'AccountingBills'), + 'AccountingBillsTypedDict': ('codat_lending.models.shared.accountingbills', 'AccountingBillsTypedDict'), + 'AccountingCashFlowStatement': ('codat_lending.models.shared.accountingcashflowstatement', 'AccountingCashFlowStatement'), + 'AccountingCashFlowStatementTypedDict': ('codat_lending.models.shared.accountingcashflowstatement', 'AccountingCashFlowStatementTypedDict'), + 'AccountingCompanyInfo': ('codat_lending.models.shared.accountingcompanyinfo', 'AccountingCompanyInfo'), + 'AccountingCompanyInfoTypedDict': ('codat_lending.models.shared.accountingcompanyinfo', 'AccountingCompanyInfoTypedDict'), + 'AccountingCreateAccountResponse': ('codat_lending.models.shared.accountingcreateaccountresponse', 'AccountingCreateAccountResponse'), + 'AccountingCreateAccountResponseAccountingAccount': ('codat_lending.models.accounting_create_account_response_all_of_data', 'AccountingCreateAccountResponseAllOfData'), + 'AccountingCreateAccountResponseAccountingAccountTypedDict': ('codat_lending.models.accounting_create_account_response_all_of_data', 'AccountingCreateAccountResponseAllOfData'), + 'AccountingCreateAccountResponseAllOfData': ('codat_lending.models.accounting_create_account_response_all_of_data', 'AccountingCreateAccountResponseAllOfData'), + 'AccountingCreateAccountResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_account_response_all_of_data', 'AccountingCreateAccountResponseAllOfDataTypedDict'), + 'AccountingCreateAccountResponseTypedDict': ('codat_lending.models.shared.accountingcreateaccountresponse', 'AccountingCreateAccountResponseTypedDict'), + 'AccountingCreateAccountResponseValidDataTypeLinks': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinks'), + 'AccountingCreateAccountResponseValidDataTypeLinksTypedDict': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinksTypedDict'), + 'AccountingCreateBankAccountResponse': ('codat_lending.models.shared.accountingcreatebankaccountresponse', 'AccountingCreateBankAccountResponse'), + 'AccountingCreateBankAccountResponseAccountingBankAccount': ('codat_lending.models.accounting_create_bank_account_response_all_of_data', 'AccountingCreateBankAccountResponseAllOfData'), + 'AccountingCreateBankAccountResponseAccountingBankAccountTypedDict': ('codat_lending.models.accounting_create_bank_account_response_all_of_data', 'AccountingCreateBankAccountResponseAllOfData'), + 'AccountingCreateBankAccountResponseAllOfData': ('codat_lending.models.accounting_create_bank_account_response_all_of_data', 'AccountingCreateBankAccountResponseAllOfData'), + 'AccountingCreateBankAccountResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_bank_account_response_all_of_data', 'AccountingCreateBankAccountResponseAllOfDataTypedDict'), + 'AccountingCreateBankAccountResponseTypedDict': ('codat_lending.models.shared.accountingcreatebankaccountresponse', 'AccountingCreateBankAccountResponseTypedDict'), + 'AccountingCreateBankAccountTransactions': ('codat_lending.models.accountingcreatebankaccounttransactions', 'AccountingCreateBankAccountTransactions'), + 'AccountingCreateBankAccountTransactionsTypedDict': ('codat_lending.models.accountingcreatebankaccounttransactions', 'AccountingCreateBankAccountTransactionsTypedDict'), + 'AccountingCreateBankTransactions': ('codat_lending.models.shared.accountingcreatebanktransactions', 'AccountingCreateBankTransactions'), + 'AccountingCreateBankTransactionsResponse': ('codat_lending.models.shared.accountingcreatebanktransactionsresponse', 'AccountingCreateBankTransactionsResponse'), + 'AccountingCreateBankTransactionsResponseAllOfData': ('codat_lending.models.accounting_create_bank_transactions_response_all_of_data', 'AccountingCreateBankTransactionsResponseAllOfData'), + 'AccountingCreateBankTransactionsResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_bank_transactions_response_all_of_data', 'AccountingCreateBankTransactionsResponseAllOfDataTypedDict'), + 'AccountingCreateBankTransactionsResponseTypedDict': ('codat_lending.models.shared.accountingcreatebanktransactionsresponse', 'AccountingCreateBankTransactionsResponseTypedDict'), + 'AccountingCreateBankTransactionsTypedDict': ('codat_lending.models.shared.accountingcreatebanktransactions', 'AccountingCreateBankTransactionsTypedDict'), + 'AccountingCreateDirectCostResponse': ('codat_lending.models.shared.accountingcreatedirectcostresponse', 'AccountingCreateDirectCostResponse'), + 'AccountingCreateDirectCostResponseAccountingDirectCost': ('codat_lending.models.accounting_create_direct_cost_response_all_of_data', 'AccountingCreateDirectCostResponseAllOfData'), + 'AccountingCreateDirectCostResponseAccountingDirectCostTypedDict': ('codat_lending.models.accounting_create_direct_cost_response_all_of_data', 'AccountingCreateDirectCostResponseAllOfData'), + 'AccountingCreateDirectCostResponseAllOfData': ('codat_lending.models.accounting_create_direct_cost_response_all_of_data', 'AccountingCreateDirectCostResponseAllOfData'), + 'AccountingCreateDirectCostResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_direct_cost_response_all_of_data', 'AccountingCreateDirectCostResponseAllOfDataTypedDict'), + 'AccountingCreateDirectCostResponseTypedDict': ('codat_lending.models.shared.accountingcreatedirectcostresponse', 'AccountingCreateDirectCostResponseTypedDict'), + 'AccountingCreatePaymentResponse': ('codat_lending.models.shared.accountingcreatepaymentresponse', 'AccountingCreatePaymentResponse'), + 'AccountingCreatePaymentResponseAccountingPayment': ('codat_lending.models.accounting_create_payment_response_all_of_data', 'AccountingCreatePaymentResponseAllOfData'), + 'AccountingCreatePaymentResponseAccountingPaymentTypedDict': ('codat_lending.models.accounting_create_payment_response_all_of_data', 'AccountingCreatePaymentResponseAllOfData'), + 'AccountingCreatePaymentResponseAllOfData': ('codat_lending.models.accounting_create_payment_response_all_of_data', 'AccountingCreatePaymentResponseAllOfData'), + 'AccountingCreatePaymentResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_payment_response_all_of_data', 'AccountingCreatePaymentResponseAllOfDataTypedDict'), + 'AccountingCreatePaymentResponseTypedDict': ('codat_lending.models.shared.accountingcreatepaymentresponse', 'AccountingCreatePaymentResponseTypedDict'), + 'AccountingCreateSupplierResponse': ('codat_lending.models.shared.accountingcreatesupplierresponse', 'AccountingCreateSupplierResponse'), + 'AccountingCreateSupplierResponseAccountingSupplier': ('codat_lending.models.accounting_create_supplier_response_all_of_data', 'AccountingCreateSupplierResponseAllOfData'), + 'AccountingCreateSupplierResponseAccountingSupplierTypedDict': ('codat_lending.models.accounting_create_supplier_response_all_of_data', 'AccountingCreateSupplierResponseAllOfData'), + 'AccountingCreateSupplierResponseAllOfData': ('codat_lending.models.accounting_create_supplier_response_all_of_data', 'AccountingCreateSupplierResponseAllOfData'), + 'AccountingCreateSupplierResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_supplier_response_all_of_data', 'AccountingCreateSupplierResponseAllOfDataTypedDict'), + 'AccountingCreateSupplierResponseTypedDict': ('codat_lending.models.shared.accountingcreatesupplierresponse', 'AccountingCreateSupplierResponseTypedDict'), + 'AccountingCreateTransferResponse': ('codat_lending.models.accounting_create_transfer_response', 'AccountingCreateTransferResponse'), + 'AccountingCreateTransferResponseAccountingTransfer': ('codat_lending.models.accounting_create_transfer_response_all_of_data', 'AccountingCreateTransferResponseAllOfData'), + 'AccountingCreateTransferResponseAccountingTransferTypedDict': ('codat_lending.models.accounting_create_transfer_response_all_of_data', 'AccountingCreateTransferResponseAllOfData'), + 'AccountingCreateTransferResponseAllOfData': ('codat_lending.models.accounting_create_transfer_response_all_of_data', 'AccountingCreateTransferResponseAllOfData'), + 'AccountingCreateTransferResponseAllOfDataTypedDict': ('codat_lending.models.accounting_create_transfer_response_all_of_data', 'AccountingCreateTransferResponseAllOfDataTypedDict'), + 'AccountingCreateTransferResponseStatus': ('codat_lending.models.shared.accountingcreatetransferresponse', 'AccountingCreateTransferResponseStatus'), + 'AccountingCreateTransferResponseTypedDict': ('codat_lending.models.accounting_create_transfer_response', 'AccountingCreateTransferResponseTypedDict'), + 'AccountingCreditNote': ('codat_lending.models.shared.accountingcreditnote', 'AccountingCreditNote'), + 'AccountingCreditNoteTypedDict': ('codat_lending.models.shared.accountingcreditnote', 'AccountingCreditNoteTypedDict'), + 'AccountingCreditNotes': ('codat_lending.models.shared.accountingcreditnotes', 'AccountingCreditNotes'), + 'AccountingCreditNotesTypedDict': ('codat_lending.models.shared.accountingcreditnotes', 'AccountingCreditNotesTypedDict'), + 'AccountingCustomer': ('codat_lending.models.shared.accountingcustomer', 'AccountingCustomer'), + 'AccountingCustomerRef': ('codat_lending.models.shared.accountingcustomerref', 'AccountingCustomerRef'), + 'AccountingCustomerRefTypedDict': ('codat_lending.models.shared.accountingcustomerref', 'AccountingCustomerRefTypedDict'), + 'AccountingCustomerTypedDict': ('codat_lending.models.shared.accountingcustomer', 'AccountingCustomerTypedDict'), + 'AccountingCustomers': ('codat_lending.models.shared.accountingcustomers', 'AccountingCustomers'), + 'AccountingCustomersTypedDict': ('codat_lending.models.shared.accountingcustomers', 'AccountingCustomersTypedDict'), + 'AccountingDirectCost': ('codat_lending.models.shared.accountingdirectcost', 'AccountingDirectCost'), + 'AccountingDirectCostTypedDict': ('codat_lending.models.shared.accountingdirectcost', 'AccountingDirectCostTypedDict'), + 'AccountingDirectCosts': ('codat_lending.models.shared.accountingdirectcosts', 'AccountingDirectCosts'), + 'AccountingDirectCostsTypedDict': ('codat_lending.models.shared.accountingdirectcosts', 'AccountingDirectCostsTypedDict'), + 'AccountingDirectIncome': ('codat_lending.models.shared.accountingdirectincome', 'AccountingDirectIncome'), + 'AccountingDirectIncomeTypedDict': ('codat_lending.models.shared.accountingdirectincome', 'AccountingDirectIncomeTypedDict'), + 'AccountingDirectIncomes': ('codat_lending.models.shared.accountingdirectincomes', 'AccountingDirectIncomes'), + 'AccountingDirectIncomesTypedDict': ('codat_lending.models.shared.accountingdirectincomes', 'AccountingDirectIncomesTypedDict'), + 'AccountingInvoice': ('codat_lending.models.shared.accountinginvoice', 'AccountingInvoice'), + 'AccountingInvoiceDataType': ('codat_lending.models.accounting_invoice_data_type', 'AccountingInvoiceDataType'), + 'AccountingInvoiceTypedDict': ('codat_lending.models.shared.accountinginvoice', 'AccountingInvoiceTypedDict'), + 'AccountingInvoices': ('codat_lending.models.shared.accountinginvoices', 'AccountingInvoices'), + 'AccountingInvoicesTypedDict': ('codat_lending.models.shared.accountinginvoices', 'AccountingInvoicesTypedDict'), + 'AccountingJournal': ('codat_lending.models.shared.accountingjournal', 'AccountingJournal'), + 'AccountingJournalEntries': ('codat_lending.models.shared.accountingjournalentries', 'AccountingJournalEntries'), + 'AccountingJournalEntriesTypedDict': ('codat_lending.models.shared.accountingjournalentries', 'AccountingJournalEntriesTypedDict'), + 'AccountingJournalEntry': ('codat_lending.models.shared.accountingjournalentry', 'AccountingJournalEntry'), + 'AccountingJournalEntryDataType': ('codat_lending.models.accounting_journal_entry_data_type', 'AccountingJournalEntryDataType'), + 'AccountingJournalEntryTypedDict': ('codat_lending.models.shared.accountingjournalentry', 'AccountingJournalEntryTypedDict'), + 'AccountingJournalTypedDict': ('codat_lending.models.shared.accountingjournal', 'AccountingJournalTypedDict'), + 'AccountingJournals': ('codat_lending.models.shared.accountingjournals', 'AccountingJournals'), + 'AccountingJournalsTypedDict': ('codat_lending.models.shared.accountingjournals', 'AccountingJournalsTypedDict'), + 'AccountingPayment': ('codat_lending.models.shared.accountingpayment', 'AccountingPayment'), + 'AccountingPaymentAllocation': ('codat_lending.models.shared.accountingpaymentallocation', 'AccountingPaymentAllocation'), + 'AccountingPaymentAllocationAllocation': ('codat_lending.models.accounting_payment_allocation_allocation', 'AccountingPaymentAllocationAllocation'), + 'AccountingPaymentAllocationAllocationTypedDict': ('codat_lending.models.accounting_payment_allocation_allocation', 'AccountingPaymentAllocationAllocationTypedDict'), + 'AccountingPaymentAllocationTypedDict': ('codat_lending.models.shared.accountingpaymentallocation', 'AccountingPaymentAllocationTypedDict'), + 'AccountingPaymentMethod': ('codat_lending.models.accounting_payment_method', 'AccountingPaymentMethod'), + 'AccountingPaymentMethodTypedDict': ('codat_lending.models.accounting_payment_method', 'AccountingPaymentMethodTypedDict'), + 'AccountingPaymentTypedDict': ('codat_lending.models.shared.accountingpayment', 'AccountingPaymentTypedDict'), + 'AccountingPayments': ('codat_lending.models.shared.accountingpayments', 'AccountingPayments'), + 'AccountingPaymentsTypedDict': ('codat_lending.models.shared.accountingpayments', 'AccountingPaymentsTypedDict'), + 'AccountingProfitAndLossReport': ('codat_lending.models.shared.accountingprofitandlossreport', 'AccountingProfitAndLossReport'), + 'AccountingProfitAndLossReportTypedDict': ('codat_lending.models.shared.accountingprofitandlossreport', 'AccountingProfitAndLossReportTypedDict'), + 'AccountingRecordRef': ('codat_lending.models.shared.accountingrecordref', 'AccountingRecordRef'), + 'AccountingRecordRefTypedDict': ('codat_lending.models.shared.accountingrecordref', 'AccountingRecordRefTypedDict'), + 'AccountingSupplier': ('codat_lending.models.shared.accountingsupplier', 'AccountingSupplier'), + 'AccountingSupplierTypedDict': ('codat_lending.models.shared.accountingsupplier', 'AccountingSupplierTypedDict'), + 'AccountingSuppliers': ('codat_lending.models.shared.accountingsuppliers', 'AccountingSuppliers'), + 'AccountingSuppliersTypedDict': ('codat_lending.models.shared.accountingsuppliers', 'AccountingSuppliersTypedDict'), + 'AccountingTrackingCategory': ('codat_lending.models.accounting_tracking_category', 'AccountingTrackingCategory'), + 'AccountingTrackingCategoryTypedDict': ('codat_lending.models.accounting_tracking_category', 'AccountingTrackingCategoryTypedDict'), + 'AccountingTransfer': ('codat_lending.models.shared.accountingtransfer', 'AccountingTransfer'), + 'AccountingTransferStatus': ('codat_lending.models.accounting_transfer_status', 'AccountingTransferStatus'), + 'AccountingTransferTypedDict': ('codat_lending.models.shared.accountingtransfer', 'AccountingTransferTypedDict'), + 'AccountingTransfers': ('codat_lending.models.shared.accountingtransfers', 'AccountingTransfers'), + 'AccountingTransfersTypedDict': ('codat_lending.models.shared.accountingtransfers', 'AccountingTransfersTypedDict'), + 'Accounts': ('codat_lending.models.shared.accounts', 'Accounts'), + 'AccountsPayableTracking': ('codat_lending.models.shared.accountspayabletracking', 'AccountsPayableTracking'), + 'AccountsPayableTrackingTypedDict': ('codat_lending.models.shared.accountspayabletracking', 'AccountsPayableTrackingTypedDict'), + 'AccountsReceivableTracking': ('codat_lending.models.shared.accountsreceivabletracking', 'AccountsReceivableTracking'), + 'AccountsReceivableTrackingTypedDict': ('codat_lending.models.shared.accountsreceivabletracking', 'AccountsReceivableTrackingTypedDict'), + 'AccountsTypedDict': ('codat_lending.models.shared.accounts', 'AccountsTypedDict'), + 'AgedCreditor': ('codat_lending.models.shared.agedcreditor', 'AgedCreditor'), + 'AgedCreditorTypedDict': ('codat_lending.models.shared.agedcreditor', 'AgedCreditorTypedDict'), + 'AgedCurrencyOutstanding': ('codat_lending.models.shared.agedcurrencyoutstanding', 'AgedCurrencyOutstanding'), + 'AgedCurrencyOutstandingTypedDict': ('codat_lending.models.shared.agedcurrencyoutstanding', 'AgedCurrencyOutstandingTypedDict'), + 'AgedDebtor': ('codat_lending.models.shared.ageddebtor', 'AgedDebtor'), + 'AgedDebtorTypedDict': ('codat_lending.models.shared.ageddebtor', 'AgedDebtorTypedDict'), + 'AgedOutstandingAmount': ('codat_lending.models.shared.agedoutstandingamount', 'AgedOutstandingAmount'), + 'AgedOutstandingAmountDetail': ('codat_lending.models.shared.agedoutstandingamountdetail', 'AgedOutstandingAmountDetail'), + 'AgedOutstandingAmountDetailTypedDict': ('codat_lending.models.shared.agedoutstandingamountdetail', 'AgedOutstandingAmountDetailTypedDict'), + 'AgedOutstandingAmountTypedDict': ('codat_lending.models.shared.agedoutstandingamount', 'AgedOutstandingAmountTypedDict'), + 'Allocation': ('codat_lending.models.accounting_payment_allocation_allocation', 'AccountingPaymentAllocationAllocation'), + 'AllocationTypedDict': ('codat_lending.models.accounting_payment_allocation_allocation', 'AccountingPaymentAllocationAllocationTypedDict'), + 'Attachments': ('codat_lending.models.shared.attachments', 'Attachments'), + 'AttachmentsTypedDict': ('codat_lending.models.shared.attachments', 'AttachmentsTypedDict'), + 'BalanceSheet': ('codat_lending.models.shared.balancesheet', 'BalanceSheet'), + 'BalanceSheetTypedDict': ('codat_lending.models.shared.balancesheet', 'BalanceSheetTypedDict'), + 'BankAccountPrototype': ('codat_lending.models.bank_account_prototype', 'BankAccountPrototype'), + 'BankAccountPrototypeTypedDict': ('codat_lending.models.bank_account_prototype', 'BankAccountPrototypeTypedDict'), + 'BankAccountRef': ('codat_lending.models.shared.bankaccountref', 'BankAccountRef'), + 'BankAccountRefTypedDict': ('codat_lending.models.shared.bankaccountref', 'BankAccountRefTypedDict'), + 'BankAccountStatus': ('codat_lending.models.shared.bankaccountstatus', 'BankAccountStatus'), + 'BankFeedBankAccountMapping': ('codat_lending.models.shared.bankfeedbankaccountmapping', 'BankFeedBankAccountMapping'), + 'BankFeedBankAccountMappingResponse': ('codat_lending.models.shared.bankfeedbankaccountmappingresponse', 'BankFeedBankAccountMappingResponse'), + 'BankFeedBankAccountMappingResponseTypedDict': ('codat_lending.models.shared.bankfeedbankaccountmappingresponse', 'BankFeedBankAccountMappingResponseTypedDict'), + 'BankFeedBankAccountMappingTypedDict': ('codat_lending.models.shared.bankfeedbankaccountmapping', 'BankFeedBankAccountMappingTypedDict'), + 'BankFeedMapping': ('codat_lending.models.shared.bankfeedmapping', 'BankFeedMapping'), + 'BankFeedMappingTypedDict': ('codat_lending.models.shared.bankfeedmapping', 'BankFeedMappingTypedDict'), + 'BankStatementUploadConfiguration': ('codat_lending.models.shared.bankstatementuploadconfiguration', 'BankStatementUploadConfiguration'), + 'BankStatementUploadConfigurationTypedDict': ('codat_lending.models.shared.bankstatementuploadconfiguration', 'BankStatementUploadConfigurationTypedDict'), + 'BankTransactionType': ('codat_lending.models.shared.banktransactiontype', 'BankTransactionType'), + 'BankingAccount': ('codat_lending.models.shared.bankingaccount', 'BankingAccount'), + 'BankingAccountBalance': ('codat_lending.models.shared.bankingaccountbalance', 'BankingAccountBalance'), + 'BankingAccountBalanceTypedDict': ('codat_lending.models.shared.bankingaccountbalance', 'BankingAccountBalanceTypedDict'), + 'BankingAccountBalances': ('codat_lending.models.shared.bankingaccountbalances', 'BankingAccountBalances'), + 'BankingAccountBalancesTypedDict': ('codat_lending.models.shared.bankingaccountbalances', 'BankingAccountBalancesTypedDict'), + 'BankingAccountTypedDict': ('codat_lending.models.shared.bankingaccount', 'BankingAccountTypedDict'), + 'BankingAccounts': ('codat_lending.models.shared.bankingaccounts', 'BankingAccounts'), + 'BankingAccountsTypedDict': ('codat_lending.models.shared.bankingaccounts', 'BankingAccountsTypedDict'), + 'BankingTransaction': ('codat_lending.models.shared.bankingtransaction', 'BankingTransaction'), + 'BankingTransactionCategories': ('codat_lending.models.shared.bankingtransactioncategories', 'BankingTransactionCategories'), + 'BankingTransactionCategoriesTypedDict': ('codat_lending.models.shared.bankingtransactioncategories', 'BankingTransactionCategoriesTypedDict'), + 'BankingTransactionCategory': ('codat_lending.models.shared.bankingtransactioncategory', 'BankingTransactionCategory'), + 'BankingTransactionCategoryTypedDict': ('codat_lending.models.shared.bankingtransactioncategory', 'BankingTransactionCategoryTypedDict'), + 'BankingTransactionRef': ('codat_lending.models.shared.bankingtransactionref', 'BankingTransactionRef'), + 'BankingTransactionRefTypedDict': ('codat_lending.models.shared.bankingtransactionref', 'BankingTransactionRefTypedDict'), + 'BankingTransactionTypedDict': ('codat_lending.models.shared.bankingtransaction', 'BankingTransactionTypedDict'), + 'BankingTransactions': ('codat_lending.models.shared.bankingtransactions', 'BankingTransactions'), + 'BankingTransactionsTypedDict': ('codat_lending.models.shared.bankingtransactions', 'BankingTransactionsTypedDict'), + 'BillCreditNoteLineItem': ('codat_lending.models.shared.billcreditnotelineitem', 'BillCreditNoteLineItem'), + 'BillCreditNoteLineItemTypedDict': ('codat_lending.models.shared.billcreditnotelineitem', 'BillCreditNoteLineItemTypedDict'), + 'BillCreditNoteStatus': ('codat_lending.models.shared.billcreditnotestatus', 'BillCreditNoteStatus'), + 'BillLineItem': ('codat_lending.models.bill_line_item', 'BillLineItem'), + 'BillLineItemDataType': ('codat_lending.models.shared.billlineitem', 'BillLineItemDataType'), + 'BillLineItemPurchaseOrderLineRef': ('codat_lending.models.bill_line_item_purchase_order_line_ref', 'BillLineItemPurchaseOrderLineRef'), + 'BillLineItemPurchaseOrderLineRefDataType': ('codat_lending.models.bill_line_item_purchase_order_line_ref_data_type', 'BillLineItemPurchaseOrderLineRefDataType'), + 'BillLineItemPurchaseOrderLineRefTypedDict': ('codat_lending.models.bill_line_item_purchase_order_line_ref', 'BillLineItemPurchaseOrderLineRefTypedDict'), + 'BillLineItemTypedDict': ('codat_lending.models.bill_line_item', 'BillLineItemTypedDict'), + 'BillPaymentLine': ('codat_lending.models.shared.billpaymentline', 'BillPaymentLine'), + 'BillPaymentLineLink': ('codat_lending.models.shared.billpaymentlinelink', 'BillPaymentLineLink'), + 'BillPaymentLineLinkType': ('codat_lending.models.shared.billpaymentlinelinktype', 'BillPaymentLineLinkType'), + 'BillPaymentLineLinkTypedDict': ('codat_lending.models.shared.billpaymentlinelink', 'BillPaymentLineLinkTypedDict'), + 'BillPaymentLineTypedDict': ('codat_lending.models.shared.billpaymentline', 'BillPaymentLineTypedDict'), + 'BillStatus': ('codat_lending.models.shared.billstatus', 'BillStatus'), + 'BilledToType': ('codat_lending.models.shared.billedtotype', 'BilledToType'), + 'BilledToType1': ('codat_lending.models.shared.billedtotype1', 'BilledToType1'), + 'CashFlowStatement': ('codat_lending.models.shared.cashflowstatement', 'CashFlowStatement'), + 'CashFlowStatementTypedDict': ('codat_lending.models.shared.cashflowstatement', 'CashFlowStatementTypedDict'), + 'CashFlowTransaction': ('codat_lending.models.cash_flow_transaction', 'CashFlowTransaction'), + 'CashFlowTransactionTypedDict': ('codat_lending.models.cash_flow_transaction', 'CashFlowTransactionTypedDict'), + 'CategorizedBankStatementAccounts': ('codat_lending.models.categorized_bank_statement_accounts', 'CategorizedBankStatementAccounts'), + 'CategorizedBankStatementAccountsTypedDict': ('codat_lending.models.categorized_bank_statement_accounts', 'CategorizedBankStatementAccountsTypedDict'), + 'CategorizedBankStatementTransactions': ('codat_lending.models.categorized_bank_statement_transactions', 'CategorizedBankStatementTransactions'), + 'CategorizedBankStatementTransactionsTypedDict': ('codat_lending.models.categorized_bank_statement_transactions', 'CategorizedBankStatementTransactionsTypedDict'), + 'ClientRateLimitWebhook': ('codat_lending.models.shared.clientratelimitwebhook', 'ClientRateLimitWebhook'), + 'ClientRateLimitWebhookPayload': ('codat_lending.models.shared.clientratelimitwebhookpayload', 'ClientRateLimitWebhookPayload'), + 'ClientRateLimitWebhookPayloadTypedDict': ('codat_lending.models.shared.clientratelimitwebhookpayload', 'ClientRateLimitWebhookPayloadTypedDict'), + 'ClientRateLimitWebhookTypedDict': ('codat_lending.models.shared.clientratelimitwebhook', 'ClientRateLimitWebhookTypedDict'), + 'CodatFile': ('codat_lending.models.shared.codatfile', 'CodatFile'), + 'CodatFileTypedDict': ('codat_lending.models.shared.codatfile', 'CodatFileTypedDict'), + 'CommerceAddress': ('codat_lending.models.shared.commerceaddress', 'CommerceAddress'), + 'CommerceAddressType': ('codat_lending.models.shared.commerceaddresstype', 'CommerceAddressType'), + 'CommerceAddressTypedDict': ('codat_lending.models.shared.commerceaddress', 'CommerceAddressTypedDict'), + 'CommerceCompanyInfo': ('codat_lending.models.shared.commercecompanyinfo', 'CommerceCompanyInfo'), + 'CommerceCompanyInfoTypedDict': ('codat_lending.models.shared.commercecompanyinfo', 'CommerceCompanyInfoTypedDict'), + 'CommerceCustomer': ('codat_lending.models.shared.commercecustomer', 'CommerceCustomer'), + 'CommerceCustomerRef': ('codat_lending.models.shared.commercecustomerref', 'CommerceCustomerRef'), + 'CommerceCustomerRefTypedDict': ('codat_lending.models.shared.commercecustomerref', 'CommerceCustomerRefTypedDict'), + 'CommerceCustomerTypedDict': ('codat_lending.models.shared.commercecustomer', 'CommerceCustomerTypedDict'), + 'CommerceCustomers': ('codat_lending.models.shared.commercecustomers', 'CommerceCustomers'), + 'CommerceCustomersTypedDict': ('codat_lending.models.shared.commercecustomers', 'CommerceCustomersTypedDict'), + 'CommerceDispute': ('codat_lending.models.shared.commercedispute', 'CommerceDispute'), + 'CommerceDisputeTypedDict': ('codat_lending.models.shared.commercedispute', 'CommerceDisputeTypedDict'), + 'CommerceDisputes': ('codat_lending.models.shared.commercedisputes', 'CommerceDisputes'), + 'CommerceDisputesTypedDict': ('codat_lending.models.shared.commercedisputes', 'CommerceDisputesTypedDict'), + 'CommerceLocation': ('codat_lending.models.shared.commercelocation', 'CommerceLocation'), + 'CommerceLocationTypedDict': ('codat_lending.models.shared.commercelocation', 'CommerceLocationTypedDict'), + 'CommerceLocations': ('codat_lending.models.shared.commercelocations', 'CommerceLocations'), + 'CommerceLocationsTypedDict': ('codat_lending.models.shared.commercelocations', 'CommerceLocationsTypedDict'), + 'CommerceOrder': ('codat_lending.models.shared.commerceorder', 'CommerceOrder'), + 'CommerceOrderTypedDict': ('codat_lending.models.shared.commerceorder', 'CommerceOrderTypedDict'), + 'CommerceOrders': ('codat_lending.models.shared.commerceorders', 'CommerceOrders'), + 'CommerceOrdersTypedDict': ('codat_lending.models.shared.commerceorders', 'CommerceOrdersTypedDict'), + 'CommercePayment': ('codat_lending.models.shared.commercepayment', 'CommercePayment'), + 'CommercePaymentMethod': ('codat_lending.models.shared.commercepaymentmethod', 'CommercePaymentMethod'), + 'CommercePaymentMethodStatus': ('codat_lending.models.commerce_payment_method_status', 'CommercePaymentMethodStatus'), + 'CommercePaymentMethodTypedDict': ('codat_lending.models.shared.commercepaymentmethod', 'CommercePaymentMethodTypedDict'), + 'CommercePaymentMethods': ('codat_lending.models.shared.commercepaymentmethods', 'CommercePaymentMethods'), + 'CommercePaymentMethodsTypedDict': ('codat_lending.models.shared.commercepaymentmethods', 'CommercePaymentMethodsTypedDict'), + 'CommercePaymentTypedDict': ('codat_lending.models.shared.commercepayment', 'CommercePaymentTypedDict'), + 'CommercePayments': ('codat_lending.models.shared.commercepayments', 'CommercePayments'), + 'CommercePaymentsTypedDict': ('codat_lending.models.shared.commercepayments', 'CommercePaymentsTypedDict'), + 'CommerceProduct': ('codat_lending.models.shared.commerceproduct', 'CommerceProduct'), + 'CommerceProductCategories': ('codat_lending.models.shared.commerceproductcategories', 'CommerceProductCategories'), + 'CommerceProductCategoriesTypedDict': ('codat_lending.models.shared.commerceproductcategories', 'CommerceProductCategoriesTypedDict'), + 'CommerceProductCategory': ('codat_lending.models.shared.commerceproductcategory', 'CommerceProductCategory'), + 'CommerceProductCategoryTypedDict': ('codat_lending.models.shared.commerceproductcategory', 'CommerceProductCategoryTypedDict'), + 'CommerceProductTypedDict': ('codat_lending.models.shared.commerceproduct', 'CommerceProductTypedDict'), + 'CommerceProducts': ('codat_lending.models.shared.commerceproducts', 'CommerceProducts'), + 'CommerceProductsTypedDict': ('codat_lending.models.shared.commerceproducts', 'CommerceProductsTypedDict'), + 'CommerceRecordRef': ('codat_lending.models.shared.commercerecordref', 'CommerceRecordRef'), + 'CommerceRecordRefTypedDict': ('codat_lending.models.shared.commercerecordref', 'CommerceRecordRefTypedDict'), + 'CommerceReport': ('codat_lending.models.shared.commercereport', 'CommerceReport'), + 'CommerceReportComponent': ('codat_lending.models.shared.commercereportcomponent', 'CommerceReportComponent'), + 'CommerceReportComponentTypedDict': ('codat_lending.models.shared.commercereportcomponent', 'CommerceReportComponentTypedDict'), + 'CommerceReportDimension': ('codat_lending.models.shared.commercereportdimension', 'CommerceReportDimension'), + 'CommerceReportDimensionItems': ('codat_lending.models.commerce_report_dimension_items', 'CommerceReportDimensionItems'), + 'CommerceReportDimensionItemsTypedDict': ('codat_lending.models.commerce_report_dimension_items', 'CommerceReportDimensionItemsTypedDict'), + 'CommerceReportDimensionTypedDict': ('codat_lending.models.shared.commercereportdimension', 'CommerceReportDimensionTypedDict'), + 'CommerceReportError': ('codat_lending.models.shared.commercereporterror', 'CommerceReportError'), + 'CommerceReportErrorTypedDict': ('codat_lending.models.shared.commercereporterror', 'CommerceReportErrorTypedDict'), + 'CommerceReportMeasure': ('codat_lending.models.shared.commercereportmeasure', 'CommerceReportMeasure'), + 'CommerceReportMeasureTypedDict': ('codat_lending.models.shared.commercereportmeasure', 'CommerceReportMeasureTypedDict'), + 'CommerceReportTypedDict': ('codat_lending.models.shared.commercereport', 'CommerceReportTypedDict'), + 'CommerceTaxComponent': ('codat_lending.models.commerce_tax_component', 'CommerceTaxComponent'), + 'CommerceTaxComponentTypedDict': ('codat_lending.models.commerce_tax_component', 'CommerceTaxComponentTypedDict'), + 'CommerceTransaction': ('codat_lending.models.shared.commercetransaction', 'CommerceTransaction'), + 'CommerceTransactionTypedDict': ('codat_lending.models.shared.commercetransaction', 'CommerceTransactionTypedDict'), + 'CommerceTransactions': ('codat_lending.models.shared.commercetransactions', 'CommerceTransactions'), + 'CommerceTransactionsTypedDict': ('codat_lending.models.shared.commercetransactions', 'CommerceTransactionsTypedDict'), + 'Companies': ('codat_lending.models.shared.companies', 'Companies'), + 'CompaniesTypedDict': ('codat_lending.models.shared.companies', 'CompaniesTypedDict'), + 'Company': ('codat_lending.models.shared.company', 'Company'), + 'CompanyDetails': ('codat_lending.models.company_details', 'CompanyDetails'), + 'CompanyDetailsTypedDict': ('codat_lending.models.company_details', 'CompanyDetailsTypedDict'), + 'CompanyReference': ('codat_lending.models.shared.companyreference', 'CompanyReference'), + 'CompanyReferenceLinks': ('codat_lending.models.company_reference_links', 'CompanyReferenceLinks'), + 'CompanyReferenceLinksTypedDict': ('codat_lending.models.company_reference_links', 'CompanyReferenceLinksTypedDict'), + 'CompanyReferenceTypedDict': ('codat_lending.models.shared.companyreference', 'CompanyReferenceTypedDict'), + 'CompanyRequestBody': ('codat_lending.models.shared.companyrequestbody', 'CompanyRequestBody'), + 'CompanyRequestBodyTypedDict': ('codat_lending.models.shared.companyrequestbody', 'CompanyRequestBodyTypedDict'), + 'CompanyTypedDict': ('codat_lending.models.shared.company', 'CompanyTypedDict'), + 'CompanyUpdateRequest': ('codat_lending.models.shared.companyupdaterequest', 'CompanyUpdateRequest'), + 'CompanyUpdateRequestTypedDict': ('codat_lending.models.shared.companyupdaterequest', 'CompanyUpdateRequestTypedDict'), + 'Connection': ('codat_lending.models.shared.connection', 'Connection'), + 'ConnectionTypedDict': ('codat_lending.models.shared.connection', 'ConnectionTypedDict'), + 'Connections': ('codat_lending.models.shared.connections', 'Connections'), + 'ConnectionsTypedDict': ('codat_lending.models.shared.connections', 'ConnectionsTypedDict'), + 'Contact': ('codat_lending.models.shared.contact', 'Contact'), + 'ContactRef': ('codat_lending.models.contact_ref', 'ContactRef'), + 'ContactRefDataType': ('codat_lending.models.shared.contactref', 'ContactRefDataType'), + 'ContactRefTypedDict': ('codat_lending.models.contact_ref', 'ContactRefTypedDict'), + 'ContactReference': ('codat_lending.models.contact_reference', 'ContactReference'), + 'ContactReferenceTypedDict': ('codat_lending.models.contact_reference', 'ContactReferenceTypedDict'), + 'ContactTypedDict': ('codat_lending.models.shared.contact', 'ContactTypedDict'), + 'CreateBankAccountTransaction': ('codat_lending.models.shared.createbankaccounttransaction', 'CreateBankAccountTransaction'), + 'CreateBankAccountTransactionTypedDict': ('codat_lending.models.shared.createbankaccounttransaction', 'CreateBankAccountTransactionTypedDict'), + 'CreateConnectionRequest': ('codat_lending.models.create_connection_request', 'CreateConnectionRequest'), + 'CreateConnectionRequestTypedDict': ('codat_lending.models.create_connection_request', 'CreateConnectionRequestTypedDict'), + 'CreateSourceAccount200Response': ('codat_lending.models.create_source_account200_response', 'CreateSourceAccount200Response'), + 'CreateSourceAccount200ResponseTypedDict': ('codat_lending.models.create_source_account200_response', 'CreateSourceAccount200ResponseTypedDict'), + 'CreateSourceAccountRequest': ('codat_lending.models.create_source_account_request', 'CreateSourceAccountRequest'), + 'CreateSourceAccountRequestTypedDict': ('codat_lending.models.create_source_account_request', 'CreateSourceAccountRequestTypedDict'), + 'CreatedDate': ('codat_lending.models.created_date', 'CreatedDate'), + 'CreatedDateTypedDict': ('codat_lending.models.created_date', 'CreatedDateTypedDict'), + 'CreditNoteLineItem': ('codat_lending.models.shared.creditnotelineitem', 'CreditNoteLineItem'), + 'CreditNoteLineItemTypedDict': ('codat_lending.models.shared.creditnotelineitem', 'CreditNoteLineItemTypedDict'), + 'CreditNoteStatus': ('codat_lending.models.shared.creditnotestatus', 'CreditNoteStatus'), + 'CurrentStatus': ('codat_lending.models.current_status', 'CurrentStatus'), + 'CustomerStatus': ('codat_lending.models.shared.customerstatus', 'CustomerStatus'), + 'DataConnectionError': ('codat_lending.models.shared.dataconnectionerror', 'DataConnectionError'), + 'DataConnectionErrorTypedDict': ('codat_lending.models.shared.dataconnectionerror', 'DataConnectionErrorTypedDict'), + 'DataConnectionStatus': ('codat_lending.models.shared.dataconnectionstatus', 'DataConnectionStatus'), + 'DataIntegrityAmounts': ('codat_lending.models.shared.dataintegrityamounts', 'DataIntegrityAmounts'), + 'DataIntegrityAmountsTypedDict': ('codat_lending.models.shared.dataintegrityamounts', 'DataIntegrityAmountsTypedDict'), + 'DataIntegrityByAmount': ('codat_lending.models.shared.dataintegritybyamount', 'DataIntegrityByAmount'), + 'DataIntegrityByAmountTypedDict': ('codat_lending.models.shared.dataintegritybyamount', 'DataIntegrityByAmountTypedDict'), + 'DataIntegrityByCount': ('codat_lending.models.shared.dataintegritybycount', 'DataIntegrityByCount'), + 'DataIntegrityByCountTypedDict': ('codat_lending.models.shared.dataintegritybycount', 'DataIntegrityByCountTypedDict'), + 'DataIntegrityConnectionID': ('codat_lending.models.shared.dataintegrityconnectionid', 'DataIntegrityConnectionId'), + 'DataIntegrityConnectionIDTypedDict': ('codat_lending.models.shared.dataintegrityconnectionid', 'DataIntegrityConnectionIdTypedDict'), + 'DataIntegrityConnectionId': ('codat_lending.models.shared.dataintegrityconnectionid', 'DataIntegrityConnectionId'), + 'DataIntegrityConnectionIdTypedDict': ('codat_lending.models.shared.dataintegrityconnectionid', 'DataIntegrityConnectionIdTypedDict'), + 'DataIntegrityDataType': ('codat_lending.models.shared.dataintegritydatatype', 'DataIntegrityDataType'), + 'DataIntegrityDates': ('codat_lending.models.shared.dataintegritydates', 'DataIntegrityDates'), + 'DataIntegrityDatesTypedDict': ('codat_lending.models.shared.dataintegritydates', 'DataIntegrityDatesTypedDict'), + 'DataIntegrityDetail': ('codat_lending.models.shared.dataintegritydetail', 'DataIntegrityDetail'), + 'DataIntegrityDetailTypedDict': ('codat_lending.models.shared.dataintegritydetail', 'DataIntegrityDetailTypedDict'), + 'DataIntegrityDetails': ('codat_lending.models.shared.dataintegritydetails', 'DataIntegrityDetails'), + 'DataIntegrityDetailsTypedDict': ('codat_lending.models.shared.dataintegritydetails', 'DataIntegrityDetailsTypedDict'), + 'DataIntegrityMatch': ('codat_lending.models.shared.dataintegritymatch', 'DataIntegrityMatch'), + 'DataIntegrityMatchTypedDict': ('codat_lending.models.shared.dataintegritymatch', 'DataIntegrityMatchTypedDict'), + 'DataIntegrityStatus': ('codat_lending.models.shared.dataintegritystatus', 'DataIntegrityStatus'), + 'DataIntegrityStatusInfo': ('codat_lending.models.shared.dataintegritystatusinfo', 'DataIntegrityStatusInfo'), + 'DataIntegrityStatusInfoTypedDict': ('codat_lending.models.shared.dataintegritystatusinfo', 'DataIntegrityStatusInfoTypedDict'), + 'DataIntegrityStatusTypedDict': ('codat_lending.models.shared.dataintegritystatus', 'DataIntegrityStatusTypedDict'), + 'DataIntegrityStatuses': ('codat_lending.models.shared.dataintegritystatuses', 'DataIntegrityStatuses'), + 'DataIntegrityStatusesTypedDict': ('codat_lending.models.shared.dataintegritystatuses', 'DataIntegrityStatusesTypedDict'), + 'DataIntegritySummaries': ('codat_lending.models.shared.dataintegritysummaries', 'DataIntegritySummaries'), + 'DataIntegritySummariesTypedDict': ('codat_lending.models.shared.dataintegritysummaries', 'DataIntegritySummariesTypedDict'), + 'DataIntegritySummary': ('codat_lending.models.shared.dataintegritysummary', 'DataIntegritySummary'), + 'DataIntegritySummaryTypedDict': ('codat_lending.models.shared.dataintegritysummary', 'DataIntegritySummaryTypedDict'), + 'DataIntegrityType': ('codat_lending.models.data_integrity_type', 'DataIntegrityType'), + 'DataIntegrityTypeTypedDict': ('codat_lending.models.data_integrity_type', 'DataIntegrityTypeTypedDict'), + 'DataSource': ('codat_lending.models.shared.datasource', 'DataSource'), + 'DataSourceTypedDict': ('codat_lending.models.shared.datasource', 'DataSourceTypedDict'), + 'DataStatus': ('codat_lending.models.shared.datastatus', 'DataStatus'), + 'DataStatusTypedDict': ('codat_lending.models.shared.datastatus', 'DataStatusTypedDict'), + 'DataStatuses': ('codat_lending.models.data_statuses', 'DataStatuses'), + 'DataStatusesTypedDict': ('codat_lending.models.data_statuses', 'DataStatusesTypedDict'), + 'DataType': ('codat_lending.models.shared.datatype', 'DataType'), + 'DataTypes': ('codat_lending.models.data_types', 'DataTypes'), + 'DatasetStatus': ('codat_lending.models.dataset_status', 'DatasetStatus'), + 'DirectCostLineItem': ('codat_lending.models.shared.directcostlineitem', 'DirectCostLineItem'), + 'DirectCostLineItemTypedDict': ('codat_lending.models.shared.directcostlineitem', 'DirectCostLineItemTypedDict'), + 'DirectCostPrototype': ('codat_lending.models.shared.directcostprototype', 'DirectCostPrototype'), + 'DirectCostPrototypeTypedDict': ('codat_lending.models.shared.directcostprototype', 'DirectCostPrototypeTypedDict'), + 'DirectIncomeLineItem': ('codat_lending.models.shared.directincomelineitem', 'DirectIncomeLineItem'), + 'DirectIncomeLineItemTypedDict': ('codat_lending.models.shared.directincomelineitem', 'DirectIncomeLineItemTypedDict'), + 'DisputeStatus': ('codat_lending.models.shared.disputestatus', 'DisputeStatus'), + 'EndUploadSessionRequest': ('codat_lending.models.shared.enduploadsessionrequest', 'EndUploadSessionRequest'), + 'EndUploadSessionRequestStatus': ('codat_lending.models.end_upload_session_request_status', 'EndUploadSessionRequestStatus'), + 'EndUploadSessionRequestTypedDict': ('codat_lending.models.shared.enduploadsessionrequest', 'EndUploadSessionRequestTypedDict'), + 'EnhancedCashFlowItem': ('codat_lending.models.shared.enhancedcashflowitem', 'EnhancedCashFlowItem'), + 'EnhancedCashFlowItemTypedDict': ('codat_lending.models.shared.enhancedcashflowitem', 'EnhancedCashFlowItemTypedDict'), + 'EnhancedCashFlowTransactions': ('codat_lending.models.shared.enhancedcashflowtransactions', 'EnhancedCashFlowTransactions'), + 'EnhancedCashFlowTransactionsTypedDict': ('codat_lending.models.shared.enhancedcashflowtransactions', 'EnhancedCashFlowTransactionsTypedDict'), + 'EnhancedFinancialReport': ('codat_lending.models.shared.enhancedfinancialreport', 'EnhancedFinancialReport'), + 'EnhancedFinancialReportTypedDict': ('codat_lending.models.shared.enhancedfinancialreport', 'EnhancedFinancialReportTypedDict'), + 'EnhancedInvoiceReportItem': ('codat_lending.models.shared.enhancedinvoicereportitem', 'EnhancedInvoiceReportItem'), + 'EnhancedInvoiceReportItemTypedDict': ('codat_lending.models.shared.enhancedinvoicereportitem', 'EnhancedInvoiceReportItemTypedDict'), + 'EnhancedInvoicesReport': ('codat_lending.models.shared.enhancedinvoicesreport', 'EnhancedInvoicesReport'), + 'EnhancedInvoicesReportTypedDict': ('codat_lending.models.shared.enhancedinvoicesreport', 'EnhancedInvoicesReportTypedDict'), + 'EnhancedReportAccountCategory': ('codat_lending.models.shared.enhancedreportaccountcategory', 'EnhancedReportAccountCategory'), + 'EnhancedReportAccountCategoryTypedDict': ('codat_lending.models.shared.enhancedreportaccountcategory', 'EnhancedReportAccountCategoryTypedDict'), + 'EnhancedReportInfo': ('codat_lending.models.shared.enhancedreportinfo', 'EnhancedReportInfo'), + 'EnhancedReportInfoTypedDict': ('codat_lending.models.shared.enhancedreportinfo', 'EnhancedReportInfoTypedDict'), + 'ErrorMessage': ('codat_lending.models.error_message', 'ErrorMessage'), + 'ErrorMessageTypedDict': ('codat_lending.models.error_message', 'ErrorMessageTypedDict'), + 'ErrorStatus': ('codat_lending.models.error_status', 'ErrorStatus'), + 'ErrorValidation': ('codat_lending.models.shared.errorvalidation', 'ErrorValidation'), + 'ErrorValidationItem': ('codat_lending.models.shared.errorvalidationitem', 'ErrorValidationItem'), + 'ErrorValidationItemTypedDict': ('codat_lending.models.shared.errorvalidationitem', 'ErrorValidationItemTypedDict'), + 'ErrorValidationTypedDict': ('codat_lending.models.shared.errorvalidation', 'ErrorValidationTypedDict'), + 'ExcelReportTypes': ('codat_lending.models.shared.excelreporttypes', 'ExcelReportTypes'), + 'ExcelStatus': ('codat_lending.models.shared.excelstatus', 'ExcelStatus'), + 'ExcelStatusTypedDict': ('codat_lending.models.shared.excelstatus', 'ExcelStatusTypedDict'), + 'File': ('codat_lending.models.shared.file', 'File'), + 'FileTypedDict': ('codat_lending.models.shared.file', 'FileTypedDict'), + 'FileUpload': ('codat_lending.models.shared.fileupload', 'FileUpload'), + 'FileUploadTypedDict': ('codat_lending.models.shared.fileupload', 'FileUploadTypedDict'), + 'FinancialSummary': ('codat_lending.models.financial_summary', 'FinancialSummary'), + 'FinancialSummaryAccountingScore': ('codat_lending.models.financial_summary_accounting_score', 'FinancialSummaryAccountingScore'), + 'FinancialSummaryAccountingScoreTypedDict': ('codat_lending.models.financial_summary_accounting_score', 'FinancialSummaryAccountingScoreTypedDict'), + 'FinancialSummaryBooksClosedDate': ('codat_lending.models.financial_summary_books_closed_date', 'FinancialSummaryBooksClosedDate'), + 'FinancialSummaryBooksClosedDateTypedDict': ('codat_lending.models.financial_summary_books_closed_date', 'FinancialSummaryBooksClosedDateTypedDict'), + 'FinancialSummaryTypedDict': ('codat_lending.models.financial_summary', 'FinancialSummaryTypedDict'), + 'GetReportStatusReportIdParameter': ('codat_lending.models.get_report_status_report_id_parameter', 'GetReportStatusReportIdParameter'), + 'GetReportStatusReportIdParameterTypedDict': ('codat_lending.models.get_report_status_report_id_parameter', 'GetReportStatusReportIdParameterTypedDict'), + 'HalRef': ('codat_lending.models.shared.halref', 'HalRef'), + 'HalRefTypedDict': ('codat_lending.models.shared.halref', 'HalRefTypedDict'), + 'IntegrityStatus': ('codat_lending.models.shared.integritystatus', 'IntegrityStatus'), + 'InvoiceLineItem': ('codat_lending.models.shared.invoicelineitem', 'InvoiceLineItem'), + 'InvoiceLineItemTypedDict': ('codat_lending.models.shared.invoicelineitem', 'InvoiceLineItemTypedDict'), + 'InvoiceStatus': ('codat_lending.models.shared.invoicestatus', 'InvoiceStatus'), + 'ItemRef': ('codat_lending.models.shared.itemref', 'ItemRef'), + 'ItemRefTypedDict': ('codat_lending.models.shared.itemref', 'ItemRefTypedDict'), + 'ItemReference': ('codat_lending.models.item_reference', 'ItemReference'), + 'ItemReferenceTypedDict': ('codat_lending.models.item_reference', 'ItemReferenceTypedDict'), + 'Items': ('codat_lending.models.shared.items', 'Items'), + 'ItemsTypedDict': ('codat_lending.models.shared.items', 'ItemsTypedDict'), + 'JournalEntryRecordRef': ('codat_lending.models.shared.journalentryrecordref', 'JournalEntryRecordRef'), + 'JournalEntryRecordRefDataType': ('codat_lending.models.journal_entry_record_ref_data_type', 'JournalEntryRecordRefDataType'), + 'JournalEntryRecordRefTypedDict': ('codat_lending.models.shared.journalentryrecordref', 'JournalEntryRecordRefTypedDict'), + 'JournalLine': ('codat_lending.models.journal_line', 'JournalLine'), + 'JournalLineDataType': ('codat_lending.models.shared.journalline', 'JournalLineDataType'), + 'JournalLineTracking': ('codat_lending.models.journal_line_tracking', 'JournalLineTracking'), + 'JournalLineTrackingDataType': ('codat_lending.models.journal_line_tracking_data_type', 'JournalLineTrackingDataType'), + 'JournalLineTrackingTypedDict': ('codat_lending.models.journal_line_tracking', 'JournalLineTrackingTypedDict'), + 'JournalLineTypedDict': ('codat_lending.models.journal_line', 'JournalLineTypedDict'), + 'JournalPrototype': ('codat_lending.models.journal_prototype', 'JournalPrototype'), + 'JournalPrototypeTypedDict': ('codat_lending.models.journal_prototype', 'JournalPrototypeTypedDict'), + 'JournalRef': ('codat_lending.models.shared.journalref', 'JournalRef'), + 'JournalRefTypedDict': ('codat_lending.models.shared.journalref', 'JournalRefTypedDict'), + 'JournalStatus': ('codat_lending.models.shared.journalstatus', 'JournalStatus'), + 'LendingCustomerRef': ('codat_lending.models.shared.lendingcustomerref', 'LendingCustomerRef'), + 'LendingCustomerRefTypedDict': ('codat_lending.models.shared.lendingcustomerref', 'LendingCustomerRefTypedDict'), + 'Links': ('codat_lending.models.shared.links', 'Links'), + 'LinksTypedDict': ('codat_lending.models.shared.links', 'LinksTypedDict'), + 'LoanRef': ('codat_lending.models.shared.loanref', 'LoanRef'), + 'LoanRefTypedDict': ('codat_lending.models.shared.loanref', 'LoanRefTypedDict'), + 'LoanSummary': ('codat_lending.models.shared.loansummary', 'LoanSummary'), + 'LoanSummaryIntegrationType': ('codat_lending.models.shared.loansummaryintegrationtype', 'LoanSummaryIntegrationType'), + 'LoanSummaryRecordRef': ('codat_lending.models.shared.loansummaryrecordref', 'LoanSummaryRecordRef'), + 'LoanSummaryRecordRefType': ('codat_lending.models.shared.loansummaryrecordreftype', 'LoanSummaryRecordRefType'), + 'LoanSummaryRecordRefTypedDict': ('codat_lending.models.shared.loansummaryrecordref', 'LoanSummaryRecordRefTypedDict'), + 'LoanSummaryReportInfo': ('codat_lending.models.shared.loansummaryreportinfo', 'LoanSummaryReportInfo'), + 'LoanSummaryReportInfoTypedDict': ('codat_lending.models.shared.loansummaryreportinfo', 'LoanSummaryReportInfoTypedDict'), + 'LoanSummaryReportItem': ('codat_lending.models.shared.loansummaryreportitem', 'LoanSummaryReportItem'), + 'LoanSummaryReportItemTypedDict': ('codat_lending.models.shared.loansummaryreportitem', 'LoanSummaryReportItemTypedDict'), + 'LoanSummaryTypedDict': ('codat_lending.models.shared.loansummary', 'LoanSummaryTypedDict'), + 'LoanTransactionType': ('codat_lending.models.loan_transaction_type', 'LoanTransactionType'), + 'LoanTransactions': ('codat_lending.models.shared.loantransactions', 'LoanTransactions'), + 'LoanTransactionsReportInfo': ('codat_lending.models.shared.loantransactionsreportinfo', 'LoanTransactionsReportInfo'), + 'LoanTransactionsReportInfoTypedDict': ('codat_lending.models.shared.loantransactionsreportinfo', 'LoanTransactionsReportInfoTypedDict'), + 'LoanTransactionsTypedDict': ('codat_lending.models.shared.loantransactions', 'LoanTransactionsTypedDict'), + 'LocationRef': ('codat_lending.models.shared.locationref', 'LocationRef'), + 'LocationRefTypedDict': ('codat_lending.models.shared.locationref', 'LocationRefTypedDict'), + 'Metadata': ('codat_lending.models.shared.metadata', 'Metadata'), + 'MetadataTypedDict': ('codat_lending.models.shared.metadata', 'MetadataTypedDict'), + 'Model0': ('codat_lending.models.model0', 'Model0'), + 'Model0TypedDict': ('codat_lending.models.model0', 'Model0TypedDict'), + 'Model3': ('codat_lending.models.model3', 'Model3'), + 'Model3TypedDict': ('codat_lending.models.model3', 'Model3TypedDict'), + 'OrderDiscountAllocation': ('codat_lending.models.shared.orderdiscountallocation', 'OrderDiscountAllocation'), + 'OrderDiscountAllocationTypedDict': ('codat_lending.models.shared.orderdiscountallocation', 'OrderDiscountAllocationTypedDict'), + 'OrderLineItem': ('codat_lending.models.shared.orderlineitem', 'OrderLineItem'), + 'OrderLineItemTypedDict': ('codat_lending.models.shared.orderlineitem', 'OrderLineItemTypedDict'), + 'PagingInfo': ('codat_lending.models.paging_info', 'PagingInfo'), + 'PagingInfoTypedDict': ('codat_lending.models.paging_info', 'PagingInfoTypedDict'), + 'Path': ('codat_lending.models.shared.path', 'Path'), + 'Payment': ('codat_lending.models.shared.payment', 'Payment'), + 'PaymentAllocationPayment': ('codat_lending.models.shared.paymentallocationpayment', 'PaymentAllocationPayment'), + 'PaymentAllocationPaymentTypedDict': ('codat_lending.models.shared.paymentallocationpayment', 'PaymentAllocationPaymentTypedDict'), + 'PaymentLine': ('codat_lending.models.shared.paymentline', 'PaymentLine'), + 'PaymentLineLink': ('codat_lending.models.shared.paymentlinelink', 'PaymentLineLink'), + 'PaymentLineLinkTypedDict': ('codat_lending.models.shared.paymentlinelink', 'PaymentLineLinkTypedDict'), + 'PaymentLineTypedDict': ('codat_lending.models.shared.paymentline', 'PaymentLineTypedDict'), + 'PaymentLinkType': ('codat_lending.models.shared.paymentlinktype', 'PaymentLinkType'), + 'PaymentMethodRef': ('codat_lending.models.shared.paymentmethodref', 'PaymentMethodRef'), + 'PaymentMethodRefTypedDict': ('codat_lending.models.shared.paymentmethodref', 'PaymentMethodRefTypedDict'), + 'PaymentMethodType': ('codat_lending.models.payment_method_type', 'PaymentMethodType'), + 'PaymentRef': ('codat_lending.models.shared.paymentref', 'PaymentRef'), + 'PaymentRefTypedDict': ('codat_lending.models.shared.paymentref', 'PaymentRefTypedDict'), + 'PaymentStatus': ('codat_lending.models.shared.paymentstatus', 'PaymentStatus'), + 'PaymentType': ('codat_lending.models.shared.paymenttype', 'PaymentType'), + 'PaymentTypedDict': ('codat_lending.models.shared.payment', 'PaymentTypedDict'), + 'PeriodUnit': ('codat_lending.models.shared.periodunit', 'PeriodUnit'), + 'PhoneNumber': ('codat_lending.models.phone_number', 'PhoneNumber'), + 'PhoneNumberType': ('codat_lending.models.shared.phonenumber', 'PhoneNumberType'), + 'PhoneNumberTypedDict': ('codat_lending.models.phone_number', 'PhoneNumberTypedDict'), + 'ProductInventory': ('codat_lending.models.shared.productinventory', 'ProductInventory'), + 'ProductInventoryLocation': ('codat_lending.models.shared.productinventorylocation', 'ProductInventoryLocation'), + 'ProductInventoryLocationTypedDict': ('codat_lending.models.shared.productinventorylocation', 'ProductInventoryLocationTypedDict'), + 'ProductInventoryTypedDict': ('codat_lending.models.shared.productinventory', 'ProductInventoryTypedDict'), + 'ProductPrice': ('codat_lending.models.shared.productprice', 'ProductPrice'), + 'ProductPriceTypedDict': ('codat_lending.models.shared.productprice', 'ProductPriceTypedDict'), + 'ProductRef': ('codat_lending.models.shared.productref', 'ProductRef'), + 'ProductRefTypedDict': ('codat_lending.models.shared.productref', 'ProductRefTypedDict'), + 'ProductVariant': ('codat_lending.models.shared.productvariant', 'ProductVariant'), + 'ProductVariantRef': ('codat_lending.models.shared.productvariantref', 'ProductVariantRef'), + 'ProductVariantRefTypedDict': ('codat_lending.models.shared.productvariantref', 'ProductVariantRefTypedDict'), + 'ProductVariantStatus': ('codat_lending.models.shared.productvariantstatus', 'ProductVariantStatus'), + 'ProductVariantTypedDict': ('codat_lending.models.shared.productvariant', 'ProductVariantTypedDict'), + 'ProfitAndLossReport': ('codat_lending.models.shared.profitandlossreport', 'ProfitAndLossReport'), + 'ProfitAndLossReportTypedDict': ('codat_lending.models.shared.profitandlossreport', 'ProfitAndLossReportTypedDict'), + 'ProjectRef': ('codat_lending.models.shared.projectref', 'ProjectRef'), + 'ProjectRefTypedDict': ('codat_lending.models.shared.projectref', 'ProjectRefTypedDict'), + 'PropertieAccountType': ('codat_lending.models.shared.propertie_accounttype', 'PropertieAccountType'), + 'PropertieItemRef': ('codat_lending.models.item_reference', 'ItemReference'), + 'PropertieItemRefTypedDict': ('codat_lending.models.item_reference', 'ItemReferenceTypedDict'), + 'PullOperation': ('codat_lending.models.shared.pulloperation', 'PullOperation'), + 'PullOperationTypedDict': ('codat_lending.models.shared.pulloperation', 'PullOperationTypedDict'), + 'PullOperations': ('codat_lending.models.shared.pulloperations', 'PullOperations'), + 'PullOperationsTypedDict': ('codat_lending.models.shared.pulloperations', 'PullOperationsTypedDict'), + 'PurchaseOrderReference': ('codat_lending.models.purchase_order_reference', 'PurchaseOrderReference'), + 'PurchaseOrderReferenceTypedDict': ('codat_lending.models.purchase_order_reference', 'PurchaseOrderReferenceTypedDict'), + 'PushChangeType': ('codat_lending.models.shared.pushchangetype', 'PushChangeType'), + 'PushFieldValidation': ('codat_lending.models.shared.pushfieldvalidation', 'PushFieldValidation'), + 'PushFieldValidationTypedDict': ('codat_lending.models.shared.pushfieldvalidation', 'PushFieldValidationTypedDict'), + 'PushOperation': ('codat_lending.models.shared.pushoperation', 'PushOperation'), + 'PushOperationChange': ('codat_lending.models.shared.pushoperationchange', 'PushOperationChange'), + 'PushOperationChangeTypedDict': ('codat_lending.models.shared.pushoperationchange', 'PushOperationChangeTypedDict'), + 'PushOperationRef': ('codat_lending.models.shared.pushoperationref', 'PushOperationRef'), + 'PushOperationRefTypedDict': ('codat_lending.models.shared.pushoperationref', 'PushOperationRefTypedDict'), + 'PushOperationStatus': ('codat_lending.models.shared.pushoperationstatus', 'PushOperationStatus'), + 'PushOperationTypedDict': ('codat_lending.models.shared.pushoperation', 'PushOperationTypedDict'), + 'PushOperations': ('codat_lending.models.shared.pushoperations', 'PushOperations'), + 'PushOperationsTypedDict': ('codat_lending.models.shared.pushoperations', 'PushOperationsTypedDict'), + 'PushOption': ('codat_lending.models.shared.pushoption', 'PushOption'), + 'PushOptionChoice': ('codat_lending.models.shared.pushoptionchoice', 'PushOptionChoice'), + 'PushOptionChoiceTypedDict': ('codat_lending.models.shared.pushoptionchoice', 'PushOptionChoiceTypedDict'), + 'PushOptionProperty': ('codat_lending.models.shared.pushoptionproperty', 'PushOptionProperty'), + 'PushOptionPropertyTypedDict': ('codat_lending.models.shared.pushoptionproperty', 'PushOptionPropertyTypedDict'), + 'PushOptionType': ('codat_lending.models.shared.pushoptiontype', 'PushOptionType'), + 'PushOptionTypedDict': ('codat_lending.models.shared.pushoption', 'PushOptionTypedDict'), + 'PushValidationInfo': ('codat_lending.models.shared.pushvalidationinfo', 'PushValidationInfo'), + 'PushValidationInfoTypedDict': ('codat_lending.models.shared.pushvalidationinfo', 'PushValidationInfoTypedDict'), + 'RecordLineReference': ('codat_lending.models.record_line_reference', 'RecordLineReference'), + 'RecordLineReferenceDataType': ('codat_lending.models.record_line_reference_data_type', 'RecordLineReferenceDataType'), + 'RecordLineReferenceTypedDict': ('codat_lending.models.record_line_reference', 'RecordLineReferenceTypedDict'), + 'ReportBasis': ('codat_lending.models.shared.reportbasis', 'ReportBasis'), + 'ReportComponentMeasure': ('codat_lending.models.shared.reportcomponentmeasure', 'ReportComponentMeasure'), + 'ReportComponentMeasureTypedDict': ('codat_lending.models.shared.reportcomponentmeasure', 'ReportComponentMeasureTypedDict'), + 'ReportGenerationPayload': ('codat_lending.models.shared.reportgenerationpayload', 'ReportGenerationPayload'), + 'ReportGenerationPayloadTypedDict': ('codat_lending.models.shared.reportgenerationpayload', 'ReportGenerationPayloadTypedDict'), + 'ReportInfo': ('codat_lending.models.shared.reportinfo', 'ReportInfo'), + 'ReportInfoTypedDict': ('codat_lending.models.shared.reportinfo', 'ReportInfoTypedDict'), + 'ReportInput': ('codat_lending.models.shared.reportinput', 'ReportInput'), + 'ReportItem': ('codat_lending.models.report_item', 'ReportItem'), + 'ReportItemTypedDict': ('codat_lending.models.report_item', 'ReportItemTypedDict'), + 'ReportItems': ('codat_lending.models.shared.reportitems', 'ReportItems'), + 'ReportItemsTypedDict': ('codat_lending.models.shared.reportitems', 'ReportItemsTypedDict'), + 'ReportLine': ('codat_lending.models.shared.reportline', 'ReportLine'), + 'ReportLineTypedDict': ('codat_lending.models.shared.reportline', 'ReportLineTypedDict'), + 'ReportOperation': ('codat_lending.models.shared.reportoperation', 'ReportOperation'), + 'ReportOperationStatus': ('codat_lending.models.report_operation_status', 'ReportOperationStatus'), + 'ReportOperationType': ('codat_lending.models.report_operation_type', 'ReportOperationType'), + 'ReportOperationTypedDict': ('codat_lending.models.shared.reportoperation', 'ReportOperationTypedDict'), + 'ReportSourceReference': ('codat_lending.models.report_source_reference', 'ReportSourceReference'), + 'ReportSourceReferenceTypedDict': ('codat_lending.models.report_source_reference', 'ReportSourceReferenceTypedDict'), + 'ReportType': ('codat_lending.models.shared.reporttype', 'ReportType'), + 'Reports': ('codat_lending.models.shared.reports', 'Reports'), + 'ReportsTypedDict': ('codat_lending.models.shared.reports', 'ReportsTypedDict'), + 'RoutingInfo': ('codat_lending.models.shared.routinginfo', 'RoutingInfo'), + 'RoutingInfoTypedDict': ('codat_lending.models.shared.routinginfo', 'RoutingInfoTypedDict'), + 'SalesOrderReference': ('codat_lending.models.sales_order_reference', 'SalesOrderReference'), + 'SalesOrderReferenceTypedDict': ('codat_lending.models.sales_order_reference', 'SalesOrderReferenceTypedDict'), + 'Schema': ('codat_lending.models.shared.schema', 'Schema'), + 'SchemaDataType': ('codat_lending.models.shared.schema_datatype', 'SchemaDataType'), + 'SchemaTypedDict': ('codat_lending.models.shared.schema', 'SchemaTypedDict'), + 'Security': ('codat_lending.models.shared.security', 'Security'), + 'SecurityTypedDict': ('codat_lending.models.shared.security', 'SecurityTypedDict'), + 'ServiceCharge': ('codat_lending.models.shared.servicecharge', 'ServiceCharge'), + 'ServiceChargeType': ('codat_lending.models.shared.servicechargetype', 'ServiceChargeType'), + 'ServiceChargeTypedDict': ('codat_lending.models.shared.servicecharge', 'ServiceChargeTypedDict'), + 'Source': ('codat_lending.models.source', 'Source'), + 'SourceAccount': ('codat_lending.models.shared.sourceaccount', 'SourceAccount'), + 'SourceAccountPrototype': ('codat_lending.models.shared.sourceaccountprototype', 'SourceAccountPrototype'), + 'SourceAccountPrototypeTypedDict': ('codat_lending.models.shared.sourceaccountprototype', 'SourceAccountPrototypeTypedDict'), + 'SourceAccountStatus': ('codat_lending.models.source_account_status', 'SourceAccountStatus'), + 'SourceAccountTypedDict': ('codat_lending.models.shared.sourceaccount', 'SourceAccountTypedDict'), + 'SourceAccountV2': ('codat_lending.models.source_account_v2', 'SourceAccountV2'), + 'SourceAccountV2AccountType': ('codat_lending.models.shared.sourceaccountv2', 'SourceAccountV2AccountType'), + 'SourceAccountV2Prototype': ('codat_lending.models.shared.sourceaccountv2prototype', 'SourceAccountV2Prototype'), + 'SourceAccountV2PrototypeTypedDict': ('codat_lending.models.shared.sourceaccountv2prototype', 'SourceAccountV2PrototypeTypedDict'), + 'SourceAccountV2Status': ('codat_lending.models.source_account_v2_status', 'SourceAccountV2Status'), + 'SourceAccountV2Type': ('codat_lending.models.source_account_v2_type', 'SourceAccountV2Type'), + 'SourceAccountV2TypedDict': ('codat_lending.models.source_account_v2', 'SourceAccountV2TypedDict'), + 'SourceRef': ('codat_lending.models.shared.sourceref', 'SourceRef'), + 'SourceRefTypedDict': ('codat_lending.models.shared.sourceref', 'SourceRefTypedDict'), + 'SourceType': ('codat_lending.models.source_type', 'SourceType'), + 'StartUploadSessionRequest': ('codat_lending.models.shared.startuploadsessionrequest', 'StartUploadSessionRequest'), + 'StartUploadSessionRequestDataType': ('codat_lending.models.start_upload_session_request_data_type', 'StartUploadSessionRequestDataType'), + 'StartUploadSessionRequestTypedDict': ('codat_lending.models.shared.startuploadsessionrequest', 'StartUploadSessionRequestTypedDict'), + 'Status': ('codat_lending.models.shared.status', 'Status'), + 'SupplementalData': ('codat_lending.models.shared.supplementaldata', 'SupplementalData'), + 'SupplementalDataTypedDict': ('codat_lending.models.shared.supplementaldata', 'SupplementalDataTypedDict'), + 'SupplierRef': ('codat_lending.models.shared.supplierref', 'SupplierRef'), + 'SupplierRefTypedDict': ('codat_lending.models.shared.supplierref', 'SupplierRefTypedDict'), + 'SupplierStatus': ('codat_lending.models.shared.supplierstatus', 'SupplierStatus'), + 'TargetAccountOption': ('codat_lending.models.shared.targetaccountoption', 'TargetAccountOption'), + 'TargetAccountOptionTypedDict': ('codat_lending.models.shared.targetaccountoption', 'TargetAccountOptionTypedDict'), + 'TaxComponentAllocation': ('codat_lending.models.shared.taxcomponentallocation', 'TaxComponentAllocation'), + 'TaxComponentAllocationTypedDict': ('codat_lending.models.shared.taxcomponentallocation', 'TaxComponentAllocationTypedDict'), + 'TaxComponentRef': ('codat_lending.models.shared.taxcomponentref', 'TaxComponentRef'), + 'TaxComponentRefTypedDict': ('codat_lending.models.shared.taxcomponentref', 'TaxComponentRefTypedDict'), + 'TaxRateRef': ('codat_lending.models.shared.taxrateref', 'TaxRateRef'), + 'TaxRateRefTypedDict': ('codat_lending.models.shared.taxrateref', 'TaxRateRefTypedDict'), + 'TaxRateReference': ('codat_lending.models.tax_rate_reference', 'TaxRateReference'), + 'TaxRateReferenceTypedDict': ('codat_lending.models.tax_rate_reference', 'TaxRateReferenceTypedDict'), + 'Tracking': ('codat_lending.models.shared.tracking', 'Tracking'), + 'TrackingCategoryRef': ('codat_lending.models.shared.trackingcategoryref', 'TrackingCategoryRef'), + 'TrackingCategoryRefTypedDict': ('codat_lending.models.shared.trackingcategoryref', 'TrackingCategoryRefTypedDict'), + 'TrackingRecordRef': ('codat_lending.models.tracking_record_ref', 'TrackingRecordRef'), + 'TrackingRecordRefDataType': ('codat_lending.models.shared.trackingrecordref', 'TrackingRecordRefDataType'), + 'TrackingRecordRefTypedDict': ('codat_lending.models.tracking_record_ref', 'TrackingRecordRefTypedDict'), + 'TrackingTypedDict': ('codat_lending.models.shared.tracking', 'TrackingTypedDict'), + 'TransactionCategory': ('codat_lending.models.shared.transactioncategory', 'TransactionCategory'), + 'TransactionCategoryRef': ('codat_lending.models.shared.transactioncategoryref', 'TransactionCategoryRef'), + 'TransactionCategoryRefTypedDict': ('codat_lending.models.shared.transactioncategoryref', 'TransactionCategoryRefTypedDict'), + 'TransactionCategoryStatus': ('codat_lending.models.shared.transactioncategorystatus', 'TransactionCategoryStatus'), + 'TransactionCategoryTypedDict': ('codat_lending.models.shared.transactioncategory', 'TransactionCategoryTypedDict'), + 'TransactionCode': ('codat_lending.models.shared.transactioncode', 'TransactionCode'), + 'TransactionSourceRef': ('codat_lending.models.shared.transactionsourceref', 'TransactionSourceRef'), + 'TransactionSourceRefTypedDict': ('codat_lending.models.shared.transactionsourceref', 'TransactionSourceRefTypedDict'), + 'TransactionSourceType': ('codat_lending.models.shared.transactionsourcetype', 'TransactionSourceType'), + 'TransactionType': ('codat_lending.models.shared.transactiontype', 'TransactionType'), + 'TransferAccount': ('codat_lending.models.shared.transferaccount', 'TransferAccount'), + 'TransferAccountTypedDict': ('codat_lending.models.shared.transferaccount', 'TransferAccountTypedDict'), + 'Type': ('codat_lending.models.type', 'Type'), + 'UpdateConnection': ('codat_lending.models.update_connection', 'UpdateConnection'), + 'UpdateConnectionTypedDict': ('codat_lending.models.update_connection', 'UpdateConnectionTypedDict'), + 'UploadBankStatementDataRequest': ('codat_lending.models.upload_bank_statement_data_request', 'UploadBankStatementDataRequest'), + 'UploadBankStatementDataRequestTypedDict': ('codat_lending.models.upload_bank_statement_data_request', 'UploadBankStatementDataRequestTypedDict'), + 'ValidDataTypeLinks': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinks'), + 'ValidDataTypeLinksTypedDict': ('codat_lending.models.valid_data_type_links', 'ValidDataTypeLinksTypedDict'), + 'Validation': ('codat_lending.models.shared.validation', 'Validation'), + 'ValidationItem': ('codat_lending.models.shared.validationitem', 'ValidationItem'), + 'ValidationItemTypedDict': ('codat_lending.models.shared.validationitem', 'ValidationItemTypedDict'), + 'ValidationTypedDict': ('codat_lending.models.shared.validation', 'ValidationTypedDict'), + 'WebLink': ('codat_lending.models.shared.weblink', 'WebLink'), + 'WebLinkType': ('codat_lending.models.web_link_type', 'WebLinkType'), + 'WebLinkTypedDict': ('codat_lending.models.shared.weblink', 'WebLinkTypedDict'), + 'WithholdingTax': ('codat_lending.models.withholding_tax', 'WithholdingTax'), + 'WithholdingTaxTypedDict': ('codat_lending.models.withholding_tax', 'WithholdingTaxTypedDict'), + 'Zero': ('codat_lending.models.record_line_reference', 'RecordLineReference'), + 'ZeroDataType': ('codat_lending.models.shared.zero', 'ZeroDataType'), + 'ZeroTypedDict': ('codat_lending.models.record_line_reference', 'RecordLineReferenceTypedDict'), } -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/lending/src/codat_lending/models/shared/accountbalance.py b/lending/src/codat_lending/models/shared/accountbalance.py index 66109991d..3bdcc8459 100644 --- a/lending/src/codat_lending/models/shared/accountbalance.py +++ b/lending/src/codat_lending/models/shared/accountbalance.py @@ -1,60 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import serialize_decimal, validate_decimal -from decimal import Decimal -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing import Any, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountBalanceTypedDict(TypedDict): - available: NotRequired[Decimal] - r"""The account's current balance""" - currency: NotRequired[str] - r"""The currency of the account""" - pending: NotRequired[Decimal] - r"""Funds that are not yet available in the balance""" - reserved: NotRequired[Any] - r"""Funds reserved as holdings""" + 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 AccountBalance(BaseModel): - available: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The account's current balance""" - - currency: Optional[str] = None - r"""The currency of the account""" - - pending: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Funds that are not yet available in the balance""" - reserved: Optional[Any] = None - r"""Funds reserved as holdings""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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 AccountBalance(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["available", "currency", "pending", "reserved"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AccountBalance + """ # noqa: E501 + available: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The account's current balance") + pending: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Funds that are not yet available in the balance") + reserved: Optional[Any] = None + currency: Optional[str] = Field(default=None, description="The currency of the account") + __properties: ClassVar[List[str]] = ["available", "pending", "reserved", "currency"] + + 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 AccountBalance 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)`: + + * `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, + ) + # set to None if reserved (nullable) is None + # and model_fields_set contains the field + if self.reserved is None and "reserved" in self.model_fields_set: + _dict['reserved'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountBalance from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "pending": obj.get("pending"), + "reserved": obj.get("reserved"), + "currency": obj.get("currency") + }) + return _obj + + + + + +class AccountBalanceTypedDict(TypedDict): + """TypedDict variant of AccountBalance, for dict-literal request/response inputs.""" + available: NotRequired[Optional[Decimal]] + pending: NotRequired[Optional[Decimal]] + reserved: NotRequired[Optional[Any]] + currency: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountbalanceamounts.py b/lending/src/codat_lending/models/shared/accountbalanceamounts.py index 91e2578f4..d9172a5d6 100644 --- a/lending/src/codat_lending/models/shared/accountbalanceamounts.py +++ b/lending/src/codat_lending/models/shared/accountbalanceamounts.py @@ -1,78 +1,126 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.utils import serialize_decimal, validate_decimal -from decimal import Decimal -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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountBalanceAmountsTypedDict(TypedDict): - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" + 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 - available: NotRequired[Nullable[Decimal]] - r"""The balance available in the account, including any pending transactions. This doesn't include additional funds available from any overdrafts.""" - current: NotRequired[Decimal] - r"""The balance of the account only including cleared transactions.""" - limit: NotRequired[Nullable[Decimal]] - r"""The minimum allowed balance for the account. For example, a $100.00 overdraft would show as a limit of `-100.00`.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountBalanceAmounts(BaseModel): - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" - - available: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""The balance available in the account, including any pending transactions. This doesn't include additional funds available from any overdrafts.""" - - current: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The balance of the account only including cleared transactions.""" - - limit: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""The minimum allowed balance for the account. For example, a $100.00 overdraft would show as a limit of `-100.00`.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["available", "current", "limit"]) - nullable_fields = set(["available", "limit"]) + 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 = {'available', 'limit'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Depending on the data provided by the underlying bank, not all balances are always available. + """ # noqa: E501 + available: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The balance available in the account, including any pending transactions. This doesn't include additional funds available from any overdrafts.") + current: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The balance of the account only including cleared transactions.") + limit: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The minimum allowed balance for the account. For example, a $100.00 overdraft would show as a limit of `-100.00`.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["available", "current", "limit"] + + 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 AccountBalanceAmounts 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 AccountBalanceAmounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "available": obj.get("available"), + "current": obj.get("current"), + "limit": obj.get("limit") + }) + # 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 AccountBalanceAmountsTypedDict(TypedDict): + """TypedDict variant of AccountBalanceAmounts, for dict-literal request/response inputs.""" + available: NotRequired[Optional[Decimal]] + current: NotRequired[Optional[Decimal]] + limit: NotRequired[Optional[Decimal]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhook.py b/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhook.py index 8b75e2e63..24bc1f124 100644 --- a/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhook.py +++ b/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhook.py @@ -1,108 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountcategoriesupdatedwebhookdata import ( - AccountCategoriesUpdatedWebhookData, - AccountCategoriesUpdatedWebhookDataTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountCategoriesUpdatedWebhookTypedDict(TypedDict): - r"""Webhook request body for the \"Account categories updated\" event.""" - - alert_id: NotRequired[str] - r"""Unique identifier of the webhook event.""" - client_id: NotRequired[str] - r"""Unique identifier for your client in Codat.""" - client_name: NotRequired[str] - r"""Name of your client in Codat.""" - company_id: NotRequired[str] - r"""Unique identifier for your SMB in Codat.""" - data: NotRequired[AccountCategoriesUpdatedWebhookDataTypedDict] - data_connection_id: NotRequired[str] - r"""Unique identifier for a company's data connection.""" - message: NotRequired[str] - r"""A human-readable message about the webhook.""" - rule_id: NotRequired[str] - r"""Unique identifier for the rule.""" - rule_type: NotRequired[str] - r"""The type of rule.""" +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountCategoriesUpdatedWebhook(BaseModel): - r"""Webhook request body for the \"Account categories updated\" event.""" - - alert_id: Annotated[Optional[str], pydantic.Field(alias="AlertId")] = None - r"""Unique identifier of the webhook event.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - client_id: Annotated[Optional[str], pydantic.Field(alias="ClientId")] = None - r"""Unique identifier for your client in Codat.""" + Do not edit the class manually. +""" # noqa: E501 - client_name: Annotated[Optional[str], pydantic.Field(alias="ClientName")] = None - r"""Name of your client in Codat.""" - company_id: Annotated[Optional[str], pydantic.Field(alias="CompanyId")] = None - r"""Unique identifier for your SMB in Codat.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - data: Annotated[ - Optional[AccountCategoriesUpdatedWebhookData], pydantic.Field(alias="Data") - ] = None +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.accountcategoriesupdatedwebhookdata import AccountCategoriesUpdatedWebhookData, AccountCategoriesUpdatedWebhookDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - data_connection_id: Annotated[ - Optional[str], pydantic.Field(alias="DataConnectionId") - ] = None - r"""Unique identifier for a company's data connection.""" +class AccountCategoriesUpdatedWebhook(BaseModel): - message: Annotated[Optional[str], pydantic.Field(alias="Message")] = None - r"""A human-readable message about the webhook.""" + @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} + """ + Webhook request body for the \"Account categories updated\" event. + """ # noqa: E501 + client_id: Optional[str] = Field(default=None, description="Unique identifier for your client in Codat.", alias="ClientId") + client_name: Optional[str] = Field(default=None, description="Name of your client in Codat.", alias="ClientName") + company_id: Optional[str] = Field(default=None, description="Unique identifier for your SMB in Codat.", alias="CompanyId") + data_connection_id: Optional[str] = Field(default=None, description="Unique identifier for a company's data connection.", alias="DataConnectionId") + rule_id: Optional[str] = Field(default=None, description="Unique identifier for the rule.", alias="RuleId") + rule_type: Optional[str] = Field(default=None, description="The type of rule.", alias="RuleType") + alert_id: Optional[str] = Field(default=None, description="Unique identifier of the webhook event.", alias="AlertId") + message: Optional[str] = Field(default=None, description="A human-readable message about the webhook.", alias="Message") + data: Optional[AccountCategoriesUpdatedWebhookData] = Field(default=None, alias="Data") + __properties: ClassVar[List[str]] = ["ClientId", "ClientName", "CompanyId", "DataConnectionId", "RuleId", "RuleType", "AlertId", "Message", "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 AccountCategoriesUpdatedWebhook 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 data + if self.data: + _dict['Data'] = self.data.to_dict() + return _dict - rule_id: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="RuleId", - ), - ] = None - r"""Unique identifier for the rule.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountCategoriesUpdatedWebhook from a dict""" + if obj is None: + return None - rule_type: Annotated[Optional[str], pydantic.Field(alias="RuleType")] = None - r"""The type of rule.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "AlertId", - "ClientId", - "ClientName", - "CompanyId", - "Data", - "DataConnectionId", - "Message", - "RuleId", - "RuleType", - ] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "ClientId": obj.get("ClientId"), + "ClientName": obj.get("ClientName"), + "CompanyId": obj.get("CompanyId"), + "DataConnectionId": obj.get("DataConnectionId"), + "RuleId": obj.get("RuleId"), + "RuleType": obj.get("RuleType"), + "AlertId": obj.get("AlertId"), + "Message": obj.get("Message"), + "Data": AccountCategoriesUpdatedWebhookData.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)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - AccountCategoriesUpdatedWebhook.model_rebuild() -except NameError: - pass +class AccountCategoriesUpdatedWebhookTypedDict(TypedDict): + """TypedDict variant of AccountCategoriesUpdatedWebhook, for dict-literal request/response inputs.""" + client_id: NotRequired[Optional[str]] + client_name: NotRequired[Optional[str]] + company_id: NotRequired[Optional[str]] + data_connection_id: NotRequired[Optional[str]] + rule_id: NotRequired[Optional[str]] + rule_type: NotRequired[Optional[str]] + alert_id: NotRequired[Optional[str]] + message: NotRequired[Optional[str]] + data: NotRequired[Optional[AccountCategoriesUpdatedWebhookDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhookdata.py b/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhookdata.py index a747a2e84..212033827 100644 --- a/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhookdata.py +++ b/lending/src/codat_lending/models/shared/accountcategoriesupdatedwebhookdata.py @@ -1,64 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountCategoriesUpdatedWebhookDataTypedDict(TypedDict): - modified_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 - ``` - """ + 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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountCategoriesUpdatedWebhookData(BaseModel): - modified_date: Annotated[ - OptionalNullable[str], pydantic.Field(alias="modifiedDate") - ] = 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 - ``` - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["modifiedDate"]) - nullable_fields = set(["modifiedDate"]) + 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: - AccountCategoriesUpdatedWebhookData.model_rebuild() -except NameError: - pass + _nullable = {'modifiedDate', 'modified_date'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + AccountCategoriesUpdatedWebhookData + """ # noqa: E501 + modified_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="modifiedDate") + __properties: ClassVar[List[str]] = ["modifiedDate"] + + 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 AccountCategoriesUpdatedWebhookData 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 AccountCategoriesUpdatedWebhookData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate") + }) + return _obj + + + + + +class AccountCategoriesUpdatedWebhookDataTypedDict(TypedDict): + """TypedDict variant of AccountCategoriesUpdatedWebhookData, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountcategorylevel.py b/lending/src/codat_lending/models/shared/accountcategorylevel.py index 4e2364f04..51d066cc1 100644 --- a/lending/src/codat_lending/models/shared/accountcategorylevel.py +++ b/lending/src/codat_lending/models/shared/accountcategorylevel.py @@ -1,57 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountCategoryLevelTypedDict(TypedDict): - r"""An object containing an ordered list of account category levels.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - confidence: NotRequired[Decimal] - r"""Confidence level of the category. This will only be populated where `status` is `Suggested`.""" - level_name: NotRequired[str] - r"""Account category name.""" + Do not edit the class manually. +""" # noqa: E501 -class AccountCategoryLevel(BaseModel): - r"""An object containing an ordered list of account category levels.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json - confidence: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Confidence level of the category. This will only be populated where `status` is `Suggested`.""" +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 - level_name: Annotated[Optional[str], pydantic.Field(alias="levelName")] = None - r"""Account category name.""" +class AccountCategoryLevel(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["confidence", "levelName"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + An object containing an ordered list of account category levels. + """ # noqa: E501 + level_name: Optional[str] = Field(default=None, description="Account category name.", alias="levelName") + confidence: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Confidence level of the category. This will only be populated where `status` is `Suggested`.") + __properties: ClassVar[List[str]] = ["levelName", "confidence"] + + 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 AccountCategoryLevel 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: - AccountCategoryLevel.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 AccountCategoryLevel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "levelName": obj.get("levelName"), + "confidence": obj.get("confidence") + }) + return _obj + + + + + +class AccountCategoryLevelTypedDict(TypedDict): + """TypedDict variant of AccountCategoryLevel, for dict-literal request/response inputs.""" + level_name: NotRequired[Optional[str]] + confidence: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/accountidentifiers.py b/lending/src/codat_lending/models/shared/accountidentifiers.py index 91fb39833..1d52eaf9f 100644 --- a/lending/src/codat_lending/models/shared/accountidentifiers.py +++ b/lending/src/codat_lending/models/shared/accountidentifiers.py @@ -1,109 +1,137 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountidentifiertype import AccountIdentifierType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountIdentifiersTypedDict(TypedDict): - r"""An object containing bank account identification information.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - type: AccountIdentifierType - r"""Type of account""" - bank_code: NotRequired[Nullable[str]] - r"""The local (usually national) routing number for the account. - - This is known by different names in different countries: - * BSB code (Australia) - * routing number (Canada, USA) - * sort code (UK) - """ - bic: NotRequired[Nullable[str]] - r"""The ISO 9362 code (commonly called SWIFT code, SWIFT-BIC or BIC) for the account.""" - iban: NotRequired[Nullable[str]] - r"""The international bank account number (IBAN) for the account, if known.""" - masked_account_number: NotRequired[Nullable[str]] - r"""A portion of the actual account `number` to help account identification where number is tokenised (Plaid only)""" - number: NotRequired[Nullable[str]] - r"""The account number for the account. When combined with the`bankCode`, this is usually enough to uniquely identify an account within a jurisdiction.""" - subtype: NotRequired[Nullable[str]] - r"""Detailed account category""" + 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_lending.models.shared.accountidentifiertype import AccountIdentifierType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountIdentifiers(BaseModel): - r"""An object containing bank account identification information.""" + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'bankCode', 'bank_code', 'bic', 'iban', 'maskedAccountNumber', 'masked_account_number', 'number', 'subtype'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + An object containing bank account identification information. + """ # noqa: E501 type: AccountIdentifierType - r"""Type of account""" - - bank_code: Annotated[OptionalNullable[str], pydantic.Field(alias="bankCode")] = ( - UNSET + subtype: OptionalNullable[str] = Field(default=UNSET, description="Detailed account category") + number: OptionalNullable[str] = Field(default=UNSET, description="The account number for the account. When combined with the`bankCode`, this is usually enough to uniquely identify an account within a jurisdiction.") + bank_code: OptionalNullable[str] = Field(default=UNSET, description="The local (usually national) routing number for the account. This is known by different names in different countries: * BSB code (Australia) * routing number (Canada, USA) * sort code (UK)", alias="bankCode") + iban: OptionalNullable[str] = Field(default=UNSET, description="The international bank account number (IBAN) for the account, if known.") + bic: OptionalNullable[str] = Field(default=UNSET, description="The ISO 9362 code (commonly called SWIFT code, SWIFT-BIC or BIC) for the account.") + masked_account_number: OptionalNullable[str] = Field(default=UNSET, description="A portion of the actual account `number` to help account identification where number is tokenised (Plaid only)", alias="maskedAccountNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "subtype", "number", "bankCode", "iban", "bic", "maskedAccountNumber"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""The local (usually national) routing number for the account. - This is known by different names in different countries: - * BSB code (Australia) - * routing number (Canada, USA) - * sort code (UK) - """ - bic: OptionalNullable[str] = UNSET - r"""The ISO 9362 code (commonly called SWIFT code, SWIFT-BIC or BIC) for the account.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - iban: OptionalNullable[str] = UNSET - r"""The international bank account number (IBAN) for the account, if known.""" + 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()) - masked_account_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="maskedAccountNumber") - ] = UNSET - r"""A portion of the actual account `number` to help account identification where number is tokenised (Plaid only)""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountIdentifiers from a JSON string""" + return cls.from_dict(json.loads(json_str)) - number: OptionalNullable[str] = UNSET - r"""The account number for the account. When combined with the`bankCode`, this is usually enough to uniquely identify an account within a jurisdiction.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - subtype: OptionalNullable[str] = UNSET - r"""Detailed account category""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["bankCode", "bic", "iban", "maskedAccountNumber", "number", "subtype"] - ) - nullable_fields = set( - ["bankCode", "bic", "iban", "maskedAccountNumber", "number", "subtype"] + * `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, ) - 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: - AccountIdentifiers.model_rebuild() -except NameError: - pass + # 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 AccountIdentifiers 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"), + "subtype": obj.get("subtype"), + "number": obj.get("number"), + "bankCode": obj.get("bankCode"), + "iban": obj.get("iban"), + "bic": obj.get("bic"), + "maskedAccountNumber": obj.get("maskedAccountNumber") + }) + # 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 AccountIdentifiersTypedDict(TypedDict): + """TypedDict variant of AccountIdentifiers, for dict-literal request/response inputs.""" + type: AccountIdentifierType + subtype: NotRequired[Optional[str]] + number: NotRequired[Optional[str]] + bank_code: NotRequired[Optional[str]] + iban: NotRequired[Optional[str]] + bic: NotRequired[Optional[str]] + masked_account_number: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/accountidentifiertype.py b/lending/src/codat_lending/models/shared/accountidentifiertype.py index f5fbfae24..9de67fb0d 100644 --- a/lending/src/codat_lending/models/shared/accountidentifiertype.py +++ b/lending/src/codat_lending/models/shared/accountidentifiertype.py @@ -1,16 +1,43 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 AccountIdentifierType(str, Enum): - r"""Type of account""" - - ACCOUNT = "Account" - CARD = "Card" - CREDIT = "Credit" - DEPOSITORY = "Depository" - INVESTMENT = "Investment" - LOAN = "Loan" - OTHER = "Other" + """ + Type of account + """ + + """ + allowed enum values + """ + ACCOUNT = 'Account' + CARD = 'Card' + CREDIT = 'Credit' + DEPOSITORY = 'Depository' + INVESTMENT = 'Investment' + LOAN = 'Loan' + OTHER = 'Other' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AccountIdentifierType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/accountinfo.py b/lending/src/codat_lending/models/shared/accountinfo.py index 5b1c2f4b2..cf872b5a2 100644 --- a/lending/src/codat_lending/models/shared/accountinfo.py +++ b/lending/src/codat_lending/models/shared/accountinfo.py @@ -1,94 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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_lending.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_lending.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/lending/src/codat_lending/models/shared/accountingaccount.py b/lending/src/codat_lending/models/shared/accountingaccount.py index 5bb4fd39f..14e5f5ae4 100644 --- a/lending/src/codat_lending/models/shared/accountingaccount.py +++ b/lending/src/codat_lending/models/shared/accountingaccount.py @@ -1,399 +1,169 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountstatus import AccountStatus -from .accounttype import AccountType -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingAccountValidDataTypeLinksTypedDict(TypedDict): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - - For example, `validDatatypeLinks` might indicate the following references: - - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. - - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - - ## `validDatatypeLinks` example - - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` - - - - ## Support for `validDatatypeLinks` - - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: NotRequired[Nullable[List[str]]] - r"""Supported `dataTypes` that the record can be linked to.""" - property: NotRequired[Nullable[str]] - r"""The property from the account that can be linked.""" - - -class AccountingAccountValidDataTypeLinks(BaseModel): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - - For example, `validDatatypeLinks` might indicate the following references: - - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. - - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - - ## `validDatatypeLinks` example - - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Support for `validDatatypeLinks` + Do not edit the class manually. +""" # noqa: E501 - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: OptionalNullable[List[str]] = UNSET - r"""Supported `dataTypes` that the record can be linked to.""" - - property: OptionalNullable[str] = UNSET - r"""The property from the account that can be linked.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountstatus import AccountStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.valid_data_type_links import ValidDataTypeLinks, ValidDataTypeLinksTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.models.shared.accounttype import AccountType +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingAccount(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["links", "property"]) - nullable_fields = set(["links", "property"]) + 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 AccountingAccountTypedDict(TypedDict): - r"""> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - - ## Overview - - Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - - The categories for an account include: - * Asset - * Expense - * Income - * Liability - * Equity. - - The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - - At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - - To determine the list of allowed categories for a specific integration, you can: - - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - - Refer to the integration's own documentation. - - > **Accounts with no category** - > - > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. - > - > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - """ - - 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. + _nullable = {'currentBalance', 'current_balance', 'description', 'fullyQualifiedCategory', 'fullyQualifiedName', 'fully_qualified_category', 'fully_qualified_name', 'name', 'nominalCode', 'nominal_code', 'validDatatypeLinks', 'valid_datatype_links'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - current_balance: NotRequired[Nullable[Decimal]] - r"""Current balance in the account.""" - description: NotRequired[Nullable[str]] - r"""Description for the account.""" - fully_qualified_category: NotRequired[Nullable[str]] - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. - """ - fully_qualified_name: NotRequired[Nullable[str]] - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - id: NotRequired[str] - r"""Identifier for the account, unique for the company.""" - is_bank_account: NotRequired[bool] - r"""Confirms whether the account is a bank account or not.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - name: NotRequired[Nullable[str]] - r"""Name of the account.""" - nominal_code: NotRequired[Nullable[str]] - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - source_modified_date: NotRequired[str] - status: NotRequired[AccountStatus] - r"""Status of the 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. - """ - type: NotRequired[AccountType] - r"""Type of account""" - valid_datatype_links: NotRequired[ - Nullable[List[AccountingAccountValidDataTypeLinksTypedDict]] - ] - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" - - -class AccountingAccount(BaseModel): - r"""> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - - ## Overview - - Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - - The categories for an account include: - * Asset - * Expense - * Income - * Liability - * Equity. - - The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - - At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - - To determine the list of allowed categories for a specific integration, you can: - - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - - Refer to the integration's own documentation. - - > **Accounts with no category** - > - > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. - > - > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - """ - - 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. - """ - - current_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currentBalance"), - ] = UNSET - r"""Current balance in the account.""" - - description: OptionalNullable[str] = UNSET - r"""Description for the account.""" - - fully_qualified_category: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedCategory") - ] = UNSET - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. - """ - - fully_qualified_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedName") - ] = UNSET - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - - id: Optional[str] = None - r"""Identifier for the account, unique for the company.""" - - is_bank_account: Annotated[ - Optional[bool], pydantic.Field(alias="isBankAccount") - ] = None - r"""Confirms whether the account is a bank account or not.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - name: OptionalNullable[str] = UNSET - r"""Name of the account.""" - - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - + > **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. ## Overview Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. The categories for an account include: * Asset * Expense * Income * Liability * Equity. The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. To determine the list of allowed categories for a specific integration, you can: - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - Refer to the integration's own documentation. > **Accounts with no category** > > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. > > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. + """ # noqa: E501 + nominal_code: OptionalNullable[str] = Field(default=UNSET, description="Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.", alias="nominalCode") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the account.") + description: OptionalNullable[str] = Field(default=UNSET, description="Description for the account.") + fully_qualified_category: OptionalNullable[str] = Field(default=UNSET, description="Full category of the account. For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation.", alias="fullyQualifiedCategory") + fully_qualified_name: OptionalNullable[str] = Field(default=UNSET, description="Full name of the account, for example: - `Cash On Hand` - `Rents Held In Trust` - `Fixed Asset`", alias="fullyQualifiedName") + 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.") + current_balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Current balance in the account.", alias="currentBalance") + type: Optional[AccountType] = Field(default=None, description="The type of bank account e.g. Credit.") status: Optional[AccountStatus] = None - r"""Status of the account""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - type: Optional[AccountType] = None - r"""Type of account""" - - valid_datatype_links: Annotated[ - OptionalNullable[List[AccountingAccountValidDataTypeLinks]], - pydantic.Field(alias="validDatatypeLinks"), - ] = UNSET - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "currency", - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "id", - "isBankAccount", - "metadata", - "modifiedDate", - "name", - "nominalCode", - "sourceModifiedDate", - "status", - "supplementalData", - "type", - "validDatatypeLinks", - ] - ) - nullable_fields = set( - [ - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "name", - "nominalCode", - "validDatatypeLinks", - ] + is_bank_account: Optional[bool] = Field(default=None, description="Confirms whether the account is a bank account or not.", alias="isBankAccount") + valid_datatype_links: OptionalNullable[List[ValidDataTypeLinks]] = Field(default=UNSET, description="The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).", alias="validDatatypeLinks") + 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") + id: Optional[str] = Field(default=None, description="Identifier for the account, unique for the company.") + metadata: Optional[Metadata] = None + __properties: ClassVar[List[str]] = ["nominalCode", "name", "description", "fullyQualifiedCategory", "fullyQualifiedName", "currency", "currentBalance", "type", "status", "isBankAccount", "validDatatypeLinks", "supplementalData", "modifiedDate", "sourceModifiedDate", "id", "metadata"] + + 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 AccountingAccount 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in valid_datatype_links (list) + _items = [] + if self.valid_datatype_links: + for _item_valid_datatype_links in self.valid_datatype_links: + if _item_valid_datatype_links: + _items.append(_item_valid_datatype_links.to_dict()) + _dict['validDatatypeLinks'] = _items + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "nominalCode": obj.get("nominalCode"), + "name": obj.get("name"), + "description": obj.get("description"), + "fullyQualifiedCategory": obj.get("fullyQualifiedCategory"), + "fullyQualifiedName": obj.get("fullyQualifiedName"), + "currency": obj.get("currency"), + "currentBalance": obj.get("currentBalance"), + "type": obj.get("type"), + "status": obj.get("status"), + "isBankAccount": obj.get("isBankAccount"), + "validDatatypeLinks": [ValidDataTypeLinks.from_dict(_item) for _item in obj["validDatatypeLinks"]] if obj.get("validDatatypeLinks") 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"), + "id": obj.get("id"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") 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 -try: - AccountingAccount.model_rebuild() -except NameError: - pass +class AccountingAccountTypedDict(TypedDict): + """TypedDict variant of AccountingAccount, for dict-literal request/response inputs.""" + nominal_code: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + fully_qualified_category: NotRequired[Optional[str]] + fully_qualified_name: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + current_balance: NotRequired[Optional[Decimal]] + type: NotRequired[Optional[AccountType]] + status: NotRequired[Optional[AccountStatus]] + is_bank_account: NotRequired[Optional[bool]] + valid_datatype_links: NotRequired[Optional[List[ValidDataTypeLinksTypedDict]]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingaccounts.py b/lending/src/codat_lending/models/shared/accountingaccounts.py index d389b609c..07842ef0f 100644 --- a/lending/src/codat_lending/models/shared/accountingaccounts.py +++ b/lending/src/codat_lending/models/shared/accountingaccounts.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingaccount import AccountingAccount, AccountingAccountTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingaccount import AccountingAccount, AccountingAccountTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingAccounts(BaseModel): -class AccountingAccountsTypedDict(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[AccountingAccountTypedDict]]] + @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} + """ + AccountingAccounts + """ # 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[AccountingAccount]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingAccounts(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 AccountingAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingAccount]]] = 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 AccountingAccounts 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": [AccountingAccount.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingAccounts.model_rebuild() -except NameError: - pass + + + + +class AccountingAccountsTypedDict(TypedDict): + """TypedDict variant of AccountingAccounts, 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[AccountingAccountTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingaccounttransaction.py b/lending/src/codat_lending/models/shared/accountingaccounttransaction.py index 9f7bdf88c..5b6a1fa62 100644 --- a/lending/src/codat_lending/models/shared/accountingaccounttransaction.py +++ b/lending/src/codat_lending/models/shared/accountingaccounttransaction.py @@ -1,315 +1,169 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accounttransactionline import ( - AccountTransactionLine, - AccountTransactionLineTypedDict, -) -from .bankaccountref import BankAccountRef, BankAccountRefTypedDict -from .metadata import Metadata, MetadataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingAccountTransactionStatus(str, Enum): - r"""The status of the account transaction.""" - - UNKNOWN = "Unknown" - UNRECONCILED = "Unreconciled" - RECONCILED = "Reconciled" - VOID = "Void" - - -class AccountingAccountTransactionTypedDict(TypedDict): - r"""> **Language tip:** In Codat, account transactions represent all transactions posted to a bank account within an accounting software. For bank transactions posted within a banking platform, refer to [Banking transactions](https://docs.codat.io/lending-api#/operations/list-all-banking-transactions). - - ## Overview - - In Codat’s data model, account transactions represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Account transactions are created as a result of different business activities, for example: - - * Payments: for example, receiving money for payment against an invoice. - * Bill payments: for example, spending money for a payment against a bill. - * Direct costs: for example, withdrawing money from a bank account, either for cash purposes or to make a payment. - * Direct incomes: for example, selling an item directly to a contact and receiving payment at point of sale. - * Transfers: for example, transferring money between two bank accounts. - - Account transactions is the parent data type of [payments](https://docs.codat.io/lending-api#/schemas/Payment), [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment), [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost), [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome), and [transfers](https://docs.codat.io/lending-api#/schemas/Transfer). - """ - - bank_account_ref: NotRequired[BankAccountRefTypedDict] - r"""Links to the Account transactions data type.""" - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. +""" + Lending - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - 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. - """ - id: NotRequired[str] - r"""Identifier of the direct cost (unique to the company).""" - lines: NotRequired[Nullable[List[AccountTransactionLineTypedDict]]] - r"""Array of account transaction lines.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Additional information about the account transaction, if available.""" - source_modified_date: NotRequired[str] - status: NotRequired[AccountingAccountTransactionStatus] - r"""The status of the account transaction.""" - total_amount: NotRequired[Decimal] - r"""Total amount of the account transactions, inclusive of tax.""" - transaction_id: NotRequired[Nullable[str]] - r"""Identifier of the transaction (unique to the company).""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +from codat_lending.models.accounting_account_transaction_status import AccountingAccountTransactionStatus +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_lending.models.shared.accounttransactionline import AccountTransactionLine, AccountTransactionLineTypedDict +from codat_lending.models.shared.bankaccountref import BankAccountRef, BankAccountRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingAccountTransaction(BaseModel): - r"""> **Language tip:** In Codat, account transactions represent all transactions posted to a bank account within an accounting software. For bank transactions posted within a banking platform, refer to [Banking transactions](https://docs.codat.io/lending-api#/operations/list-all-banking-transactions). - ## Overview - - In Codat’s data model, account transactions represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. - - Account transactions are created as a result of different business activities, for example: - - * Payments: for example, receiving money for payment against an invoice. - * Bill payments: for example, spending money for a payment against a bill. - * Direct costs: for example, withdrawing money from a bank account, either for cash purposes or to make a payment. - * Direct incomes: for example, selling an item directly to a contact and receiving payment at point of sale. - * Transfers: for example, transferring money between two bank accounts. - - Account transactions is the parent data type of [payments](https://docs.codat.io/lending-api#/schemas/Payment), [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment), [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost), [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome), and [transfers](https://docs.codat.io/lending-api#/schemas/Transfer). - """ - - bank_account_ref: Annotated[ - Optional[BankAccountRef], pydantic.Field(alias="bankAccountRef") - ] = None - r"""Links to the Account transactions data type.""" - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - 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: - - ``` - 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 = {'currencyRate', 'currency_rate', 'lines', 'note', 'transactionId', 'transaction_id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - id: Optional[str] = None - r"""Identifier of the direct cost (unique to the company).""" - - lines: OptionalNullable[List[AccountTransactionLine]] = UNSET - r"""Array of account transaction lines.""" - + > **Language tip:** In Codat, account transactions represent all transactions posted to a bank account within an accounting software. For bank transactions posted within a banking platform, refer to [Banking transactions](https://docs.codat.io/lending-api#/operations/list-all-banking-transactions). ## Overview In Codat’s data model, account transactions represent bank activity within an accounting software. All transactions that go through a bank account are recorded as account transactions. Account transactions are created as a result of different business activities, for example: * Payments: for example, receiving money for payment against an invoice. * Bill payments: for example, spending money for a payment against a bill. * Direct costs: for example, withdrawing money from a bank account, either for cash purposes or to make a payment. * Direct incomes: for example, selling an item directly to a contact and receiving payment at point of sale. * Transfers: for example, transferring money between two bank accounts. Account transactions is the parent data type of [payments](https://docs.codat.io/lending-api#/schemas/Payment), [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment), [direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost), [direct incomes](https://docs.codat.io/lending-api#/schemas/DirectIncome), and [transfers](https://docs.codat.io/lending-api#/schemas/Transfer). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier of the direct cost (unique to the company).") + transaction_id: OptionalNullable[str] = Field(default=UNSET, description="Identifier of the transaction (unique to the company).", alias="transactionId") + note: OptionalNullable[str] = Field(default=UNSET, description="Additional information about the account transaction, if available.") + bank_account_ref: Optional[BankAccountRef] = Field(default=None, description="Reference to the bank account the account transaction is recorded against.", alias="bankAccountRef") + 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="date") + status: Optional[AccountingAccountTransactionStatus] = Field(default=None, description="The status of the account transaction.") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + lines: OptionalNullable[List[AccountTransactionLine]] = Field(default=UNSET, description="Array of account transaction lines.") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of the account transactions, inclusive of tax.", alias="totalAmount") metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Additional information about the account transaction, if available.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - status: Optional[AccountingAccountTransactionStatus] = None - r"""The status of the account transaction.""" - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount of the account transactions, inclusive of tax.""" - - transaction_id: Annotated[ - OptionalNullable[str], pydantic.Field(alias="transactionId") - ] = UNSET - r"""Identifier of the transaction (unique to the company).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "bankAccountRef", - "currency", - "currencyRate", - "date", - "id", - "lines", - "metadata", - "modifiedDate", - "note", - "sourceModifiedDate", - "status", - "totalAmount", - "transactionId", - ] + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "transactionId", "note", "bankAccountRef", "date", "status", "currency", "currencyRate", "lines", "totalAmount", "metadata"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Unreconciled', 'Reconciled', 'Void']): + raise ValueError("must be one of enum values ('Unknown', 'Unreconciled', 'Reconciled', 'Void')") + 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 AccountingAccountTransaction 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, ) - nullable_fields = set(["currencyRate", "lines", "note", "transactionId"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of bank_account_ref + if self.bank_account_ref: + _dict['bankAccountRef'] = self.bank_account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in lines (list) + _items = [] + if self.lines: + for _item_lines in self.lines: + if _item_lines: + _items.append(_item_lines.to_dict()) + _dict['lines'] = _items + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAccountTransaction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "transactionId": obj.get("transactionId"), + "note": obj.get("note"), + "bankAccountRef": BankAccountRef.from_dict(obj["bankAccountRef"]) if obj.get("bankAccountRef") is not None else None, + "date": obj.get("date"), + "status": obj.get("status"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lines": [AccountTransactionLine.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None, + "totalAmount": obj.get("totalAmount"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") 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 -try: - AccountingAccountTransaction.model_rebuild() -except NameError: - pass +class AccountingAccountTransactionTypedDict(TypedDict): + """TypedDict variant of AccountingAccountTransaction, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + transaction_id: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + bank_account_ref: NotRequired[Optional[BankAccountRefTypedDict]] + date_: NotRequired[Optional[str]] + status: NotRequired[Optional[AccountingAccountTransactionStatus]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + lines: NotRequired[Optional[List[AccountTransactionLineTypedDict]]] + total_amount: NotRequired[Optional[Decimal]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingaccounttransactions.py b/lending/src/codat_lending/models/shared/accountingaccounttransactions.py index b0a8314bf..15f3c48e0 100644 --- a/lending/src/codat_lending/models/shared/accountingaccounttransactions.py +++ b/lending/src/codat_lending/models/shared/accountingaccounttransactions.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingaccounttransaction import ( - AccountingAccountTransaction, - AccountingAccountTransactionTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingaccounttransaction import AccountingAccountTransaction, AccountingAccountTransactionTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingAccountTransactions(BaseModel): -class AccountingAccountTransactionsTypedDict(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[AccountingAccountTransactionTypedDict]]] + @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} + """ + AccountingAccountTransactions + """ # 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[AccountingAccountTransaction]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingAccountTransactions(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 AccountingAccountTransactions from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingAccountTransaction]]] = 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 AccountingAccountTransactions 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": [AccountingAccountTransaction.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingAccountTransactions.model_rebuild() -except NameError: - pass + + + + +class AccountingAccountTransactionsTypedDict(TypedDict): + """TypedDict variant of AccountingAccountTransactions, 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[AccountingAccountTransactionTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingaddress.py b/lending/src/codat_lending/models/shared/accountingaddress.py index 3f27e2614..067605ce6 100644 --- a/lending/src/codat_lending/models/shared/accountingaddress.py +++ b/lending/src/codat_lending/models/shared/accountingaddress.py @@ -1,91 +1,123 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingaddresstype import AccountingAddressType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountingAddressTypedDict(TypedDict): - type: AccountingAddressType - r"""The type of the address""" - city: NotRequired[Nullable[str]] - r"""City of the customer address.""" - country: NotRequired[Nullable[str]] - r"""Country of the customer address.""" - line1: NotRequired[Nullable[str]] - r"""Line 1 of the customer address.""" - line2: NotRequired[Nullable[str]] - r"""Line 2 of the customer address.""" - postal_code: NotRequired[Nullable[str]] - r"""Postal code or zip code.""" - region: NotRequired[Nullable[str]] - r"""Region of the customer address.""" + 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_lending.models.shared.accountingaddresstype import AccountingAddressType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingAddress(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'city', 'country', 'line1', 'line2', 'postalCode', 'postal_code', 'region'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + AccountingAddress + """ # noqa: E501 type: AccountingAddressType - r"""The type of the address""" + line1: OptionalNullable[str] = Field(default=UNSET, description="Line 1 of the customer address.") + line2: OptionalNullable[str] = Field(default=UNSET, description="Line 2 of the customer address.") + city: OptionalNullable[str] = Field(default=UNSET, description="City of the customer address.") + region: OptionalNullable[str] = Field(default=UNSET, description="Region of the customer address.") + country: OptionalNullable[str] = Field(default=UNSET, description="Country of the customer address.") + postal_code: OptionalNullable[str] = Field(default=UNSET, description="Postal code or zip code.", alias="postalCode") + __properties: ClassVar[List[str]] = ["type", "line1", "line2", "city", "region", "country", "postalCode"] + + 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 AccountingAddress 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 - city: OptionalNullable[str] = UNSET - r"""City of the customer address.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAddress from a dict""" + if obj is None: + return None - country: OptionalNullable[str] = UNSET - r"""Country of the customer address.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - line1: OptionalNullable[str] = UNSET - r"""Line 1 of the customer address.""" + _obj = cls.model_validate({ + "type": obj.get("type"), + "line1": obj.get("line1"), + "line2": obj.get("line2"), + "city": obj.get("city"), + "region": obj.get("region"), + "country": obj.get("country"), + "postalCode": obj.get("postalCode") + }) + return _obj - line2: OptionalNullable[str] = UNSET - r"""Line 2 of the customer address.""" - postal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="postalCode") - ] = UNSET - r"""Postal code or zip code.""" - region: OptionalNullable[str] = UNSET - r"""Region of the customer address.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["city", "country", "line1", "line2", "postalCode", "region"] - ) - nullable_fields = set( - ["city", "country", "line1", "line2", "postalCode", "region"] - ) - 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: - AccountingAddress.model_rebuild() -except NameError: - pass + +class AccountingAddressTypedDict(TypedDict): + """TypedDict variant of AccountingAddress, for dict-literal request/response inputs.""" + type: AccountingAddressType + line1: NotRequired[Optional[str]] + line2: NotRequired[Optional[str]] + city: NotRequired[Optional[str]] + region: NotRequired[Optional[str]] + country: NotRequired[Optional[str]] + postal_code: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountingaddresstype.py b/lending/src/codat_lending/models/shared/accountingaddresstype.py index 4d5a97871..ab69249e0 100644 --- a/lending/src/codat_lending/models/shared/accountingaddresstype.py +++ b/lending/src/codat_lending/models/shared/accountingaddresstype.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 AccountingAddressType(str, Enum): - r"""The type of the address""" + """ + The type of the address + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + BILLING = 'Billing' + DELIVERY = 'Delivery' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AccountingAddressType from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - BILLING = "Billing" - DELIVERY = "Delivery" diff --git a/lending/src/codat_lending/models/shared/accountingagedcreditorreport.py b/lending/src/codat_lending/models/shared/accountingagedcreditorreport.py index ffebd3472..ab8248eca 100644 --- a/lending/src/codat_lending/models/shared/accountingagedcreditorreport.py +++ b/lending/src/codat_lending/models/shared/accountingagedcreditorreport.py @@ -1,195 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .agedcreditor import AgedCreditor, AgedCreditorTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingAgedCreditorReportTypedDict(TypedDict): - r"""The Aged Creditors report shows the total balance owed by a business to its suppliers over time. - - You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - - Total assets or liabilities are grouped into 30-day periods for each supplier, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - - > It is not guaranteed that write-offs are included in the Aged Creditors report. - - ## Underlying data +""" + Lending - The Aged Creditors report is generated from a set of required data types: [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier), [Bills](https://docs.codat.io/lending-api#/schemas/Bill), [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote), and [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). - - To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - - > The Aged Creditor report runs based on the **issue dates** of the underlying data types rather than the due date. - - ## Accessing the Aged Creditors report in Portal - - Apart from returning the report via the API as JSON and query, you can also return the Aged Creditors report in the Codat portal. - - 1. In the navigation bar, click **Companies**. - 2. Click the name of the company you want to generate the report for. The company's data page is displayed. - 3. Click the **Accounting** tab then click **Reports**. - 4. Select **Aged Creditors**. - 5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). - 6. To run the report, click **Load aged creditors**. - 7. The report is generated and displayed at the bottom of the page. - - The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding bills or bill credit notes. - """ + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - data: NotRequired[List[AgedCreditorTypedDict]] - r"""Array of aged creditor.""" - generated: 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: - - - 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. - """ - report_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. - """ - +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.agedcreditor import AgedCreditor, AgedCreditorTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AccountingAgedCreditorReport(BaseModel): - r"""The Aged Creditors report shows the total balance owed by a business to its suppliers over time. - - You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - - Total assets or liabilities are grouped into 30-day periods for each supplier, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - - > It is not guaranteed that write-offs are included in the Aged Creditors report. - - ## Underlying data - - The Aged Creditors report is generated from a set of required data types: [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier), [Bills](https://docs.codat.io/lending-api#/schemas/Bill), [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote), and [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). - - To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - - > The Aged Creditor report runs based on the **issue dates** of the underlying data types rather than the due date. - - ## Accessing the Aged Creditors report in Portal - - Apart from returning the report via the API as JSON and query, you can also return the Aged Creditors report in the Codat portal. - - 1. In the navigation bar, click **Companies**. - 2. Click the name of the company you want to generate the report for. The company's data page is displayed. - 3. Click the **Accounting** tab then click **Reports**. - 4. Select **Aged Creditors**. - 5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). - 6. To run the report, click **Load aged creditors**. - 7. The report is generated and displayed at the bottom of the page. - - The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding bills or bill credit notes. - """ - - data: Optional[List[AgedCreditor]] = None - r"""Array of aged creditor.""" - - generated: 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. - """ - - report_date: Annotated[Optional[str], pydantic.Field(alias="reportDate")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["data", "generated", "reportDate"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The Aged Creditors report shows the total balance owed by a business to its suppliers over time. You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. Total assets or liabilities are grouped into 30-day periods for each supplier, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. > It is not guaranteed that write-offs are included in the Aged Creditors report. ## Underlying data The Aged Creditors report is generated from a set of required data types: [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier), [Bills](https://docs.codat.io/lending-api#/schemas/Bill), [Bill credit notes](https://docs.codat.io/lending-api#/schemas/BillCreditNote), and [Bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. > The Aged Creditor report runs based on the **issue dates** of the underlying data types rather than the due date. ## Accessing the Aged Creditors report in Portal Apart from returning the report via the API as JSON and query, you can also return the Aged Creditors report in the Codat portal. 1. In the navigation bar, click **Companies**. 2. Click the name of the company you want to generate the report for. The company's data page is displayed. 3. Click the **Accounting** tab then click **Reports**. 4. Select **Aged Creditors**. 5. _(Optional)_ Edit the default reporting parameters. a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). 6. To run the report, click **Load aged creditors**. 7. The report is generated and displayed at the bottom of the page. The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding bills or bill credit notes. + """ # noqa: E501 + generated: 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.") + report_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="reportDate") + data: Optional[List[AgedCreditor]] = Field(default=None, description="Array of aged creditor.") + __properties: ClassVar[List[str]] = ["generated", "reportDate", "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 AccountingAgedCreditorReport 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAgedCreditorReport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "generated": obj.get("generated"), + "reportDate": obj.get("reportDate"), + "data": [AgedCreditor.from_dict(_item) for _item in 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)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - AccountingAgedCreditorReport.model_rebuild() -except NameError: - pass +class AccountingAgedCreditorReportTypedDict(TypedDict): + """TypedDict variant of AccountingAgedCreditorReport, for dict-literal request/response inputs.""" + generated: NotRequired[Optional[str]] + report_date: NotRequired[Optional[str]] + data: NotRequired[Optional[List[AgedCreditorTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/accountingageddebtorreport.py b/lending/src/codat_lending/models/shared/accountingageddebtorreport.py index ace53cbfa..4d1e31aa7 100644 --- a/lending/src/codat_lending/models/shared/accountingageddebtorreport.py +++ b/lending/src/codat_lending/models/shared/accountingageddebtorreport.py @@ -1,195 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .ageddebtor import AgedDebtor, AgedDebtorTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingAgedDebtorReportTypedDict(TypedDict): - r"""The Aged Debtors report shows the total outstanding balance due from customers to the business over time. - - You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - - Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - - > It is not guaranteed that write-offs are included in the Aged Debtors report. - - ## Underlying data +""" + Lending - The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). - - To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - - > The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. - - ## Accessing the Aged Debtors report in Portal - - Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. - - 1. In the navigation bar, click **Companies**. - 2. Click the name of the company you want to generate the report for. The company's data page is displayed. - 3. Click the **Accounting** tab then click **Reports**. - 4. Select **Aged Debtors**. - 5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). - 6. To run the report, click **Load aged debtors**. - 7. The report is generated and displayed at the bottom of the page. - - The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes. - """ + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - data: NotRequired[List[AgedDebtorTypedDict]] - r"""Array of aged debtors.""" - generated: 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: - - - 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. - """ - report_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. - """ - +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.ageddebtor import AgedDebtor, AgedDebtorTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AccountingAgedDebtorReport(BaseModel): - r"""The Aged Debtors report shows the total outstanding balance due from customers to the business over time. - - You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. - - Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. - - > It is not guaranteed that write-offs are included in the Aged Debtors report. - - ## Underlying data - - The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). - - To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. - - > The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. - - ## Accessing the Aged Debtors report in Portal - - Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. - - 1. In the navigation bar, click **Companies**. - 2. Click the name of the company you want to generate the report for. The company's data page is displayed. - 3. Click the **Accounting** tab then click **Reports**. - 4. Select **Aged Debtors**. - 5. _(Optional)_ Edit the default reporting parameters. - a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. - b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). - b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). - 6. To run the report, click **Load aged debtors**. - 7. The report is generated and displayed at the bottom of the page. - - The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes. - """ - - data: Optional[List[AgedDebtor]] = None - r"""Array of aged debtors.""" - - generated: 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. - """ - - report_date: Annotated[Optional[str], pydantic.Field(alias="reportDate")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["data", "generated", "reportDate"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The Aged Debtors report shows the total outstanding balance due from customers to the business over time. You can generate it for a company based on recently synced data from your customers' accounting software. The report is available in the **Reports** tab in the Codat portal. Total assets or liabilities are grouped into 30-day periods for each customer, up to the current date. You can adjust the report date, period length, and number of periods to show on each report. The data can be grouped by customer or currency. > It is not guaranteed that write-offs are included in the Aged Debtors report. ## Underlying data The Aged Debtors report is generated from a set of required data types: [Customers](https://docs.codat.io/lending-api#/schemas/Customer), [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice), [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote), and [Payments](https://docs.codat.io/lending-api#/schemas/Payment). To generate the report, the underlying data types must have been synced within 24 hours of each other. Otherwise an error is displayed when you try to run the report. Sync the required data types by clicking the link in the error, and then run the report again. > The Aged Debtors report runs based on the **issue dates** of the underlying data types rather than the due date. ## Accessing the Aged Debtors report in Portal Apart from returning the report via the API as JSON and query, you can also return the Aged Debtors report in the Codat portal. 1. In the navigation bar, click **Companies**. 2. Click the name of the company you want to generate the report for. The company's data page is displayed. 3. Click the **Accounting** tab then click **Reports**. 4. Select **Aged Debtors**. 5. _(Optional)_ Edit the default reporting parameters. a. You can change the report date in the **Date** box. By default, the report includes transactions that occurred up to, but not including, today's date. To include transactions for today, enter tomorrow's date. b. In the **Period Length Days** box, select the default period length for each column (the default is 30 days). b. In the **Number of Periods** box, enter the number of periods to show as columns in the report (the default is 4 periods). 6. To run the report, click **Load aged debtors**. 7. The report is generated and displayed at the bottom of the page. The report will be grouped per supplier and depending on the periods requested. The details indicates whether the amounts owed come from outstanding invoices or credit notes. + """ # noqa: E501 + generated: 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.") + report_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="reportDate") + data: Optional[List[AgedDebtor]] = Field(default=None, description="Array of aged debtors.") + __properties: ClassVar[List[str]] = ["generated", "reportDate", "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 AccountingAgedDebtorReport 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 data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAgedDebtorReport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "generated": obj.get("generated"), + "reportDate": obj.get("reportDate"), + "data": [AgedDebtor.from_dict(_item) for _item in 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)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - AccountingAgedDebtorReport.model_rebuild() -except NameError: - pass +class AccountingAgedDebtorReportTypedDict(TypedDict): + """TypedDict variant of AccountingAgedDebtorReport, for dict-literal request/response inputs.""" + generated: NotRequired[Optional[str]] + report_date: NotRequired[Optional[str]] + data: NotRequired[Optional[List[AgedDebtorTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/accountingattachment.py b/lending/src/codat_lending/models/shared/accountingattachment.py index dcbfc45b8..fa794a67b 100644 --- a/lending/src/codat_lending/models/shared/accountingattachment.py +++ b/lending/src/codat_lending/models/shared/accountingattachment.py @@ -1,187 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingAttachmentTypedDict(TypedDict): - r"""The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. - - > **Retrieving attachments** - > - > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. - - Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. - - Note that different integrations have different requirements to file size and extension of attachments. - - | Integration | File size | File extension | - |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| - | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | - | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | - | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | - | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". | +""" + Lending - """ - - content_type: NotRequired[Nullable[str]] - r"""File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**. - - Supported file types vary per platform. - """ - date_created: NotRequired[str] - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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. - """ - file_size: NotRequired[Nullable[int]] - r"""File size in bytes. For example, if this reads **46153**, then the file size is 46kb.""" - id: NotRequired[str] - r"""Identifier for the attachment, unique for the company in the accounting software.""" - include_when_sent: NotRequired[bool] - r"""If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this.""" - modified_date: NotRequired[str] - name: NotRequired[Nullable[str]] - r"""Name of the attachment file.""" - source_modified_date: NotRequired[str] +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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingAttachment(BaseModel): - r"""The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. - - > **Retrieving attachments** - > - > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. - - Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. - - Note that different integrations have different requirements to file size and extension of attachments. - - | Integration | File size | File extension | - |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| - | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | - | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | - | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | - | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". | + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'contentType', 'content_type', 'fileSize', 'file_size', 'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + The Codat API supports pulling and pushing of file attachments for invoices, bills, direct costs, and direct incomes. > **Retrieving attachments** > > If a company is authorized, you can query the Codat API to read, download, and upload attachments without requiring a fresh sync of data. Unlike other data types, Codat doesn't support [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for attachments. Note that different integrations have different requirements to file size and extension of attachments. | Integration | File size | File extension | |-------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | Xero | 4 MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | | QuickBooks Online | 100 MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | | NetSuite | 100 MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that \"You can attach any type of file, such as text, image, or video files\". | + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the attachment, unique for the company in the accounting software.") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the attachment file.") + content_type: OptionalNullable[str] = Field(default=UNSET, description="File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**. Supported file types vary per platform. ", alias="contentType") + date_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.", alias="dateCreated") + file_size: OptionalNullable[int] = Field(default=UNSET, description="File size in bytes. For example, if this reads **46153**, then the file size is 46kb.", alias="fileSize") + include_when_sent: Optional[bool] = Field(default=None, description="If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this.", alias="includeWhenSent") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "contentType", "dateCreated", "fileSize", "includeWhenSent"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - content_type: Annotated[ - OptionalNullable[str], pydantic.Field(alias="contentType") - ] = UNSET - r"""File type of the attachment. This is represented by appending the file type to the [IETF standard file naming requirements](https://tools.ietf.org/html/rfc6838). For example, for a jpeg file the output is **image/jpeg**. - Supported file types vary per platform. - """ + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - date_created: Annotated[Optional[str], pydantic.Field(alias="dateCreated")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + 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 AccountingAttachment 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. + """ + excluded_fields: Set[str] = set([ + ]) - - 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, + ) + return _dict - > 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. - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingAttachment from a dict""" + if obj is None: + return None - file_size: Annotated[OptionalNullable[int], pydantic.Field(alias="fileSize")] = ( - UNSET - ) - r"""File size in bytes. For example, if this reads **46153**, then the file size is 46kb.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - id: Optional[str] = None - r"""Identifier for the attachment, unique for the company in the accounting software.""" + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "contentType": obj.get("contentType"), + "dateCreated": obj.get("dateCreated"), + "fileSize": obj.get("fileSize"), + "includeWhenSent": obj.get("includeWhenSent") + }) + return _obj - include_when_sent: Annotated[ - Optional[bool], pydantic.Field(alias="includeWhenSent") - ] = None - r"""If `true`, then the attachment is included with the associated invoice, bill or direct costs when it is printed, emailed, or sent to a customer, if the underlying accounting software allows this.""" - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - name: OptionalNullable[str] = UNSET - r"""Name of the attachment file.""" - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "contentType", - "dateCreated", - "fileSize", - "id", - "includeWhenSent", - "modifiedDate", - "name", - "sourceModifiedDate", - ] - ) - nullable_fields = set(["contentType", "fileSize", "name"]) - 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: - AccountingAttachment.model_rebuild() -except NameError: - pass +class AccountingAttachmentTypedDict(TypedDict): + """TypedDict variant of AccountingAttachment, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + content_type: NotRequired[Optional[str]] + date_created: NotRequired[Optional[str]] + file_size: NotRequired[Optional[int]] + include_when_sent: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/shared/accountingbalancesheet.py b/lending/src/codat_lending/models/shared/accountingbalancesheet.py index e1ea7cfd7..0662a45e0 100644 --- a/lending/src/codat_lending/models/shared/accountingbalancesheet.py +++ b/lending/src/codat_lending/models/shared/accountingbalancesheet.py @@ -1,188 +1,130 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .balancesheet import BalanceSheet, BalanceSheetTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingBalanceSheetTypedDict(TypedDict): - r"""## Overview - - The balance sheet is a snapshot of a company's accounts at a single point in time that provides a statement of the assets, liabilities and equity of an organization. It gives interested parties an idea of the company's financial position, in addition to displaying what the company owns and owes. - - > **Balance sheet or profit and loss report?** - > - > A profit and loss report summarises the total revenue, expenses, and profit or loss during a specified time period. A balance sheet report shows the financial position of a company at a specific moment in time. - - **Structure of this report** - This report will reflect the structure and line descriptions that the business has set in their own accounting software. +""" + Lending - **History** - By default, Codat pulls (up to) 24 months of balance sheets for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `balanceSheet` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/update-sync-settings). - - **Want to pull this in a standardised structure?** - Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - """ - - reports: List[BalanceSheetTypedDict] - r"""An array of balance sheet reports.""" - 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. - """ - earliest_available_month: 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: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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. - """ - most_recent_available_month: 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. - """ +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_lending.models.shared.balancesheet import BalanceSheet, BalanceSheetTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AccountingBalanceSheet(BaseModel): - r"""## Overview - - The balance sheet is a snapshot of a company's accounts at a single point in time that provides a statement of the assets, liabilities and equity of an organization. It gives interested parties an idea of the company's financial position, in addition to displaying what the company owns and owes. - - > **Balance sheet or profit and loss report?** - > - > A profit and loss report summarises the total revenue, expenses, and profit or loss during a specified time period. A balance sheet report shows the financial position of a company at a specific moment in time. - **Structure of this report** - This report will reflect the structure and line descriptions that the business has set in their own accounting software. - - **History** - By default, Codat pulls (up to) 24 months of balance sheets for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `balanceSheet` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/update-sync-settings). - - **Want to pull this in a standardised structure?** - Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - """ - - reports: List[BalanceSheet] - r"""An array of balance sheet reports.""" - - 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. - """ - - earliest_available_month: Annotated[ - Optional[str], pydantic.Field(alias="earliestAvailableMonth") - ] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + ## Overview The balance sheet is a snapshot of a company's accounts at a single point in time that provides a statement of the assets, liabilities and equity of an organization. It gives interested parties an idea of the company's financial position, in addition to displaying what the company owns and owes. > **Balance sheet or profit and loss report?** > > A profit and loss report summarises the total revenue, expenses, and profit or loss during a specified time period. A balance sheet report shows the financial position of a company at a specific moment in time. **Structure of this report** This report will reflect the structure and line descriptions that the business has set in their own accounting software. **History** By default, Codat pulls (up to) 24 months of balance sheets for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `balanceSheet` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/update-sync-settings). **Want to pull this in a standardised structure?** Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. + """ # noqa: E501 + 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.") + reports: List[BalanceSheet] = Field(description="An array of balance sheet reports.") + most_recent_available_month: 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="mostRecentAvailableMonth") + earliest_available_month: 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="earliestAvailableMonth") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["currency", "reports", "mostRecentAvailableMonth", "earliestAvailableMonth"] + + 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 AccountingBalanceSheet 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 reports (list) + _items = [] + if self.reports: + for _item_reports in self.reports: + if _item_reports: + _items.append(_item_reports.to_dict()) + _dict['reports'] = _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 - most_recent_available_month: Annotated[ - Optional[str], pydantic.Field(alias="mostRecentAvailableMonth") - ] = 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 - ``` - - + return _dict - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingBalanceSheet from a dict""" + if obj is None: + return None - - 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` + if not isinstance(obj, dict): + return cls.model_validate(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. - """ + _obj = cls.model_validate({ + "currency": obj.get("currency"), + "reports": [BalanceSheet.from_dict(_item) for _item in obj["reports"]] if obj.get("reports") is not None else None, + "mostRecentAvailableMonth": obj.get("mostRecentAvailableMonth"), + "earliestAvailableMonth": obj.get("earliestAvailableMonth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["currency", "earliestAvailableMonth", "mostRecentAvailableMonth"] - ) - serialized = handler(self) - m = {} + 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: - AccountingBalanceSheet.model_rebuild() -except NameError: - pass +class AccountingBalanceSheetTypedDict(TypedDict): + """TypedDict variant of AccountingBalanceSheet, for dict-literal request/response inputs.""" + currency: NotRequired[Optional[str]] + reports: NotRequired[List[BalanceSheetTypedDict]] + most_recent_available_month: NotRequired[Optional[str]] + earliest_available_month: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/accountingbankaccount.py b/lending/src/codat_lending/models/shared/accountingbankaccount.py index 61e677f68..7dd53fa32 100644 --- a/lending/src/codat_lending/models/shared/accountingbankaccount.py +++ b/lending/src/codat_lending/models/shared/accountingbankaccount.py @@ -1,287 +1,164 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingbankaccounttype import AccountingBankAccountType -from .bankaccountstatus import BankAccountStatus -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 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/lending-api#/schemas/Account) data type. - - ## Overview +""" + Lending - A list of bank accounts associated with a company and a specific data connection. + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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. - """ + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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[AccountingBankAccountType] - 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from codat_lending.models.shared.bankaccountstatus import BankAccountStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL 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/lending-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[AccountingBankAccountType], 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. + @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) + } """ - - 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.""" - + > **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/lending-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[AccountingBankAccountType] = Field(default=None, 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 + 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") + 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") + __properties: ClassVar[List[str]] = ["accountName", "accountType", "nominalCode", "sortCode", "accountNumber", "iBan", "currency", "balance", "institution", "availableBalance", "overdraftLimit", "status", "modifiedDate", "sourceModifiedDate", "id", "metadata", "supplementalData"] - 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. + 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 AccountingBankAccount 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 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"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "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 + }) + 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 -try: - AccountingBankAccount.model_rebuild() -except NameError: - pass +class AccountingBankAccountTypedDict(TypedDict): + """TypedDict variant of AccountingBankAccount, for dict-literal request/response inputs.""" + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[AccountingBankAccountType]] + 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]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingbankaccounts.py b/lending/src/codat_lending/models/shared/accountingbankaccounts.py index dd66a1cfc..c4d02ecbb 100644 --- a/lending/src/codat_lending/models/shared/accountingbankaccounts.py +++ b/lending/src/codat_lending/models/shared/accountingbankaccounts.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingbankaccount import AccountingBankAccount, AccountingBankAccountTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingbankaccount import AccountingBankAccount, AccountingBankAccountTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingBankAccounts(BaseModel): -class AccountingBankAccountsTypedDict(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[AccountingBankAccountTypedDict]]] + @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} + """ + AccountingBankAccounts + """ # 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=(), + ) -class AccountingBankAccounts(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 AccountingBankAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingBankAccount]]] = 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 AccountingBankAccounts 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": [AccountingBankAccount.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingBankAccounts.model_rebuild() -except NameError: - pass + + + + +class AccountingBankAccountsTypedDict(TypedDict): + """TypedDict variant of AccountingBankAccounts, 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/lending/src/codat_lending/models/shared/accountingbankaccounttype.py b/lending/src/codat_lending/models/shared/accountingbankaccounttype.py index b82f1eb18..7f49861e9 100644 --- a/lending/src/codat_lending/models/shared/accountingbankaccounttype.py +++ b/lending/src/codat_lending/models/shared/accountingbankaccounttype.py @@ -1,15 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 AccountingBankAccountType(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. """ + 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. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + CREDIT = 'Credit' + DEBIT = 'Debit' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AccountingBankAccountType from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - CREDIT = "Credit" - DEBIT = "Debit" diff --git a/lending/src/codat_lending/models/shared/accountingbanktransaction.py b/lending/src/codat_lending/models/shared/accountingbanktransaction.py index 2e209efdc..da4a4acf9 100644 --- a/lending/src/codat_lending/models/shared/accountingbanktransaction.py +++ b/lending/src/codat_lending/models/shared/accountingbanktransaction.py @@ -1,200 +1,134 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .banktransactiontype import BankTransactionType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingBankTransactionTypedDict(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: Transaction](https://docs.codat.io/lending-api#/operations/list-transactions) data type. - - ## Overview +""" + Lending - Transactional banking data for a specific company and account. - - Bank transactions include the: - * Amount of the transaction. - * Current account balance. - * Transaction type, for example, credit, debit, or transfer. - """ + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - account_id: NotRequired[Nullable[str]] - r"""Unique identifier to the `accountId` the bank transactions originates from.""" - amount: NotRequired[Decimal] - r"""The amount transacted in the bank transaction.""" - balance: NotRequired[Decimal] - r"""The remaining balance in the account with ID `accountId`.""" - cleared_on_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 - ``` - - - - 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. - """ - description: NotRequired[Nullable[str]] - r"""Description of the bank transaction.""" - id: NotRequired[str] - r"""Identifier for the bank transaction, unique to the company in the accounting software.""" - modified_date: NotRequired[str] - reconciled: NotRequired[bool] - r"""`True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software.""" - source_modified_date: NotRequired[str] - transaction_type: NotRequired[BankTransactionType] - r"""Type of transaction for the bank statement line.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.banktransactiontype import BankTransactionType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingBankTransaction(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: Transaction](https://docs.codat.io/lending-api#/operations/list-transactions) data type. - ## Overview + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountId', 'account_id', 'description'} + 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: Transaction](https://docs.codat.io/lending-api#/operations/list-transactions) data type. ## Overview Transactional banking data for a specific company and account. Bank transactions include the: * Amount of the transaction. * Current account balance. * Transaction type, for example, credit, debit, or transfer. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the bank transaction, unique to the company in the accounting software.") + account_id: OptionalNullable[str] = Field(default=UNSET, description="Unique identifier to the `accountId` the bank transactions originates from.", alias="accountId") + cleared_on_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="clearedOnDate") + description: OptionalNullable[str] = Field(default=UNSET, description="Description of 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`.") + transaction_type: Optional[BankTransactionType] = Field(default=None, alias="transactionType") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "accountId", "clearedOnDate", "description", "reconciled", "amount", "balance", "transactionType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - Transactional banking data for a specific company and account. - Bank transactions include the: - * Amount of the transaction. - * Current account balance. - * Transaction type, for example, credit, debit, or transfer. - """ + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - account_id: Annotated[OptionalNullable[str], pydantic.Field(alias="accountId")] = ( - UNSET - ) - r"""Unique identifier to the `accountId` the bank transactions originates from.""" - - 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`.""" - - cleared_on_date: Annotated[Optional[str], pydantic.Field(alias="clearedOnDate")] = ( - 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 AccountingBankTransaction 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. + """ + excluded_fields: Set[str] = set([ + ]) - - 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, + ) + return _dict - > 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. - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingBankTransaction from a dict""" + if obj is None: + return None - description: OptionalNullable[str] = UNSET - r"""Description of the bank transaction.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - id: Optional[str] = None - r"""Identifier for the bank transaction, unique to the company in the accounting software.""" + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "accountId": obj.get("accountId"), + "clearedOnDate": obj.get("clearedOnDate"), + "description": obj.get("description"), + "reconciled": obj.get("reconciled"), + "amount": obj.get("amount"), + "balance": obj.get("balance"), + "transactionType": obj.get("transactionType") + }) + return _obj - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - reconciled: Optional[bool] = None - r"""`True` if the bank transaction has been [reconciled](https://www.xero.com/uk/guides/what-is-bank-reconciliation/) in the accounting software.""" - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - transaction_type: Annotated[ - Optional[BankTransactionType], pydantic.Field(alias="transactionType") - ] = None - r"""Type of transaction for the bank statement line.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountId", - "amount", - "balance", - "clearedOnDate", - "description", - "id", - "modifiedDate", - "reconciled", - "sourceModifiedDate", - "transactionType", - ] - ) - nullable_fields = set(["accountId", "description"]) - 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: - AccountingBankTransaction.model_rebuild() -except NameError: - pass +class AccountingBankTransactionTypedDict(TypedDict): + """TypedDict variant of AccountingBankTransaction, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + account_id: NotRequired[Optional[str]] + cleared_on_date: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + reconciled: NotRequired[Optional[bool]] + amount: NotRequired[Optional[Decimal]] + balance: NotRequired[Optional[Decimal]] + transaction_type: NotRequired[Optional[BankTransactionType]] diff --git a/lending/src/codat_lending/models/shared/accountingbanktransactions.py b/lending/src/codat_lending/models/shared/accountingbanktransactions.py index 726a963c5..392a68352 100644 --- a/lending/src/codat_lending/models/shared/accountingbanktransactions.py +++ b/lending/src/codat_lending/models/shared/accountingbanktransactions.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingbanktransaction import ( - AccountingBankTransaction, - AccountingBankTransactionTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingbanktransaction import AccountingBankTransaction, AccountingBankTransactionTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingBankTransactions(BaseModel): -class AccountingBankTransactionsTypedDict(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[AccountingBankTransactionTypedDict]]] + @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} + """ + AccountingBankTransactions + """ # 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[AccountingBankTransaction]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingBankTransactions(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 AccountingBankTransactions from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingBankTransaction]]] = 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 AccountingBankTransactions 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": [AccountingBankTransaction.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingBankTransactions.model_rebuild() -except NameError: - pass + + + + +class AccountingBankTransactionsTypedDict(TypedDict): + """TypedDict variant of AccountingBankTransactions, 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[AccountingBankTransactionTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingbill.py b/lending/src/codat_lending/models/shared/accountingbill.py index b28ef9c45..7d81e0d3e 100644 --- a/lending/src/codat_lending/models/shared/accountingbill.py +++ b/lending/src/codat_lending/models/shared/accountingbill.py @@ -1,424 +1,211 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .billlineitem import BillLineItem, BillLineItemTypedDict -from .billstatus import BillStatus -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .supplierref import SupplierRef, SupplierRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class PurchaseOrderReferenceTypedDict(TypedDict): - id: NotRequired[str] - r"""Identifier for the purchase order, unique for the company in the accounting software.""" - purchase_order_number: NotRequired[Nullable[str]] - r"""Friendly reference for the purchase order, commonly generated by the 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 -class PurchaseOrderReference(BaseModel): - id: Optional[str] = None - r"""Identifier for the purchase order, unique for the company in the accounting software.""" - purchase_order_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="purchaseOrderNumber") - ] = UNSET - r"""Friendly reference for the purchase order, commonly generated by the accounting software.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.bill_line_item import BillLineItem, BillLineItemTypedDict +from codat_lending.models.shared.billstatus import BillStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.purchase_order_reference import PurchaseOrderReference, PurchaseOrderReferenceTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.supplierref import SupplierRef, SupplierRefTypedDict +from codat_lending.models.withholding_tax import WithholdingTax, WithholdingTaxTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingBill(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "purchaseOrderNumber"]) - nullable_fields = set(["purchaseOrderNumber"]) + 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 WithholdingTaxTypedDict(TypedDict): - amount: Decimal - r"""Amount of tax withheld.""" - name: str - r"""Name assigned to withheld tax.""" - - -class WithholdingTax(BaseModel): - amount: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Amount of tax withheld.""" - - name: str - r"""Name assigned to withheld tax.""" - - -class AccountingBillTypedDict(TypedDict): - r"""> **Invoices or bills?** - > - > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. - > - > See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. - - ## Overview - - In Codat, a bill contains details of: - * When the bill was recorded in the accounting system. - * How much the bill is for and the currency of the amount. - * Who the bill was received from — the *supplier*. - * What the bill is for — the *line items*. - - Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. - - You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. + _nullable = {'amountDue', 'amount_due', 'currencyRate', 'currency_rate', 'lineItems', 'line_items', 'note', 'paymentAllocations', 'payment_allocations', 'purchaseOrderRefs', 'purchase_order_refs', 'reference', 'withholdingTax', 'withholding_tax'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - issue_date: str + > **Invoices or bills?** > > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. > > See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. ## Overview In Codat, a bill contains details of: * When the bill was recorded in the accounting system. * How much the bill is for and the currency of the amount. * Who the bill was received from — the *supplier*. * What the bill is for — the *line items*. Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the bill, unique for the company in the accounting software.") + reference: OptionalNullable[str] = Field(default=UNSET, description="User-friendly reference for the bill.") + supplier_ref: Optional[SupplierRef] = Field(default=None, alias="supplierRef") + purchase_order_refs: OptionalNullable[List[PurchaseOrderReference]] = Field(default=UNSET, alias="purchaseOrderRefs") + issue_date: str = Field(description="Date of the bill as recorded in the accounting software.", alias="issueDate") + due_date: Optional[str] = Field(default=None, description="Date the supplier is due to be paid.", alias="dueDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: OptionalNullable[List[BillLineItem]] = Field(default=UNSET, description="Array of Bill line items.", alias="lineItems") + withholding_tax: OptionalNullable[List[WithholdingTax]] = Field(default=UNSET, alias="withholdingTax") status: BillStatus - r"""Current state of the bill.""" - sub_total: Decimal - r"""Total amount of the bill, excluding any taxes.""" - tax_amount: Decimal - r"""Amount of tax on the bill.""" - total_amount: Decimal - r"""Amount of the bill, including tax.""" - amount_due: NotRequired[Nullable[Decimal]] - r"""Amount outstanding on the bill.""" - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - due_date: NotRequired[str] - id: NotRequired[str] - r"""Identifier for the bill, unique for the company in the accounting software.""" - line_items: NotRequired[Nullable[List[BillLineItemTypedDict]]] - r"""Array of Bill line items.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any private, company notes about the bill, such as payment information.""" - payment_allocations: NotRequired[ - Nullable[List[AccountingPaymentAllocationTypedDict]] - ] - r"""An array of payment allocations.""" - purchase_order_refs: NotRequired[Nullable[List[PurchaseOrderReferenceTypedDict]]] - reference: NotRequired[Nullable[str]] - r"""User-friendly reference for the bill.""" - source_modified_date: NotRequired[str] - 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. - """ - supplier_ref: NotRequired[SupplierRefTypedDict] - r"""Reference to the supplier the record relates to.""" - withholding_tax: NotRequired[Nullable[List[WithholdingTaxTypedDict]]] - - -class AccountingBill(BaseModel): - r"""> **Invoices or bills?** - > - > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company has received an invoice, and owes money to someone else (accounts payable) we call this a Bill. - > - > See [Invoices](https://docs.codat.io/lending-api#/schemas/Invoice) for the accounts receivable equivalent of bills. - - ## Overview - - In Codat, a bill contains details of: - * When the bill was recorded in the accounting system. - * How much the bill is for and the currency of the amount. - * Who the bill was received from — the *supplier*. - * What the bill is for — the *line items*. - - Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's *expenses*. - - You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. - """ - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - - status: BillStatus - r"""Current state of the bill.""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""Total amount of the bill, excluding any taxes.""" - - tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] - r"""Amount of tax on the bill.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""Amount of the bill, including tax.""" - - amount_due: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="amountDue"), - ] = UNSET - r"""Amount outstanding on the bill.""" - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = None - - id: Optional[str] = None - r"""Identifier for the bill, unique for the company in the accounting software.""" - - line_items: Annotated[ - OptionalNullable[List[BillLineItem]], pydantic.Field(alias="lineItems") - ] = UNSET - r"""Array of Bill line items.""" - + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Total amount of the bill, excluding any taxes.", alias="subTotal") + tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of tax on the bill.", alias="taxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of the bill, including tax.", alias="totalAmount") + amount_due: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount outstanding on the bill.", alias="amountDue") + note: OptionalNullable[str] = Field(default=UNSET, description="Any private, company notes about the bill, such as payment information.") + payment_allocations: OptionalNullable[List[AccountingPaymentAllocation]] = Field(default=UNSET, description="An array of payment allocations.", alias="paymentAllocations") metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Any private, company notes about the bill, such as payment information.""" - - payment_allocations: Annotated[ - OptionalNullable[List[AccountingPaymentAllocation]], - pydantic.Field(alias="paymentAllocations"), - ] = UNSET - r"""An array of payment allocations.""" - - purchase_order_refs: Annotated[ - OptionalNullable[List[PurchaseOrderReference]], - pydantic.Field(alias="purchaseOrderRefs"), - ] = UNSET - - reference: OptionalNullable[str] = UNSET - r"""User-friendly reference for the bill.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - supplier_ref: Annotated[ - Optional[SupplierRef], pydantic.Field(alias="supplierRef") - ] = None - r"""Reference to the supplier the record relates to.""" - - withholding_tax: Annotated[ - OptionalNullable[List[WithholdingTax]], pydantic.Field(alias="withholdingTax") - ] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amountDue", - "currency", - "currencyRate", - "dueDate", - "id", - "lineItems", - "metadata", - "modifiedDate", - "note", - "paymentAllocations", - "purchaseOrderRefs", - "reference", - "sourceModifiedDate", - "supplementalData", - "supplierRef", - "withholdingTax", - ] - ) - nullable_fields = set( - [ - "amountDue", - "currencyRate", - "lineItems", - "note", - "paymentAllocations", - "purchaseOrderRefs", - "reference", - "withholdingTax", - ] + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "reference", "supplierRef", "purchaseOrderRefs", "issueDate", "dueDate", "currency", "currencyRate", "lineItems", "withholdingTax", "status", "subTotal", "taxAmount", "totalAmount", "amountDue", "note", "paymentAllocations", "metadata", "supplementalData"] + + 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 AccountingBill 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of supplier_ref + if self.supplier_ref: + _dict['supplierRef'] = self.supplier_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in purchase_order_refs (list) + _items = [] + if self.purchase_order_refs: + for _item_purchase_order_refs in self.purchase_order_refs: + if _item_purchase_order_refs: + _items.append(_item_purchase_order_refs.to_dict()) + _dict['purchaseOrderRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in withholding_tax (list) + _items = [] + if self.withholding_tax: + for _item_withholding_tax in self.withholding_tax: + if _item_withholding_tax: + _items.append(_item_withholding_tax.to_dict()) + _dict['withholdingTax'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # 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 AccountingBill from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "reference": obj.get("reference"), + "supplierRef": SupplierRef.from_dict(obj["supplierRef"]) if obj.get("supplierRef") is not None else None, + "purchaseOrderRefs": [PurchaseOrderReference.from_dict(_item) for _item in obj["purchaseOrderRefs"]] if obj.get("purchaseOrderRefs") is not None else None, + "issueDate": obj.get("issueDate"), + "dueDate": obj.get("dueDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [BillLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "withholdingTax": [WithholdingTax.from_dict(_item) for _item in obj["withholdingTax"]] if obj.get("withholdingTax") is not None else None, + "status": obj.get("status"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "amountDue": obj.get("amountDue"), + "note": obj.get("note"), + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "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 + }) + 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 -try: - PurchaseOrderReference.model_rebuild() -except NameError: - pass -try: - AccountingBill.model_rebuild() -except NameError: - pass +class AccountingBillTypedDict(TypedDict): + """TypedDict variant of AccountingBill, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + reference: NotRequired[Optional[str]] + supplier_ref: NotRequired[Optional[SupplierRefTypedDict]] + purchase_order_refs: NotRequired[Optional[List[PurchaseOrderReferenceTypedDict]]] + issue_date: NotRequired[str] + due_date: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[Optional[List[BillLineItemTypedDict]]] + withholding_tax: NotRequired[Optional[List[WithholdingTaxTypedDict]]] + status: BillStatus + sub_total: NotRequired[Decimal] + tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + amount_due: NotRequired[Optional[Decimal]] + note: NotRequired[Optional[str]] + payment_allocations: NotRequired[Optional[List[AccountingPaymentAllocationTypedDict]]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingbillcreditnote.py b/lending/src/codat_lending/models/shared/accountingbillcreditnote.py index ff8949770..ef95c6772 100644 --- a/lending/src/codat_lending/models/shared/accountingbillcreditnote.py +++ b/lending/src/codat_lending/models/shared/accountingbillcreditnote.py @@ -1,469 +1,217 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from .billcreditnotelineitem import ( - BillCreditNoteLineItem, - BillCreditNoteLineItemTypedDict, -) -from .billcreditnotestatus import BillCreditNoteStatus -from .items import Items, ItemsTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .supplierref import SupplierRef, SupplierRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingBillCreditNoteTypedDict(TypedDict): - r"""> **Bill credit notes or credit notes?** - > - > In Codat, bill credit notes represent accounts payable only. For accounts receivable, see [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - ## Overview - - A bill credit note is issued by a supplier for the purpose of recording credit. For example, if a supplier was unable to fulfil an order that was placed by a business, or delivered damaged goods, they would issue a bill credit note. A bill credit note reduces the amount a business owes to the supplier. It can be refunded to the business or used to pay off future bills. - - In the Codat API, a bill credit note is an accounts payable record issued by a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier). - - A bill credit note includes details of: - * The original and remaining credit. - * Any allocations of the credit against other records, such as [bills](https://docs.codat.io/lending-api#/schemas/Bill). - * The supplier that issued the bill credit note. - """ - - discount_percentage: Decimal - r"""Percentage rate of any discount applied to the bill credit note.""" - status: BillCreditNoteStatus - r"""Current state of the bill credit note""" - sub_total: Decimal - r"""Total amount of the bill credit note, including discounts but excluding tax.""" - total_amount: Decimal - r"""Total amount of credit that has been applied to the business' account with the supplier, including discounts and tax.""" - total_discount: Decimal - r"""Total value of any discounts applied.""" - total_tax_amount: Decimal - r"""Amount of tax included in the bill credit note.""" - allocated_on_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. - """ - bill_credit_note_number: NotRequired[Nullable[str]] - r"""Friendly reference for the bill credit note.""" - created_from_refs: NotRequired[Nullable[List[AccountingRecordRefTypedDict]]] - r"""An array of records the credit note was created from.""" - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP +""" + Lending - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ## Examples with base currency of USD + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier for the bill credit note that is unique to a company in the accounting software.""" - issue_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. - """ - line_items: NotRequired[Nullable[List[BillCreditNoteLineItemTypedDict]]] - r"""An array of line""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any additional information about the bill credit note.""" - payment_allocations: NotRequired[ - Nullable[List[AccountingPaymentAllocationTypedDict]] - ] - r"""An array of payment allocations.""" - remaining_credit: NotRequired[Decimal] - r"""Amount of the bill credit note that is still outstanding.""" - source_modified_date: NotRequired[str] - 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. - """ - supplier_ref: NotRequired[SupplierRefTypedDict] - r"""Reference to the supplier the record relates to.""" - withholding_tax: NotRequired[Nullable[List[ItemsTypedDict]]] + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from codat_lending.models.shared.billcreditnotelineitem import BillCreditNoteLineItem, BillCreditNoteLineItemTypedDict +from codat_lending.models.shared.billcreditnotestatus import BillCreditNoteStatus +from codat_lending.models.shared.items import Items, ItemsTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.supplierref import SupplierRef, SupplierRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingBillCreditNote(BaseModel): - r"""> **Bill credit notes or credit notes?** - > - > In Codat, bill credit notes represent accounts payable only. For accounts receivable, see [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - ## Overview - - A bill credit note is issued by a supplier for the purpose of recording credit. For example, if a supplier was unable to fulfil an order that was placed by a business, or delivered damaged goods, they would issue a bill credit note. A bill credit note reduces the amount a business owes to the supplier. It can be refunded to the business or used to pay off future bills. - - In the Codat API, a bill credit note is an accounts payable record issued by a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier). - A bill credit note includes details of: - * The original and remaining credit. - * Any allocations of the credit against other records, such as [bills](https://docs.codat.io/lending-api#/schemas/Bill). - * The supplier that issued the bill credit note. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'billCreditNoteNumber', 'bill_credit_note_number', 'createdFromRefs', 'created_from_refs', 'currencyRate', 'currency_rate', 'lineItems', 'line_items', 'note', 'paymentAllocations', 'payment_allocations', 'withholdingTax', 'withholding_tax'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - discount_percentage: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] - r"""Percentage rate of any discount applied to the bill credit note.""" - + > **Bill credit notes or credit notes?** > > In Codat, bill credit notes represent accounts payable only. For accounts receivable, see [Credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). ## Overview A bill credit note is issued by a supplier for the purpose of recording credit. For example, if a supplier was unable to fulfil an order that was placed by a business, or delivered damaged goods, they would issue a bill credit note. A bill credit note reduces the amount a business owes to the supplier. It can be refunded to the business or used to pay off future bills. In the Codat API, a bill credit note is an accounts payable record issued by a [supplier](https://docs.codat.io/lending-api#/schemas/Supplier). A bill credit note includes details of: * The original and remaining credit. * Any allocations of the credit against other records, such as [bills](https://docs.codat.io/lending-api#/schemas/Bill). * The supplier that issued the bill credit note. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the bill credit note that is unique to a company in the accounting software.") + bill_credit_note_number: OptionalNullable[str] = Field(default=UNSET, description="Friendly reference for the bill credit note.", alias="billCreditNoteNumber") + supplier_ref: Optional[SupplierRef] = Field(default=None, alias="supplierRef") + withholding_tax: OptionalNullable[List[Items]] = Field(default=UNSET, alias="withholdingTax") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Total amount of credit that has been applied to the business' account with the supplier, including discounts and tax.", alias="totalAmount") + total_discount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Total value of any discounts applied.", alias="totalDiscount") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Total amount of the bill credit note, including discounts but excluding tax.", alias="subTotal") + total_tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of tax included in the bill credit note.", alias="totalTaxAmount") + discount_percentage: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Percentage rate of any discount applied to the bill credit note.", alias="discountPercentage") + remaining_credit: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount of the bill credit note that is still outstanding.", alias="remainingCredit") status: BillCreditNoteStatus - r"""Current state of the bill credit note""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""Total amount of the bill credit note, including discounts but excluding tax.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""Total amount of credit that has been applied to the business' account with the supplier, including discounts and tax.""" - - total_discount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalDiscount"), - ] - r"""Total value of any discounts applied.""" - - total_tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalTaxAmount"), - ] - r"""Amount of tax included in the bill credit note.""" - - allocated_on_date: Annotated[ - Optional[str], pydantic.Field(alias="allocatedOnDate") - ] = 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. - """ - - bill_credit_note_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="billCreditNoteNumber") - ] = UNSET - r"""Friendly reference for the bill credit note.""" - - created_from_refs: Annotated[ - OptionalNullable[List[AccountingRecordRef]], - pydantic.Field(alias="createdFromRefs"), - ] = UNSET - r"""An array of records the credit note was created from.""" - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - id: Optional[str] = None - r"""Identifier for the bill credit note that is unique to a company in the accounting software.""" - - issue_date: Annotated[Optional[str], pydantic.Field(alias="issueDate")] = 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. - """ - - line_items: Annotated[ - OptionalNullable[List[BillCreditNoteLineItem]], - pydantic.Field(alias="lineItems"), - ] = UNSET - r"""An array of line""" - + issue_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="issueDate") + allocated_on_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="allocatedOnDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: OptionalNullable[List[BillCreditNoteLineItem]] = Field(default=UNSET, description="An array of line ", alias="lineItems") + payment_allocations: OptionalNullable[List[AccountingPaymentAllocation]] = Field(default=UNSET, description="An array of payment allocations.", alias="paymentAllocations") + created_from_refs: OptionalNullable[List[AccountingRecordRef]] = Field(default=UNSET, description="An array of records the credit note was created from.", alias="createdFromRefs") + note: OptionalNullable[str] = Field(default=UNSET, description="Any additional information about the bill credit note.") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Any additional information about the bill credit note.""" - - payment_allocations: Annotated[ - OptionalNullable[List[AccountingPaymentAllocation]], - pydantic.Field(alias="paymentAllocations"), - ] = UNSET - r"""An array of payment allocations.""" - - remaining_credit: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="remainingCredit"), - ] = None - r"""Amount of the bill credit note that is still outstanding.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - supplier_ref: Annotated[ - Optional[SupplierRef], pydantic.Field(alias="supplierRef") - ] = None - r"""Reference to the supplier the record relates to.""" - - withholding_tax: Annotated[ - OptionalNullable[List[Items]], pydantic.Field(alias="withholdingTax") - ] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "allocatedOnDate", - "billCreditNoteNumber", - "createdFromRefs", - "currency", - "currencyRate", - "id", - "issueDate", - "lineItems", - "metadata", - "modifiedDate", - "note", - "paymentAllocations", - "remainingCredit", - "sourceModifiedDate", - "supplementalData", - "supplierRef", - "withholdingTax", - ] - ) - nullable_fields = set( - [ - "billCreditNoteNumber", - "createdFromRefs", - "currencyRate", - "lineItems", - "note", - "paymentAllocations", - "withholdingTax", - ] + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "billCreditNoteNumber", "supplierRef", "withholdingTax", "totalAmount", "totalDiscount", "subTotal", "totalTaxAmount", "discountPercentage", "remainingCredit", "status", "issueDate", "allocatedOnDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "createdFromRefs", "note", "supplementalData", "metadata"] + + 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 AccountingBillCreditNote 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of supplier_ref + if self.supplier_ref: + _dict['supplierRef'] = self.supplier_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in withholding_tax (list) + _items = [] + if self.withholding_tax: + for _item_withholding_tax in self.withholding_tax: + if _item_withholding_tax: + _items.append(_item_withholding_tax.to_dict()) + _dict['withholdingTax'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in created_from_refs (list) + _items = [] + if self.created_from_refs: + for _item_created_from_refs in self.created_from_refs: + if _item_created_from_refs: + _items.append(_item_created_from_refs.to_dict()) + _dict['createdFromRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingBillCreditNote from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "billCreditNoteNumber": obj.get("billCreditNoteNumber"), + "supplierRef": SupplierRef.from_dict(obj["supplierRef"]) if obj.get("supplierRef") is not None else None, + "withholdingTax": [Items.from_dict(_item) for _item in obj["withholdingTax"]] if obj.get("withholdingTax") is not None else None, + "totalAmount": obj.get("totalAmount"), + "totalDiscount": obj.get("totalDiscount"), + "subTotal": obj.get("subTotal"), + "totalTaxAmount": obj.get("totalTaxAmount"), + "discountPercentage": obj.get("discountPercentage"), + "remainingCredit": obj.get("remainingCredit"), + "status": obj.get("status"), + "issueDate": obj.get("issueDate"), + "allocatedOnDate": obj.get("allocatedOnDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [BillCreditNoteLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "createdFromRefs": [AccountingRecordRef.from_dict(_item) for _item in obj["createdFromRefs"]] if obj.get("createdFromRefs") is not None else None, + "note": obj.get("note"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") 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 -try: - AccountingBillCreditNote.model_rebuild() -except NameError: - pass +class AccountingBillCreditNoteTypedDict(TypedDict): + """TypedDict variant of AccountingBillCreditNote, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + bill_credit_note_number: NotRequired[Optional[str]] + supplier_ref: NotRequired[Optional[SupplierRefTypedDict]] + withholding_tax: NotRequired[Optional[List[ItemsTypedDict]]] + total_amount: NotRequired[Decimal] + total_discount: NotRequired[Decimal] + sub_total: NotRequired[Decimal] + total_tax_amount: NotRequired[Decimal] + discount_percentage: NotRequired[Decimal] + remaining_credit: NotRequired[Optional[Decimal]] + status: BillCreditNoteStatus + issue_date: NotRequired[Optional[str]] + allocated_on_date: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[Optional[List[BillCreditNoteLineItemTypedDict]]] + payment_allocations: NotRequired[Optional[List[AccountingPaymentAllocationTypedDict]]] + created_from_refs: NotRequired[Optional[List[AccountingRecordRefTypedDict]]] + note: NotRequired[Optional[str]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingbillcreditnotes.py b/lending/src/codat_lending/models/shared/accountingbillcreditnotes.py index 399ef22ba..2bf335614 100644 --- a/lending/src/codat_lending/models/shared/accountingbillcreditnotes.py +++ b/lending/src/codat_lending/models/shared/accountingbillcreditnotes.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingbillcreditnote import ( - AccountingBillCreditNote, - AccountingBillCreditNoteTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingbillcreditnote import AccountingBillCreditNote, AccountingBillCreditNoteTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingBillCreditNotes(BaseModel): -class AccountingBillCreditNotesTypedDict(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[AccountingBillCreditNoteTypedDict]]] + @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} + """ + AccountingBillCreditNotes + """ # 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[AccountingBillCreditNote]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingBillCreditNotes(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 AccountingBillCreditNotes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingBillCreditNote]]] = 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 AccountingBillCreditNotes 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": [AccountingBillCreditNote.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingBillCreditNotes.model_rebuild() -except NameError: - pass + + + + +class AccountingBillCreditNotesTypedDict(TypedDict): + """TypedDict variant of AccountingBillCreditNotes, 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[AccountingBillCreditNoteTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingbillpayment.py b/lending/src/codat_lending/models/shared/accountingbillpayment.py index 888218012..4b33cde02 100644 --- a/lending/src/codat_lending/models/shared/accountingbillpayment.py +++ b/lending/src/codat_lending/models/shared/accountingbillpayment.py @@ -1,534 +1,176 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .billpaymentline import BillPaymentLine, BillPaymentLineTypedDict -from .metadata import Metadata, MetadataTypedDict -from .paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .supplierref import SupplierRef, SupplierRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingBillPaymentTypedDict(TypedDict): - r"""> **Bill payments or payments?** - > - > We distinguish between transactions where the company received money vs. paid money. If the transaction represents a company spending money (accounts payable) we call this a Bill payment. - > - > See [payments](https://docs.codat.io/lending-api#/schemas/Payment) for the accounts receivable equivalent of Bill payments, which covers [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - ## Overview - - Bill payments include all accounts payable transaction data ([bills](https://docs.codat.io/lending-api#/schemas/Bill) and [credit notes against bills](https://docs.codat.io/lending-api#/schemas/BillCreditNote)). - - A bill payment in Codat usually represents an allocation of money within any customer accounts payable account. This includes, but is not strictly limited to: - - - A payment made against a bill — for example, a credit card payment, cheque payment, or cash payment. - - An allocation of a supplier's credit note to a bill or perhaps a refund. - - A bill payment made directly to an accounts payable account. This could be an overpayment or a prepayment, or a refund of a payment made directly to an accounts payable account. - - Depending on the bill payments which are allowed by the underlying accounting software, some of these types may be combined. Please see the example data section for samples of what these cases look like. - - In Codat, a bill payment contains details of: - - - When the bill payment was recorded in the accounting system. - - How much it is for and in the currency. - - Who the payment has been paid to, the _supplier_. - - The types of bill payments, the _line items_. - - Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's _expenses_. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. - - Bill payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - --- - - ## Bill payment types - - ### Payment of a bill - - A payment paying a single bill should have the following properties: - - - A `totalAmount` indicating the amount of the bill that was paid. This is always positive. - - A `lines` array containing one element with the following properties: - - An `amount` equal to the `totalAmount` above. - - A `links` array containing one element with the following properties: - - A `type` indicating the type of link, in this case a `Bill`. - - An `id` containing the ID of the bill that was paid. - - An amount of `-totalAmount` (negative `totalAmount`), indicating that the entirety of the paid amount is allocated to the bill. - - ### Payment of multiple bills - - It is possible for one payment to pay multiple bills. This can be represented using two possible formats, depending on how the supplier keeps their books: - - 1. The payment has multiple entries in its **lines** array, one for each bill that is paid. Each line will follow the above example for paying a bill, and the rules detailed in the data model. - 2. The payment has a line with multiple links to each bill. This occurs when the proportion of the original payment allocated to each bill is not available. - - Each line is the same as those described above, with the **amount** indicating how much of the payment is allocated to the bill. The **amount** on the lines sum to the **totalAmount** on the payment. - - > Pushing batch payments to Xero - > - > When pushing a single bill payment to Xero to pay multiple bills, only the first format is supported—multiple entries in the payment **lines** array. - - ### Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific bill, has one entry in its lines array. - - The line has the following properties: - - - A **totalAmount** indicating the amount paid by a supplier or refunded to them by a company. A payment to the supplier is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the supplier. - - An amount for the link is `0` **totalAmount** or the amount of the payment or refund. - - It is possible to have a payment that is part on account and part allocated to a bill. Each line should follow the examples above. - - ### Using a credit note to pay a bill - - The payment of a bill using a credit note has one entry in its `lines` array. This **line** has the following properties: - - - An **amount** indicating the amount of money moved, which in this case is `0`, as the credit note and bill allocation must balance each other. - - A **links** array containing two elements: - - The first link has: - - A **type** indicating the type of link, in this case a `Bill`. - - An **id** containing the ID of the bill that was paid. - - The second link has: - - A **type** indicating the type of link, in this case a `CreditNote`. - - An **id** containing the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ### Refunding a credit note - - A bill payment refunding a credit note has one entry in its **lines** array. This line has the following properties: - - - An **amount** indicating the amount of the credit note that was refunded. This is always negative, indicating that it is a refund. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of `link`, in this case a `CreditNote`. - - An **id** containing the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the line's **amount** field. These are both negative, as this is money leaving accounts payable. - - ### Refunding a payment +""" + Lending - If a payment is refunded, for example, when a company overpaid a bill and the overpayment is returned, there are two payment records: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - One for the incoming overpayment. - - Another for the outgoing refund. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - The payment issuing the refund is identified by the fact that the **totalAmount** is negative. This payment has one entry in its lines array that have the following properties: - - - An **amount** indicating the amount that was refunded. This is always negative. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of a the link, in this case a `BillPayment`. - - An **id** containing the ID of the payment that was refunded. - - The **amount** field on the line equals the **totalAmount** on the payment and is negative as this is money leaving accounts payable. - - The payment that was refunded can be identified as it has a line where the `amount` on its `line` is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was partly used to pay an bill. For example, a £1,050 payment paying a £1,000 bill with a refund of £50 has two lines: - - - One for £1,000 linked to the bill that was paid - - Another for £50 linked to the payment that refunded the over payment. This link is of type `Refund` but the ID corresponds to a bill payment. - - The line linked to the bill payment has the following properties: - - - An **amount** indicating the amount that was refunded. This is positive as its money that was added to accounts payable, but is balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of the link, in this case a `Refund`. - - An **id** containing the ID of the payment that refunded this line. - - > Linked payments - > - > Not all accounting software support linked payments in this way. In these platforms you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are detailed in the bill payments data type: - - Payment currency rate: - - - Base currency of the accounts payable account. - - Foreign currency of the bill payment. - - Payment line link currency rate: - - - Base currency of the item that the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a bill payment is applied to an item in a currency that does not match either: - - - The base currency for the accounts payable account. - - The currency of the item. - - """ - - date_: str - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - currency: NotRequired[str] - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier for the bill payment, unique for the company in the accounting software.""" - lines: NotRequired[Nullable[List[BillPaymentLineTypedDict]]] - r"""An array of bill payment lines.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Additional information associated with the payment.""" - payment_method_ref: NotRequired[PaymentMethodRefTypedDict] - reference: NotRequired[Nullable[str]] - r"""Additional information associated with the payment.""" - source_modified_date: NotRequired[str] - 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. - """ - supplier_ref: NotRequired[SupplierRefTypedDict] - total_amount: NotRequired[Decimal] - r"""Amount of the payment in the payment currency. This value never changes and represents the amount of money that is paid into the supplier's account.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.accounting_bill_payment_all_of_payment_method_ref import AccountingBillPaymentAllOfPaymentMethodRef, AccountingBillPaymentAllOfPaymentMethodRefTypedDict +from codat_lending.models.accounting_bill_payment_all_of_supplier_ref import AccountingBillPaymentAllOfSupplierRef, AccountingBillPaymentAllOfSupplierRefTypedDict +from codat_lending.models.shared.billpaymentline import BillPaymentLine, BillPaymentLineTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingBillPayment(BaseModel): - r"""> **Bill payments or payments?** - > - > We distinguish between transactions where the company received money vs. paid money. If the transaction represents a company spending money (accounts payable) we call this a Bill payment. - > - > See [payments](https://docs.codat.io/lending-api#/schemas/Payment) for the accounts receivable equivalent of Bill payments, which covers [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - ## Overview - - Bill payments include all accounts payable transaction data ([bills](https://docs.codat.io/lending-api#/schemas/Bill) and [credit notes against bills](https://docs.codat.io/lending-api#/schemas/BillCreditNote)). - - A bill payment in Codat usually represents an allocation of money within any customer accounts payable account. This includes, but is not strictly limited to: - - - A payment made against a bill — for example, a credit card payment, cheque payment, or cash payment. - - An allocation of a supplier's credit note to a bill or perhaps a refund. - - A bill payment made directly to an accounts payable account. This could be an overpayment or a prepayment, or a refund of a payment made directly to an accounts payable account. - Depending on the bill payments which are allowed by the underlying accounting software, some of these types may be combined. Please see the example data section for samples of what these cases look like. - - In Codat, a bill payment contains details of: - - - When the bill payment was recorded in the accounting system. - - How much it is for and in the currency. - - Who the payment has been paid to, the _supplier_. - - The types of bill payments, the _line items_. - - Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's _expenses_. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. - - Bill payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - --- - - ## Bill payment types - - ### Payment of a bill - - A payment paying a single bill should have the following properties: - - - A `totalAmount` indicating the amount of the bill that was paid. This is always positive. - - A `lines` array containing one element with the following properties: - - An `amount` equal to the `totalAmount` above. - - A `links` array containing one element with the following properties: - - A `type` indicating the type of link, in this case a `Bill`. - - An `id` containing the ID of the bill that was paid. - - An amount of `-totalAmount` (negative `totalAmount`), indicating that the entirety of the paid amount is allocated to the bill. - - ### Payment of multiple bills - - It is possible for one payment to pay multiple bills. This can be represented using two possible formats, depending on how the supplier keeps their books: - - 1. The payment has multiple entries in its **lines** array, one for each bill that is paid. Each line will follow the above example for paying a bill, and the rules detailed in the data model. - 2. The payment has a line with multiple links to each bill. This occurs when the proportion of the original payment allocated to each bill is not available. - - Each line is the same as those described above, with the **amount** indicating how much of the payment is allocated to the bill. The **amount** on the lines sum to the **totalAmount** on the payment. - - > Pushing batch payments to Xero - > - > When pushing a single bill payment to Xero to pay multiple bills, only the first format is supported—multiple entries in the payment **lines** array. - - ### Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific bill, has one entry in its lines array. - - The line has the following properties: - - - A **totalAmount** indicating the amount paid by a supplier or refunded to them by a company. A payment to the supplier is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the supplier. - - An amount for the link is `0` **totalAmount** or the amount of the payment or refund. - - It is possible to have a payment that is part on account and part allocated to a bill. Each line should follow the examples above. - - ### Using a credit note to pay a bill - - The payment of a bill using a credit note has one entry in its `lines` array. This **line** has the following properties: - - - An **amount** indicating the amount of money moved, which in this case is `0`, as the credit note and bill allocation must balance each other. - - A **links** array containing two elements: - - The first link has: - - A **type** indicating the type of link, in this case a `Bill`. - - An **id** containing the ID of the bill that was paid. - - The second link has: - - A **type** indicating the type of link, in this case a `CreditNote`. - - An **id** containing the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ### Refunding a credit note - - A bill payment refunding a credit note has one entry in its **lines** array. This line has the following properties: - - - An **amount** indicating the amount of the credit note that was refunded. This is always negative, indicating that it is a refund. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of `link`, in this case a `CreditNote`. - - An **id** containing the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the line's **amount** field. These are both negative, as this is money leaving accounts payable. - - ### Refunding a payment - - If a payment is refunded, for example, when a company overpaid a bill and the overpayment is returned, there are two payment records: - - - One for the incoming overpayment. - - Another for the outgoing refund. - - The payment issuing the refund is identified by the fact that the **totalAmount** is negative. This payment has one entry in its lines array that have the following properties: - - - An **amount** indicating the amount that was refunded. This is always negative. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of a the link, in this case a `BillPayment`. - - An **id** containing the ID of the payment that was refunded. - - The **amount** field on the line equals the **totalAmount** on the payment and is negative as this is money leaving accounts payable. - - The payment that was refunded can be identified as it has a line where the `amount` on its `line` is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was partly used to pay an bill. For example, a £1,050 payment paying a £1,000 bill with a refund of £50 has two lines: - - - One for £1,000 linked to the bill that was paid - - Another for £50 linked to the payment that refunded the over payment. This link is of type `Refund` but the ID corresponds to a bill payment. - - The line linked to the bill payment has the following properties: - - - An **amount** indicating the amount that was refunded. This is positive as its money that was added to accounts payable, but is balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** indicating the type of the link, in this case a `Refund`. - - An **id** containing the ID of the payment that refunded this line. - - > Linked payments - > - > Not all accounting software support linked payments in this way. In these platforms you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are detailed in the bill payments data type: - - Payment currency rate: - - - Base currency of the accounts payable account. - - Foreign currency of the bill payment. - - Payment line link currency rate: - - - Base currency of the item that the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a bill payment is applied to an item in a currency that does not match either: - - - The base currency for the accounts payable account. - - The currency of the item. - - """ - - date_: Annotated[str, pydantic.Field(alias="date")] - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - currency: Optional[str] = None - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'currencyRate', 'currency_rate', 'lines', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - id: Optional[str] = None - r"""Identifier for the bill payment, unique for the company in the accounting software.""" - - lines: OptionalNullable[List[BillPaymentLine]] = UNSET - r"""An array of bill payment lines.""" - + > **Bill payments or payments?** > > We distinguish between transactions where the company received money vs. paid money. If the transaction represents a company spending money (accounts payable) we call this a Bill payment. > > See [payments](https://docs.codat.io/lending-api#/schemas/Payment) for the accounts receivable equivalent of Bill payments, which covers [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). ## Overview Bill payments include all accounts payable transaction data ([bills](https://docs.codat.io/lending-api#/schemas/Bill) and [credit notes against bills](https://docs.codat.io/lending-api#/schemas/BillCreditNote)). A bill payment in Codat usually represents an allocation of money within any customer accounts payable account. This includes, but is not strictly limited to: - A payment made against a bill — for example, a credit card payment, cheque payment, or cash payment. - An allocation of a supplier's credit note to a bill or perhaps a refund. - A bill payment made directly to an accounts payable account. This could be an overpayment or a prepayment, or a refund of a payment made directly to an accounts payable account. Depending on the bill payments which are allowed by the underlying accounting software, some of these types may be combined. Please see the example data section for samples of what these cases look like. In Codat, a bill payment contains details of: - When the bill payment was recorded in the accounting system. - How much it is for and in the currency. - Who the payment has been paid to, the _supplier_. - The types of bill payments, the _line items_. Some accounting software give a separate name to purchases where the payment is made immediately, such as something bought with a credit card or online payment. One example of this would be QuickBooks Online's _expenses_. You can find these types of transactions in our [Direct costs](https://docs.codat.io/lending-api#/schemas/DirectCost) data model. Bill payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). --- ## Bill payment types ### Payment of a bill A payment paying a single bill should have the following properties: - A `totalAmount` indicating the amount of the bill that was paid. This is always positive. - A `lines` array containing one element with the following properties: - An `amount` equal to the `totalAmount` above. - A `links` array containing one element with the following properties: - A `type` indicating the type of link, in this case a `Bill`. - An `id` containing the ID of the bill that was paid. - An amount of `-totalAmount` (negative `totalAmount`), indicating that the entirety of the paid amount is allocated to the bill. ### Payment of multiple bills It is possible for one payment to pay multiple bills. This can be represented using two possible formats, depending on how the supplier keeps their books: 1. The payment has multiple entries in its **lines** array, one for each bill that is paid. Each line will follow the above example for paying a bill, and the rules detailed in the data model. 2. The payment has a line with multiple links to each bill. This occurs when the proportion of the original payment allocated to each bill is not available. Each line is the same as those described above, with the **amount** indicating how much of the payment is allocated to the bill. The **amount** on the lines sum to the **totalAmount** on the payment. > Pushing batch payments to Xero > > When pushing a single bill payment to Xero to pay multiple bills, only the first format is supported—multiple entries in the payment **lines** array. ### Payments and refunds on account A payment on account, that is a payment that doesn’t pay a specific bill, has one entry in its lines array. The line has the following properties: - A **totalAmount** indicating the amount paid by a supplier or refunded to them by a company. A payment to the supplier is always negative. A refund is always positive. - A **links** array containing one element with the following properties: - A **type** indicating the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - The **id** containing the ID of the supplier. - An amount for the link is `0` **totalAmount** or the amount of the payment or refund. It is possible to have a payment that is part on account and part allocated to a bill. Each line should follow the examples above. ### Using a credit note to pay a bill The payment of a bill using a credit note has one entry in its `lines` array. This **line** has the following properties: - An **amount** indicating the amount of money moved, which in this case is `0`, as the credit note and bill allocation must balance each other. - A **links** array containing two elements: - The first link has: - A **type** indicating the type of link, in this case a `Bill`. - An **id** containing the ID of the bill that was paid. - The second link has: - A **type** indicating the type of link, in this case a `CreditNote`. - An **id** containing the ID of the credit note used by this payment. The **amount** field on the **line** equals the **totalAmount** on the payment. ### Refunding a credit note A bill payment refunding a credit note has one entry in its **lines** array. This line has the following properties: - An **amount** indicating the amount of the credit note that was refunded. This is always negative, indicating that it is a refund. - A **links** array containing one element with the following properties: - A **type** indicating the type of `link`, in this case a `CreditNote`. - An **id** containing the ID of the credit note that was refunded. The **totalAmount** field on the payment equals the line's **amount** field. These are both negative, as this is money leaving accounts payable. ### Refunding a payment If a payment is refunded, for example, when a company overpaid a bill and the overpayment is returned, there are two payment records: - One for the incoming overpayment. - Another for the outgoing refund. The payment issuing the refund is identified by the fact that the **totalAmount** is negative. This payment has one entry in its lines array that have the following properties: - An **amount** indicating the amount that was refunded. This is always negative. - A **links** array containing one element with the following properties: - A **type** indicating the type of a the link, in this case a `BillPayment`. - An **id** containing the ID of the payment that was refunded. The **amount** field on the line equals the **totalAmount** on the payment and is negative as this is money leaving accounts payable. The payment that was refunded can be identified as it has a line where the `amount` on its `line` is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was partly used to pay an bill. For example, a £1,050 payment paying a £1,000 bill with a refund of £50 has two lines: - One for £1,000 linked to the bill that was paid - Another for £50 linked to the payment that refunded the over payment. This link is of type `Refund` but the ID corresponds to a bill payment. The line linked to the bill payment has the following properties: - An **amount** indicating the amount that was refunded. This is positive as its money that was added to accounts payable, but is balanced out by the negative amount of the refund. - A **links** array containing one element with the following properties: - A **type** indicating the type of the link, in this case a `Refund`. - An **id** containing the ID of the payment that refunded this line. > Linked payments > > Not all accounting software support linked payments in this way. In these platforms you may see a payment on account and a refund on account. ## Foreign currencies There are two types of currency rate that are detailed in the bill payments data type: Payment currency rate: - Base currency of the accounts payable account. - Foreign currency of the bill payment. Payment line link currency rate: - Base currency of the item that the link represents. - Foreign currency of the payment. These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a bill payment is applied to an item in a currency that does not match either: - The base currency for the accounts payable account. - The currency of the item. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the bill payment, unique for the company in the accounting software.") + supplier_ref: Optional[AccountingBillPaymentAllOfSupplierRef] = Field(default=None, alias="supplierRef") + account_ref: Optional[AccountRef] = Field(default=None, description="Account the payment is linked to in the accounting software.", alias="accountRef") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount of the payment in the payment currency. This value never changes and represents the amount of money that is paid into the supplier's account.", alias="totalAmount") + currency: Optional[str] = Field(default=None, description="ISO currency code in which the bill payment is recorded in the accounting software.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + date_: str = Field(description="Date the bill payment was recorded in the accounting software.", alias="date") + note: OptionalNullable[str] = Field(default=UNSET, description="Additional information associated with the payment.") + payment_method_ref: Optional[AccountingBillPaymentAllOfPaymentMethodRef] = Field(default=None, alias="paymentMethodRef") + lines: OptionalNullable[List[BillPaymentLine]] = Field(default=UNSET, description="An array of bill payment lines.") + reference: OptionalNullable[str] = Field(default=UNSET, description="Additional information associated with the payment.") metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "supplierRef", "accountRef", "totalAmount", "currency", "currencyRate", "date", "note", "paymentMethodRef", "lines", "reference", "metadata", "supplementalData"] - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - note: OptionalNullable[str] = UNSET - r"""Additional information associated with the payment.""" - payment_method_ref: Annotated[ - Optional[PaymentMethodRef], pydantic.Field(alias="paymentMethodRef") - ] = None + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - reference: OptionalNullable[str] = UNSET - r"""Additional information associated with the payment.""" + 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 AccountingBillPayment from a JSON string""" + return cls.from_dict(json.loads(json_str)) - supplemental_data: Annotated[ - Optional[SupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - supplier_ref: Annotated[ - Optional[SupplierRef], pydantic.Field(alias="supplierRef") - ] = None + * `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([ + ]) - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Amount of the payment in the payment currency. This value never changes and represents the amount of money that is paid into the supplier's account.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "currency", - "currencyRate", - "id", - "lines", - "metadata", - "modifiedDate", - "note", - "paymentMethodRef", - "reference", - "sourceModifiedDate", - "supplementalData", - "supplierRef", - "totalAmount", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencyRate", "lines", "note", "reference"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of supplier_ref + if self.supplier_ref: + _dict['supplierRef'] = self.supplier_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment_method_ref + if self.payment_method_ref: + _dict['paymentMethodRef'] = self.payment_method_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in lines (list) + _items = [] + if self.lines: + for _item_lines in self.lines: + if _item_lines: + _items.append(_item_lines.to_dict()) + _dict['lines'] = _items + # 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 AccountingBillPayment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "supplierRef": AccountingBillPaymentAllOfSupplierRef.from_dict(obj["supplierRef"]) if obj.get("supplierRef") is not None else None, + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "totalAmount": obj.get("totalAmount"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "date": obj.get("date"), + "note": obj.get("note"), + "paymentMethodRef": AccountingBillPaymentAllOfPaymentMethodRef.from_dict(obj["paymentMethodRef"]) if obj.get("paymentMethodRef") is not None else None, + "lines": [BillPaymentLine.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None, + "reference": obj.get("reference"), + "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 + }) + 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 -try: - AccountingBillPayment.model_rebuild() -except NameError: - pass +class AccountingBillPaymentTypedDict(TypedDict): + """TypedDict variant of AccountingBillPayment, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + supplier_ref: NotRequired[Optional[AccountingBillPaymentAllOfSupplierRefTypedDict]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + total_amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + date_: NotRequired[str] + note: NotRequired[Optional[str]] + payment_method_ref: NotRequired[Optional[AccountingBillPaymentAllOfPaymentMethodRefTypedDict]] + lines: NotRequired[Optional[List[BillPaymentLineTypedDict]]] + reference: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingbillpayments.py b/lending/src/codat_lending/models/shared/accountingbillpayments.py index e60e78df0..4d4613efd 100644 --- a/lending/src/codat_lending/models/shared/accountingbillpayments.py +++ b/lending/src/codat_lending/models/shared/accountingbillpayments.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingbillpayment import AccountingBillPayment, AccountingBillPaymentTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingbillpayment import AccountingBillPayment, AccountingBillPaymentTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingBillPayments(BaseModel): -class AccountingBillPaymentsTypedDict(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[AccountingBillPaymentTypedDict]]] + @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} + """ + AccountingBillPayments + """ # 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[AccountingBillPayment]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingBillPayments(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 AccountingBillPayments from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingBillPayment]]] = 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 AccountingBillPayments 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": [AccountingBillPayment.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingBillPayments.model_rebuild() -except NameError: - pass + + + + +class AccountingBillPaymentsTypedDict(TypedDict): + """TypedDict variant of AccountingBillPayments, 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[AccountingBillPaymentTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingbills.py b/lending/src/codat_lending/models/shared/accountingbills.py index ea3f9de01..327aaa710 100644 --- a/lending/src/codat_lending/models/shared/accountingbills.py +++ b/lending/src/codat_lending/models/shared/accountingbills.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingbill import AccountingBill, AccountingBillTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingbill import AccountingBill, AccountingBillTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingBills(BaseModel): -class AccountingBillsTypedDict(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[AccountingBillTypedDict]]] + @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} + """ + AccountingBills + """ # 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[AccountingBill]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingBills(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 AccountingBills from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingBill]]] = 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 AccountingBills 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": [AccountingBill.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingBills.model_rebuild() -except NameError: - pass + + + + +class AccountingBillsTypedDict(TypedDict): + """TypedDict variant of AccountingBills, 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[AccountingBillTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingcashflowstatement.py b/lending/src/codat_lending/models/shared/accountingcashflowstatement.py index d4a5fe9ac..becd33326 100644 --- a/lending/src/codat_lending/models/shared/accountingcashflowstatement.py +++ b/lending/src/codat_lending/models/shared/accountingcashflowstatement.py @@ -1,190 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .cashflowstatement import CashFlowStatement, CashFlowStatementTypedDict -from .reportbasis import ReportBasis -from .reportinput import ReportInput -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingCashFlowStatementTypedDict(TypedDict): - r"""> **Operating activities only** - > - > Currently, the cash flow statement shows cash that flows into and out of the company from operating activities *only*. Operating activities generate cash from the sale of goods or services. - - ## Overview - - A cash flow statement is a financial report that records all cash that is received or spent by a company during a given period. It gives you a clearer picture of the company’s performance, and their ability to pay creditors and finance growth. - - > **Cash flow statement or balance sheet?** - > - > Look at the cash flow statement to understand a company's ability to pay its bills. Although the balance sheet may show healthy earnings at a specific point in time, the cash flow statement allows you to see whether the company is meeting its financial commitments, such as paying creditors or its employees. - """ - - report_basis: ReportBasis - r"""Accounting method used when aggregating the report data. In this case, `Cash`.""" - report_input: ReportInput - r"""Accounting method used to prepare the cash flow statement.""" - reports: List[CashFlowStatementTypedDict] - r"""Array of cash flow statements.""" - 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. - """ - earliest_available_month: 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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - most_recent_available_month: 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. - """ +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_lending.models.shared.cashflowstatement import CashFlowStatement, CashFlowStatementTypedDict +from codat_lending.models.shared.reportbasis import ReportBasis +from codat_lending.models.shared.reportinput import ReportInput +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AccountingCashFlowStatement(BaseModel): - r"""> **Operating activities only** - > - > Currently, the cash flow statement shows cash that flows into and out of the company from operating activities *only*. Operating activities generate cash from the sale of goods or services. - - ## Overview - - A cash flow statement is a financial report that records all cash that is received or spent by a company during a given period. It gives you a clearer picture of the company’s performance, and their ability to pay creditors and finance growth. - - > **Cash flow statement or balance sheet?** - > - > Look at the cash flow statement to understand a company's ability to pay its bills. Although the balance sheet may show healthy earnings at a specific point in time, the cash flow statement allows you to see whether the company is meeting its financial commitments, such as paying creditors or its employees. - """ - report_basis: Annotated[ReportBasis, pydantic.Field(alias="reportBasis")] - r"""Accounting method used when aggregating the report data. In this case, `Cash`.""" - - report_input: Annotated[ReportInput, pydantic.Field(alias="reportInput")] - r"""Accounting method used to prepare the cash flow statement.""" - - reports: List[CashFlowStatement] - r"""Array of cash flow statements.""" - - 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. - """ - - earliest_available_month: Annotated[ - Optional[str], pydantic.Field(alias="earliestAvailableMonth") - ] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + > **Operating activities only** > > Currently, the cash flow statement shows cash that flows into and out of the company from operating activities *only*. Operating activities generate cash from the sale of goods or services. ## Overview A cash flow statement is a financial report that records all cash that is received or spent by a company during a given period. It gives you a clearer picture of the company’s performance, and their ability to pay creditors and finance growth. > **Cash flow statement or balance sheet?** > > Look at the cash flow statement to understand a company's ability to pay its bills. Although the balance sheet may show healthy earnings at a specific point in time, the cash flow statement allows you to see whether the company is meeting its financial commitments, such as paying creditors or its employees. + """ # noqa: E501 + reports: List[CashFlowStatement] = Field(description="Array of cash flow statements.") + report_basis: ReportBasis = Field(alias="reportBasis") + report_input: ReportInput = Field(alias="reportInput") + 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.") + most_recent_available_month: 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="mostRecentAvailableMonth") + earliest_available_month: 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="earliestAvailableMonth") + __properties: ClassVar[List[str]] = ["reports", "reportBasis", "reportInput", "currency", "mostRecentAvailableMonth", "earliestAvailableMonth"] + + 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 AccountingCashFlowStatement 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 reports (list) + _items = [] + if self.reports: + for _item_reports in self.reports: + if _item_reports: + _items.append(_item_reports.to_dict()) + _dict['reports'] = _items + return _dict - most_recent_available_month: Annotated[ - Optional[str], pydantic.Field(alias="mostRecentAvailableMonth") - ] = 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` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingCashFlowStatement from a dict""" + if obj is None: + return None - > 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. - """ + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["currency", "earliestAvailableMonth", "mostRecentAvailableMonth"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "reports": [CashFlowStatement.from_dict(_item) for _item in obj["reports"]] if obj.get("reports") is not None else None, + "reportBasis": obj.get("reportBasis"), + "reportInput": obj.get("reportInput"), + "currency": obj.get("currency"), + "mostRecentAvailableMonth": obj.get("mostRecentAvailableMonth"), + "earliestAvailableMonth": obj.get("earliestAvailableMonth") + }) + 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: - AccountingCashFlowStatement.model_rebuild() -except NameError: - pass +class AccountingCashFlowStatementTypedDict(TypedDict): + """TypedDict variant of AccountingCashFlowStatement, for dict-literal request/response inputs.""" + reports: NotRequired[List[CashFlowStatementTypedDict]] + report_basis: NotRequired[ReportBasis] + report_input: NotRequired[ReportInput] + currency: NotRequired[Optional[str]] + most_recent_available_month: NotRequired[Optional[str]] + earliest_available_month: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountingcompanyinfo.py b/lending/src/codat_lending/models/shared/accountingcompanyinfo.py index 7b0c01ae0..eebf8187c 100644 --- a/lending/src/codat_lending/models/shared/accountingcompanyinfo.py +++ b/lending/src/codat_lending/models/shared/accountingcompanyinfo.py @@ -1,318 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .accountingaddress import AccountingAddress, AccountingAddressTypedDict -from .phonenumber import PhoneNumber, PhoneNumberTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .weblink import WebLink, WebLinkTypedDict -from codat_lending.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 AccountingCompanyInfoTypedDict(TypedDict): - r"""Company info provides standard details about a linked company such as their address, phone number, and company registration. - - > **Company information or companies?** - > - > Company information is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. - """ - - accounting_platform_ref: NotRequired[Nullable[str]] - r"""Identifier or reference for the company in the accounting software.""" - addresses: NotRequired[Nullable[List[AccountingAddressTypedDict]]] - r"""An array of Addresses.""" - base_currency: NotRequired[Nullable[str]] - r"""Currency set in the accounting software of the linked company. Used by the currency rate.""" - company_legal_name: NotRequired[Nullable[str]] - r"""Registered legal name of the linked company.""" - company_name: NotRequired[Nullable[str]] - r"""Name of the linked company.""" - created_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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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. - """ - financial_year_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 - ``` - - - - 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. - """ - ledger_lock_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. - """ - phone_numbers: NotRequired[Nullable[List[PhoneNumberTypedDict]]] - r"""An array of phone numbers.""" - registration_number: NotRequired[Nullable[str]] - r"""Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House.""" - source_urls: NotRequired[Nullable[Dict[str, Nullable[str]]]] - r"""URL addresses for the accounting source. - - For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero). - """ - 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. - """ - tax_number: NotRequired[Nullable[str]] - r"""Company tax number.""" - web_links: NotRequired[Nullable[List[WebLinkTypedDict]]] - r"""An array of weblinks.""" + 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_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict +from codat_lending.models.phone_number import PhoneNumber, PhoneNumberTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.weblink import WebLink, WebLinkTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingCompanyInfo(BaseModel): - r"""Company info provides standard details about a linked company such as their address, phone number, and company registration. - - > **Company information or companies?** - > - > Company information is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. - """ - - accounting_platform_ref: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountingPlatformRef") - ] = UNSET - r"""Identifier or reference for the company in the accounting software.""" - - addresses: OptionalNullable[List[AccountingAddress]] = UNSET - r"""An array of Addresses.""" - - base_currency: Annotated[ - OptionalNullable[str], pydantic.Field(alias="baseCurrency") - ] = UNSET - r"""Currency set in the accounting software of the linked company. Used by the currency rate.""" - company_legal_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="companyLegalName") - ] = UNSET - r"""Registered legal name of the linked company.""" - - company_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="companyName") - ] = UNSET - r"""Name of the linked company.""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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. - """ - - financial_year_start_date: Annotated[ - Optional[str], pydantic.Field(alias="financialYearStartDate") - ] = 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. - """ - - ledger_lock_date: Annotated[ - Optional[str], pydantic.Field(alias="ledgerLockDate") - ] = 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 = {'accountingPlatformRef', 'accounting_platform_ref', 'addresses', 'baseCurrency', 'base_currency', 'companyLegalName', 'companyName', 'company_legal_name', 'company_name', 'phoneNumbers', 'phone_numbers', 'registrationNumber', 'registration_number', 'sourceUrls', 'source_urls', 'taxNumber', 'tax_number', 'webLinks', 'web_links'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + Company info provides standard details about a linked company such as their address, phone number, and company registration. > **Company information or companies?** > > Company information is standard information that is held in the accounting software about a company. `Companies` is an endpoint that lists businesses in the Codat system that have linked and shared their data sources. + """ # noqa: E501 + company_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the linked company.", alias="companyName") + accounting_platform_ref: OptionalNullable[str] = Field(default=UNSET, description="Identifier or reference for the company in the accounting software.", alias="accountingPlatformRef") + company_legal_name: OptionalNullable[str] = Field(default=UNSET, description="Registered legal name of the linked company.", alias="companyLegalName") + addresses: OptionalNullable[List[AccountingAddress]] = Field(default=UNSET, description="An array of Addresses.") + phone_numbers: OptionalNullable[List[PhoneNumber]] = Field(default=UNSET, description="An array of phone numbers.", alias="phoneNumbers") + web_links: OptionalNullable[List[WebLink]] = Field(default=UNSET, description="An array of weblinks.", alias="webLinks") + ledger_lock_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="ledgerLockDate") + registration_number: OptionalNullable[str] = Field(default=UNSET, description="Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House.", alias="registrationNumber") + tax_number: OptionalNullable[str] = Field(default=UNSET, description="Company tax number.", alias="taxNumber") + financial_year_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="financialYearStartDate") + base_currency: OptionalNullable[str] = Field(default=UNSET, description="Currency set in the accounting software of the linked company. Used by the currency rate.", alias="baseCurrency") + source_urls: OptionalNullable[Dict[str, str]] = Field(default=UNSET, description="URL addresses for the accounting source. For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero).", alias="sourceUrls") + created_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="createdDate") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["companyName", "accountingPlatformRef", "companyLegalName", "addresses", "phoneNumbers", "webLinks", "ledgerLockDate", "registrationNumber", "taxNumber", "financialYearStartDate", "baseCurrency", "sourceUrls", "createdDate", "supplementalData"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - phone_numbers: Annotated[ - OptionalNullable[List[PhoneNumber]], pydantic.Field(alias="phoneNumbers") - ] = UNSET - r"""An array of phone numbers.""" - - registration_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="registrationNumber") - ] = UNSET - r"""Registration number given to the linked company by the companies authority in the country of origin. In the UK this is Companies House.""" - source_urls: Annotated[ - OptionalNullable[Dict[str, Nullable[str]]], pydantic.Field(alias="sourceUrls") - ] = UNSET - r"""URL addresses for the accounting source. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - For example, for Xero integrations two URLs are returned. These have many potential use cases, such as [deep linking](https://developer.xero.com/documentation/api-guides/deep-link-xero). - """ + 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()) - supplemental_data: Annotated[ - Optional[SupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCompanyInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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. - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - tax_number: Annotated[OptionalNullable[str], pydantic.Field(alias="taxNumber")] = ( - UNSET - ) - r"""Company tax number.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - web_links: Annotated[ - OptionalNullable[List[WebLink]], pydantic.Field(alias="webLinks") - ] = UNSET - r"""An array of weblinks.""" + * `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( - [ - "accountingPlatformRef", - "addresses", - "baseCurrency", - "companyLegalName", - "companyName", - "createdDate", - "financialYearStartDate", - "ledgerLockDate", - "phoneNumbers", - "registrationNumber", - "sourceUrls", - "supplementalData", - "taxNumber", - "webLinks", - ] - ) - nullable_fields = set( - [ - "accountingPlatformRef", - "addresses", - "baseCurrency", - "companyLegalName", - "companyName", - "phoneNumbers", - "registrationNumber", - "sourceUrls", - "taxNumber", - "webLinks", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in phone_numbers (list) + _items = [] + if self.phone_numbers: + for _item_phone_numbers in self.phone_numbers: + if _item_phone_numbers: + _items.append(_item_phone_numbers.to_dict()) + _dict['phoneNumbers'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in web_links (list) + _items = [] + if self.web_links: + for _item_web_links in self.web_links: + if _item_web_links: + _items.append(_item_web_links.to_dict()) + _dict['webLinks'] = _items + # 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 AccountingCompanyInfo 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"), + "accountingPlatformRef": obj.get("accountingPlatformRef"), + "companyLegalName": obj.get("companyLegalName"), + "addresses": [AccountingAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "phoneNumbers": [PhoneNumber.from_dict(_item) for _item in obj["phoneNumbers"]] if obj.get("phoneNumbers") is not None else None, + "webLinks": [WebLink.from_dict(_item) for _item in obj["webLinks"]] if obj.get("webLinks") is not None else None, + "ledgerLockDate": obj.get("ledgerLockDate"), + "registrationNumber": obj.get("registrationNumber"), + "taxNumber": obj.get("taxNumber"), + "financialYearStartDate": obj.get("financialYearStartDate"), + "baseCurrency": obj.get("baseCurrency"), + "sourceUrls": obj.get("sourceUrls"), + "createdDate": obj.get("createdDate"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") 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 -try: - AccountingCompanyInfo.model_rebuild() -except NameError: - pass +class AccountingCompanyInfoTypedDict(TypedDict): + """TypedDict variant of AccountingCompanyInfo, for dict-literal request/response inputs.""" + company_name: NotRequired[Optional[str]] + accounting_platform_ref: NotRequired[Optional[str]] + company_legal_name: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[AccountingAddressTypedDict]]] + phone_numbers: NotRequired[Optional[List[PhoneNumberTypedDict]]] + web_links: NotRequired[Optional[List[WebLinkTypedDict]]] + ledger_lock_date: NotRequired[Optional[str]] + registration_number: NotRequired[Optional[str]] + tax_number: NotRequired[Optional[str]] + financial_year_start_date: NotRequired[Optional[str]] + base_currency: NotRequired[Optional[str]] + source_urls: NotRequired[Optional[Dict[str, str]]] + created_date: NotRequired[Optional[str]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingcreateaccountresponse.py b/lending/src/codat_lending/models/shared/accountingcreateaccountresponse.py index 6fb2d43ac..ec09bf3d0 100644 --- a/lending/src/codat_lending/models/shared/accountingcreateaccountresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreateaccountresponse.py @@ -1,614 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountstatus import AccountStatus -from .accounttype import AccountType -from .datatype import DataType -from .metadata import Metadata, MetadataTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .validation import Validation, ValidationTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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, deprecated - - -class AccountingCreateAccountResponseValidDataTypeLinksTypedDict(TypedDict): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - - For example, `validDatatypeLinks` might indicate the following references: - - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. - - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - - ## `validDatatypeLinks` example - - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` - - - - ## Support for `validDatatypeLinks` - - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: NotRequired[Nullable[List[str]]] - r"""Supported `dataTypes` that the record can be linked to.""" - property: NotRequired[Nullable[str]] - r"""The property from the account that can be linked.""" - - -class AccountingCreateAccountResponseValidDataTypeLinks(BaseModel): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - - For example, `validDatatypeLinks` might indicate the following references: - - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. - - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - - ## `validDatatypeLinks` example - - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` - - - - ## Support for `validDatatypeLinks` - - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: OptionalNullable[List[str]] = UNSET - r"""Supported `dataTypes` that the record can be linked to.""" - - property: OptionalNullable[str] = UNSET - r"""The property from the account that can be linked.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["links", "property"]) - nullable_fields = set(["links", "property"]) - 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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateAccountResponseAccountingAccountTypedDict(TypedDict): - r"""> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Overview + Do not edit the class manually. +""" # noqa: E501 - Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - The categories for an account include: - * Asset - * Expense - * Income - * Liability - * Equity. - - The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - - At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - - To determine the list of allowed categories for a specific integration, you can: - - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - - Refer to the integration's own documentation. - - > **Accounts with no category** - > - > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. - > - > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - """ - - 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. - """ - current_balance: NotRequired[Nullable[Decimal]] - r"""Current balance in the account.""" - description: NotRequired[Nullable[str]] - r"""Description for the account.""" - fully_qualified_category: NotRequired[Nullable[str]] - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. - """ - fully_qualified_name: NotRequired[Nullable[str]] - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - id: NotRequired[str] - r"""Identifier for the account, unique for the company.""" - is_bank_account: NotRequired[bool] - r"""Confirms whether the account is a bank account or not.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - name: NotRequired[Nullable[str]] - r"""Name of the account.""" - nominal_code: NotRequired[Nullable[str]] - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - source_modified_date: NotRequired[str] - status: NotRequired[AccountStatus] - r"""Status of the 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. - """ - type: NotRequired[AccountType] - r"""Type of account""" - valid_datatype_links: NotRequired[ - Nullable[List[AccountingCreateAccountResponseValidDataTypeLinksTypedDict]] - ] - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateAccountResponseAccountingAccount(BaseModel): - r"""> **Language tip:** Accounts are also referred to as **chart of accounts**, **nominal accounts**, and **general ledger**. - - ## Overview - - Accounts are the categories a business uses to record accounting transactions. From the Accounts endpoints, you can retrieve a list of all accounts for a specified company. - - The categories for an account include: - * Asset - * Expense - * Income - * Liability - * Equity. - - The same account may have a different category based on the integration it is used in. For example, a current account (known as checking in the US) should be categorized as `Asset.Current` for Xero, and `Asset.Bank.Checking` for QuickBooks Online. - - At the same time, each integration may have its own requirements to the categories. For example, a Paypal account in Xero is of the `Asset.Bank` category and therefore requires additional properties to be provided. - - To determine the list of allowed categories for a specific integration, you can: - - Follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide and use the [Get create account model](https://docs.codat.io/lending-api#/operations/get-create-chartOfAccounts-model). - - Refer to the integration's own documentation. - - > **Accounts with no category** - > - > If an account is pulled from the chart of accounts and its nominal code does not lie within the category layout for the company's accounts, then the **type** is `Unknown`. The **fullyQualifiedCategory** and **fullyQualifiedName** fields return `null`. - > - > This approach gives a true representation of the company's accounts whilst preventing distorting financials such as a company's profit and loss and balance sheet reports. - """ - - 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. - """ - - current_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currentBalance"), - ] = UNSET - r"""Current balance in the account.""" - - description: OptionalNullable[str] = UNSET - r"""Description for the account.""" - - fully_qualified_category: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedCategory") - ] = UNSET - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. - """ - - fully_qualified_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedName") - ] = UNSET - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - - id: Optional[str] = None - r"""Identifier for the account, unique for the company.""" - - is_bank_account: Annotated[ - Optional[bool], pydantic.Field(alias="isBankAccount") - ] = None - r"""Confirms whether the account is a bank account or not.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - name: OptionalNullable[str] = UNSET - r"""Name of the account.""" - - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - status: Optional[AccountStatus] = None - r"""Status of the account""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - type: Optional[AccountType] = None - r"""Type of account""" - - valid_datatype_links: Annotated[ - OptionalNullable[List[AccountingCreateAccountResponseValidDataTypeLinks]], - pydantic.Field(alias="validDatatypeLinks"), - ] = UNSET - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_account_response_all_of_data import AccountingCreateAccountResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateAccountResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "currency", - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "id", - "isBankAccount", - "metadata", - "modifiedDate", - "name", - "nominalCode", - "sourceModifiedDate", - "status", - "supplementalData", - "type", - "validDatatypeLinks", - ] - ) - nullable_fields = set( - [ - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "name", - "nominalCode", - "validDatatypeLinks", - ] - ) + 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 AccountingCreateAccountResponseTypedDict(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[AccountingCreateAccountResponseAccountingAccountTypedDict] - ] - 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 AccountingCreateAccountResponse(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. - """ - + _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) + } + """ + AccountingCreateAccountResponse + """ # 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="Available data types", 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: OptionalNullable[AccountingCreateAccountResponseAccountingAccount] = 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.""" - + error_message: OptionalNullable[str] = Field(default=UNSET, description="A message about the error.", alias="errorMessage") 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", - ] + status_code: int = Field(description="Push status code.", alias="statusCode") + data: OptionalNullable[AccountingCreateAccountResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + 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 AccountingCreateAccountResponse 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, ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - 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 AccountingCreateAccountResponse 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": AccountingCreateAccountResponseAllOfData.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 -try: - AccountingCreateAccountResponseAccountingAccount.model_rebuild() -except NameError: - pass -try: - AccountingCreateAccountResponse.model_rebuild() -except NameError: - pass +class AccountingCreateAccountResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateAccountResponse, 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[AccountingCreateAccountResponseAllOfData]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatebankaccountresponse.py b/lending/src/codat_lending/models/shared/accountingcreatebankaccountresponse.py index c0e87d349..bf4edb0f9 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatebankaccountresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatebankaccountresponse.py @@ -1,504 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingbankaccounttype import AccountingBankAccountType -from .bankaccountstatus import BankAccountStatus -from .datatype import DataType -from .metadata import Metadata, MetadataTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .validation import Validation, ValidationTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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, deprecated - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateBankAccountResponseAccountingBankAccountTypedDict(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/lending-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[AccountingBankAccountType] - 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 AccountingCreateBankAccountResponseAccountingBankAccount(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/lending-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. - """ +""" + Lending - account_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountName") - ] = UNSET - r"""Name of the bank account in the accounting software.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - account_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="accountNumber") - ] = UNSET - r"""Account number for the bank account. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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. + Do not edit the class manually. +""" # noqa: E501 - FreeAgent integrations - For Credit accounts, only the last four digits are required. For other types, the field is optional. - """ - - account_type: Annotated[ - Optional[AccountingBankAccountType], 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. - - 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. - """ - - 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[SupplementalData], 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. - """ +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_bank_account_response_all_of_data import AccountingCreateBankAccountResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateBankAccountResponse(BaseModel): @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", - ] - ) + 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 AccountingCreateBankAccountResponseTypedDict(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[AccountingCreateBankAccountResponseAccountingBankAccountTypedDict] - ] - 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 AccountingCreateBankAccountResponse(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. - """ - + _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) + } + """ + AccountingCreateBankAccountResponse + """ # 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="Available data types", 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` + 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[AccountingCreateBankAccountResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - > 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[AccountingCreateBankAccountResponseAccountingBankAccount] = ( - UNSET - ) + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" + 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()) - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCreateBankAccountResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - 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.""" + * `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( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] - ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - 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 AccountingCreateBankAccountResponse 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": AccountingCreateBankAccountResponseAllOfData.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 -try: - AccountingCreateBankAccountResponseAccountingBankAccount.model_rebuild() -except NameError: - pass -try: - AccountingCreateBankAccountResponse.model_rebuild() -except NameError: - pass +class AccountingCreateBankAccountResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateBankAccountResponse, 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[AccountingCreateBankAccountResponseAllOfData]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatebanktransactions.py b/lending/src/codat_lending/models/shared/accountingcreatebanktransactions.py index 4b2e65c58..1ee25fc50 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatebanktransactions.py +++ b/lending/src/codat_lending/models/shared/accountingcreatebanktransactions.py @@ -1,47 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .createbankaccounttransaction import ( - CreateBankAccountTransaction, - CreateBankAccountTransactionTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountingCreateBankTransactionsTypedDict(TypedDict): - account_id: NotRequired[str] - r"""Unique identifier for a bank account.""" - transactions: NotRequired[List[CreateBankAccountTransactionTypedDict]] + 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 AccountingCreateBankTransactions(BaseModel): - account_id: Annotated[Optional[str], pydantic.Field(alias="accountId")] = None - r"""Unique identifier for a bank account.""" - transactions: Optional[List[CreateBankAccountTransaction]] = None +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_lending.models.shared.createbankaccounttransaction import CreateBankAccountTransaction, CreateBankAccountTransactionTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class AccountingCreateBankTransactions(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountId", "transactions"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AccountingCreateBankTransactions + """ # noqa: E501 + account_id: Optional[str] = Field(default=None, description="Unique identifier for a bank account.", alias="accountId") + transactions: Optional[List[CreateBankAccountTransaction]] = None + __properties: ClassVar[List[str]] = ["accountId", "transactions"] + + 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)) + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + 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()) - return m + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCreateBankTransactions 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: - AccountingCreateBankTransactions.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 AccountingCreateBankTransactions 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": [CreateBankAccountTransaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None + }) + return _obj + + + + + +class AccountingCreateBankTransactionsTypedDict(TypedDict): + """TypedDict variant of AccountingCreateBankTransactions, for dict-literal request/response inputs.""" + account_id: NotRequired[Optional[str]] + transactions: NotRequired[Optional[List[CreateBankAccountTransactionTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatebanktransactionsresponse.py b/lending/src/codat_lending/models/shared/accountingcreatebanktransactionsresponse.py index ed455a54f..235fbf7d6 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatebanktransactionsresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatebanktransactionsresponse.py @@ -1,266 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .createbankaccounttransaction import ( - CreateBankAccountTransaction, - CreateBankAccountTransactionTypedDict, -) -from .datatype import DataType -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .validation import Validation, ValidationTypedDict -from codat_lending.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, deprecated +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateBankAccountTransactionsTypedDict(TypedDict): - account_id: NotRequired[str] - r"""Unique identifier for a bank account.""" - transactions: NotRequired[List[CreateBankAccountTransactionTypedDict]] + 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 -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateBankAccountTransactions(BaseModel): - account_id: Annotated[Optional[str], pydantic.Field(alias="accountId")] = None - r"""Unique identifier for a bank account.""" - transactions: Optional[List[CreateBankAccountTransaction]] = None +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_bank_transactions_response_all_of_data import AccountingCreateBankTransactionsResponseAllOfData, AccountingCreateBankTransactionsResponseAllOfDataTypedDict +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateBankTransactionsResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountId", "transactions"]) + 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)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class AccountingCreateBankTransactionsResponseTypedDict(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. + _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) + } """ + AccountingCreateBankTransactionsResponse + """ # 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="Available data types", 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: 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[AccountingCreateBankAccountTransactionsTypedDict] - 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 AccountingCreateBankTransactionsResponse(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. - """ - - 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: Optional[AccountingCreateBankAccountTransactions] = None - - 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.""" - + error_message: OptionalNullable[str] = Field(default=UNSET, description="A message about the error.", alias="errorMessage") 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"] + status_code: int = Field(description="Push status code.", alias="statusCode") + data: Optional[AccountingCreateBankTransactionsResponseAllOfData] = None + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + 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 AccountingCreateBankTransactionsResponse 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, ) - 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 AccountingCreateBankTransactionsResponse 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": AccountingCreateBankTransactionsResponseAllOfData.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 -try: - AccountingCreateBankAccountTransactions.model_rebuild() -except NameError: - pass -try: - AccountingCreateBankTransactionsResponse.model_rebuild() -except NameError: - pass +class AccountingCreateBankTransactionsResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateBankTransactionsResponse, 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[AccountingCreateBankTransactionsResponseAllOfDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatedirectcostresponse.py b/lending/src/codat_lending/models/shared/accountingcreatedirectcostresponse.py index 5cda46b92..9a619a020 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatedirectcostresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatedirectcostresponse.py @@ -1,547 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .contactref import ContactRef, ContactRefTypedDict -from .datatype import DataType -from .directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict -from .metadata import Metadata, MetadataTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .validation import Validation, ValidationTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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, deprecated - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateDirectCostResponseAccountingDirectCostTypedDict(TypedDict): - r"""> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - - ## Overview - - Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - - Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - - Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - """ - - 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. - """ - issue_date: 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. - """ - line_items: List[DirectCostLineItemTypedDict] - r"""An array of line items.""" - payment_allocations: List[AccountingPaymentAllocationTypedDict] - r"""An array of payment allocations.""" - sub_total: Decimal - r"""The total amount of the direct costs, excluding any taxes.""" - tax_amount: Decimal - r"""The total amount of tax on the direct costs.""" - total_amount: Decimal - r"""The amount of the direct costs, inclusive of tax.""" - contact_ref: NotRequired[ContactRefTypedDict] - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier of the direct cost, unique for the company.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""A note attached to the direct cost.""" - reference: NotRequired[Nullable[str]] - r"""User-friendly reference for the direct cost.""" - source_modified_date: NotRequired[str] - 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 AccountingCreateDirectCostResponseAccountingDirectCost(BaseModel): - r"""> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - - ## Overview - - Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - - Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - - Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - """ - - 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. - """ - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - 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. - """ - - line_items: Annotated[List[DirectCostLineItem], pydantic.Field(alias="lineItems")] - r"""An array of line items.""" - - payment_allocations: Annotated[ - List[AccountingPaymentAllocation], pydantic.Field(alias="paymentAllocations") - ] - r"""An array of payment allocations.""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""The total amount of the direct costs, excluding any taxes.""" - - tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] - r"""The total amount of tax on the direct costs.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""The amount of the direct costs, inclusive of tax.""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None - ) - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP +""" + Lending - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ## Examples with base currency of USD + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + Do not edit the class manually. +""" # noqa: E501 - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - id: Optional[str] = None - r"""Identifier of the direct cost, unique for the company.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""A note attached to the direct cost.""" - - reference: OptionalNullable[str] = UNSET - r"""User-friendly reference for the direct cost.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_direct_cost_response_all_of_data import AccountingCreateDirectCostResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateDirectCostResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "contactRef", - "currencyRate", - "id", - "metadata", - "modifiedDate", - "note", - "reference", - "sourceModifiedDate", - "supplementalData", - ] - ) - nullable_fields = set(["currencyRate", "note", "reference"]) + 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 AccountingCreateDirectCostResponseTypedDict(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. + _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) + } """ - data: NotRequired[ - Nullable[AccountingCreateDirectCostResponseAccountingDirectCostTypedDict] - ] - 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 AccountingCreateDirectCostResponse(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. - """ - + AccountingCreateDirectCostResponse + """ # 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="Available data types", 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` + 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[AccountingCreateDirectCostResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - > 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[AccountingCreateDirectCostResponseAccountingDirectCost] = ( - UNSET - ) + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" + 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()) - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCreateDirectCostResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - 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.""" + * `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( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - 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 AccountingCreateDirectCostResponse 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": AccountingCreateDirectCostResponseAllOfData.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 -try: - AccountingCreateDirectCostResponseAccountingDirectCost.model_rebuild() -except NameError: - pass -try: - AccountingCreateDirectCostResponse.model_rebuild() -except NameError: - pass +class AccountingCreateDirectCostResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateDirectCostResponse, 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[AccountingCreateDirectCostResponseAllOfData]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatepaymentresponse.py b/lending/src/codat_lending/models/shared/accountingcreatepaymentresponse.py index 900781a39..26b707d0e 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatepaymentresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatepaymentresponse.py @@ -1,1861 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .accountref import AccountRef, AccountRefTypedDict -from .datatype import DataType -from .metadata import Metadata, MetadataTypedDict -from .paymentline import PaymentLine, PaymentLineTypedDict -from .paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .validation import Validation, ValidationTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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, deprecated - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreatePaymentResponseAccountingPaymentTypedDict(TypedDict): - r"""> **Payments or bill payments?** - > - > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - - ## Overview - - Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - - - A payment made against an invoice, like a credit card, cheque, or cash payment. - - An allocation of a customer's credit note, either to an invoice or maybe a refund. - - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - - Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - - In Codat, a payment contains details of: - - - When the payment was recorded in the accounting system. - - How much it is for and in what currency that amount is in. - - Who the payment was _paid by_ – the _customer_. - - The payment method used. - - The breakdown of the types of payments – the _line items_. - - Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - ## Payment types - - ## Payment of an invoice - - A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - - - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Payment of multiple invoices - - A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - - - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - - Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - - ## Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - - - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the customer. - - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - - It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - - ## Using a credit note to pay an invoice - - The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - - A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Refunding a credit note - - A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - - ## Refunding a payment - - If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - - - One for the incoming over payment. - - Another for the outgoing refund. - - The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - - - An **amount** that indicates the amount that was refunded. This is always negative. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - - The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - - The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - - For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - - - One for £1,000 linked to the invoice that was paid. - - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - - The **line** linked to the payment has the following properties: - - - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - - > **Support for linked payments** - > - > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are included in the payments data type: - - Payment currency rate: - - - Base currency of the accounts receivable account. - - Foreign currency of the payment. - - Payment line link currency rate: - - - Base currency of the item the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - - - The base currency for the accounts receivable account. - - The currency of the item. - - ```json title=\"Currency rate example\" - { - \"id\": \"123\", - \"note\": \"\", - \"totalAmount\": 99.99, - \"currency\": \"GBP\", - \"lines\": [ - { - \"amount\": 99.99, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"178\", - \"amount\": -50, - \"currencyRate\": 1.9998 - } - ] - } - ] - } - ``` - - - - ## Example data - - > **Object properties** - > - > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - - ## Simple examples - - ```json title=\"Payment for invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Allocation of credit note\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Payment of invoice and payment on account\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund of credit note\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund on accounts receivable account\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Linked refund on accounts receivable account\" - { - \"id\" : \"payment-001\", - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Using a credit note and cash to pay an invoice\" - { - \"totalAmount\": 250, - \"lines\": [ - { - \"amount\": 0, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -750 - }, - { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - } - ] - }, - { - \"amount\": 250, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -250 - } - ] - } - ] - } - ``` - - - - ## Complex examples - - ```json title=\"Use two credit notes and 1000 in to \"bank\" (cash, cheque etc.) to pay invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Pay an invoice with two credit notes and cash, with 1000 left 'on account'\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"customer-001\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes pay two invoices with no allocation amount specified\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"u\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title=\"January\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-01-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 4000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title=\"February\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-02-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-y\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 3000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and some cash pay two invoices with no allocations specified\" - { - \"totalAmount\": 500, - \"lines\": [ - { - \"amount\": 500, - \"links\": [{ - \"type\": \"Invoice\", - \"id\": \"a\", - \"amount\": -1000 - }, { - \"type\": \"Invoice\", - \"id\": \"b\", - \"amount\": -1000 - }, { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - },{ - \"type\": \"CreditNote\", - \"id\": \"z\", - \"amount\": 750 - } - ] - } - ] - } - ``` - """ - - date_: 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. - """ - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - id: NotRequired[str] - r"""Identifier for the payment, unique to the company in the accounting software.""" - lines: NotRequired[Nullable[List[PaymentLineTypedDict]]] - r"""An array of payment lines.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any additional information associated with the payment.""" - payment_method_ref: NotRequired[PaymentMethodRefTypedDict] - r"""The payment method the record is linked to in the accounting or commerce software.""" - reference: NotRequired[Nullable[str]] - r"""Friendly reference for the payment.""" - source_modified_date: NotRequired[str] - 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. - """ - total_amount: NotRequired[Decimal] - r"""Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.""" - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreatePaymentResponseAccountingPayment(BaseModel): - r"""> **Payments or bill payments?** - > - > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - - ## Overview - - Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - - - A payment made against an invoice, like a credit card, cheque, or cash payment. - - An allocation of a customer's credit note, either to an invoice or maybe a refund. - - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - - Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - - In Codat, a payment contains details of: - - - When the payment was recorded in the accounting system. - - How much it is for and in what currency that amount is in. - - Who the payment was _paid by_ – the _customer_. - - The payment method used. - - The breakdown of the types of payments – the _line items_. - - Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - ## Payment types - - ## Payment of an invoice - - A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - - - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Payment of multiple invoices - - A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - - - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - - Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - - ## Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - - - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the customer. - - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - - It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - - ## Using a credit note to pay an invoice - - The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - - A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Refunding a credit note - - A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - - ## Refunding a payment +""" + Lending - If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - One for the incoming over payment. - - Another for the outgoing refund. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: + Do not edit the class manually. +""" # noqa: E501 - - An **amount** that indicates the amount that was refunded. This is always negative. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - - The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - - For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - - - One for £1,000 linked to the invoice that was paid. - - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - - The **line** linked to the payment has the following properties: - - - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - - > **Support for linked payments** - > - > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are included in the payments data type: - - Payment currency rate: - - - Base currency of the accounts receivable account. - - Foreign currency of the payment. - - Payment line link currency rate: - - - Base currency of the item the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - - - The base currency for the accounts receivable account. - - The currency of the item. - - ```json title=\"Currency rate example\" - { - \"id\": \"123\", - \"note\": \"\", - \"totalAmount\": 99.99, - \"currency\": \"GBP\", - \"lines\": [ - { - \"amount\": 99.99, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"178\", - \"amount\": -50, - \"currencyRate\": 1.9998 - } - ] - } - ] - } - ``` - - - - ## Example data - - > **Object properties** - > - > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - - ## Simple examples - - ```json title=\"Payment for invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Allocation of credit note\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Payment of invoice and payment on account\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund of credit note\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund on accounts receivable account\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Linked refund on accounts receivable account\" - { - \"id\" : \"payment-001\", - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Using a credit note and cash to pay an invoice\" - { - \"totalAmount\": 250, - \"lines\": [ - { - \"amount\": 0, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -750 - }, - { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - } - ] - }, - { - \"amount\": 250, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -250 - } - ] - } - ] - } - ``` - - - - ## Complex examples - - ```json title=\"Use two credit notes and 1000 in to \"bank\" (cash, cheque etc.) to pay invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Pay an invoice with two credit notes and cash, with 1000 left 'on account'\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"customer-001\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes pay two invoices with no allocation amount specified\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"u\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title=\"January\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-01-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 4000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title=\"February\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-02-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-y\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 3000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and some cash pay two invoices with no allocations specified\" - { - \"totalAmount\": 500, - \"lines\": [ - { - \"amount\": 500, - \"links\": [{ - \"type\": \"Invoice\", - \"id\": \"a\", - \"amount\": -1000 - }, { - \"type\": \"Invoice\", - \"id\": \"b\", - \"amount\": -1000 - }, { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - },{ - \"type\": \"CreditNote\", - \"id\": \"z\", - \"amount\": 750 - } - ] - } - ] - } - ``` - """ - - date_: Annotated[str, pydantic.Field(alias="date")] - 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. - """ - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None - - id: Optional[str] = None - r"""Identifier for the payment, unique to the company in the accounting software.""" - - lines: OptionalNullable[List[PaymentLine]] = UNSET - r"""An array of payment lines.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Any additional information associated with the payment.""" - - payment_method_ref: Annotated[ - Optional[PaymentMethodRef], pydantic.Field(alias="paymentMethodRef") - ] = None - r"""The payment method the record is linked to in the accounting or commerce software.""" - - reference: OptionalNullable[str] = UNSET - r"""Friendly reference for the payment.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.""" +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_payment_response_all_of_data import AccountingCreatePaymentResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreatePaymentResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "currency", - "currencyRate", - "customerRef", - "id", - "lines", - "metadata", - "modifiedDate", - "note", - "paymentMethodRef", - "reference", - "sourceModifiedDate", - "supplementalData", - "totalAmount", - ] - ) - nullable_fields = set(["currencyRate", "lines", "note", "reference"]) + 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 AccountingCreatePaymentResponseTypedDict(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. + _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) + } """ + AccountingCreatePaymentResponse + """ # 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="Available data types", 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: 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[AccountingCreatePaymentResponseAccountingPaymentTypedDict] - ] - 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 AccountingCreatePaymentResponse(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. - """ - - 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` + 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[AccountingCreatePaymentResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - > 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[AccountingCreatePaymentResponseAccountingPayment] = UNSET + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" + 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()) - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCreatePaymentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - 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.""" + * `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( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - 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 AccountingCreatePaymentResponse 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": AccountingCreatePaymentResponseAllOfData.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 -try: - AccountingCreatePaymentResponseAccountingPayment.model_rebuild() -except NameError: - pass -try: - AccountingCreatePaymentResponse.model_rebuild() -except NameError: - pass +class AccountingCreatePaymentResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreatePaymentResponse, 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[AccountingCreatePaymentResponseAllOfData]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatesupplierresponse.py b/lending/src/codat_lending/models/shared/accountingcreatesupplierresponse.py index 00b0ef63e..365db9f44 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatesupplierresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatesupplierresponse.py @@ -1,392 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingaddress import AccountingAddress, AccountingAddressTypedDict -from .datatype import DataType -from .metadata import Metadata, MetadataTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .supplierstatus import SupplierStatus -from .validation import Validation, ValidationTypedDict -from codat_lending.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, deprecated - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateSupplierResponseAccountingSupplierTypedDict(TypedDict): - r"""## Overview - - From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). - """ - - status: SupplierStatus - r"""Status of the supplier.""" - addresses: NotRequired[Nullable[List[AccountingAddressTypedDict]]] - r"""An array of Addresses.""" - contact_name: NotRequired[Nullable[str]] - r"""Name of the main contact for the supplier.""" - default_currency: NotRequired[Nullable[str]] - r"""Default currency the supplier's transactional data is recorded in.""" - email_address: NotRequired[Nullable[str]] - r"""Email address that the supplier may be contacted on.""" - id: NotRequired[str] - r"""Identifier for the supplier, unique to the company in the accounting software.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - phone: NotRequired[Nullable[str]] - r"""Phone number that the supplier may be contacted on.""" - registration_number: NotRequired[Nullable[str]] - r"""Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.""" - source_modified_date: NotRequired[str] - 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. - """ - supplier_name: NotRequired[Nullable[str]] - r"""Name of the supplier as recorded in the accounting system, typically the company name.""" - tax_number: NotRequired[Nullable[str]] - r"""Supplier's company tax number.""" - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateSupplierResponseAccountingSupplier(BaseModel): - r"""## Overview - - From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). - """ - - status: SupplierStatus - r"""Status of the supplier.""" - - addresses: OptionalNullable[List[AccountingAddress]] = UNSET - r"""An array of Addresses.""" - - contact_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="contactName") - ] = UNSET - r"""Name of the main contact for the supplier.""" - - default_currency: Annotated[ - OptionalNullable[str], pydantic.Field(alias="defaultCurrency") - ] = UNSET - r"""Default currency the supplier's transactional data is recorded in.""" - - email_address: Annotated[ - OptionalNullable[str], pydantic.Field(alias="emailAddress") - ] = UNSET - r"""Email address that the supplier may be contacted on.""" - - id: Optional[str] = None - r"""Identifier for the supplier, unique to the company in the accounting software.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None +""" + Lending - phone: OptionalNullable[str] = UNSET - r"""Phone number that the supplier may be contacted on.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - registration_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="registrationNumber") - ] = UNSET - r"""Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + Do not edit the class manually. +""" # noqa: E501 - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - supplier_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="supplierName") - ] = UNSET - r"""Name of the supplier as recorded in the accounting system, typically the company name.""" - - tax_number: Annotated[OptionalNullable[str], pydantic.Field(alias="taxNumber")] = ( - UNSET - ) - r"""Supplier's company tax number.""" +from __future__ import annotations +from codat_lending.models.shared.datatype import DataType +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_lending.models.accounting_create_supplier_response_all_of_data import AccountingCreateSupplierResponseAllOfData +from codat_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCreateSupplierResponse(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "addresses", - "contactName", - "defaultCurrency", - "emailAddress", - "id", - "metadata", - "modifiedDate", - "phone", - "registrationNumber", - "sourceModifiedDate", - "supplementalData", - "supplierName", - "taxNumber", - ] - ) - nullable_fields = set( - [ - "addresses", - "contactName", - "defaultCurrency", - "emailAddress", - "phone", - "registrationNumber", - "supplierName", - "taxNumber", - ] - ) + 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 AccountingCreateSupplierResponseTypedDict(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. + _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) + } """ + AccountingCreateSupplierResponse + """ # 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="Available data types", 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: 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[AccountingCreateSupplierResponseAccountingSupplierTypedDict] - ] - 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 AccountingCreateSupplierResponse(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. - """ - - 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` + 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[AccountingCreateSupplierResponseAllOfData] = UNSET + __properties: ClassVar[List[str]] = ["changes", "dataType", "companyId", "pushOperationKey", "dataConnectionKey", "requestedOnUtc", "completedOnUtc", "timeoutInMinutes", "timeoutInSeconds", "status", "errorMessage", "validation", "statusCode", "data"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - > 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[AccountingCreateSupplierResponseAccountingSupplier] = UNSET + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - data_type: Annotated[Optional[DataType], pydantic.Field(alias="dataType")] = None - r"""Available data types""" + 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()) - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about the error.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCreateSupplierResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - 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.""" + * `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( - [ - "changes", - "completedOnUtc", - "data", - "dataType", - "errorMessage", - "timeoutInMinutes", - "timeoutInSeconds", - "validation", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set( - ["changes", "data", "errorMessage", "timeoutInMinutes", "timeoutInSeconds"] - ) - 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 AccountingCreateSupplierResponse 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": AccountingCreateSupplierResponseAllOfData.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 -try: - AccountingCreateSupplierResponseAccountingSupplier.model_rebuild() -except NameError: - pass -try: - AccountingCreateSupplierResponse.model_rebuild() -except NameError: - pass +class AccountingCreateSupplierResponseTypedDict(TypedDict): + """TypedDict variant of AccountingCreateSupplierResponse, 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[AccountingCreateSupplierResponseAllOfData]] diff --git a/lending/src/codat_lending/models/shared/accountingcreatetransferresponse.py b/lending/src/codat_lending/models/shared/accountingcreatetransferresponse.py index 28372a97f..209d56985 100644 --- a/lending/src/codat_lending/models/shared/accountingcreatetransferresponse.py +++ b/lending/src/codat_lending/models/shared/accountingcreatetransferresponse.py @@ -1,416 +1,11 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from .contactref import ContactRef, ContactRefTypedDict -from .datatype import DataType -from .metadata import Metadata, MetadataTypedDict -from .pushoperationchange import PushOperationChange, PushOperationChangeTypedDict -from .pushoperationstatus import PushOperationStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from .transferaccount import TransferAccount, TransferAccountTypedDict -from .validation import Validation, ValidationTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) + from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict, deprecated class AccountingCreateTransferResponseStatus(str, Enum): - r"""The status of the transfer in the account""" - - UNKNOWN = "Unknown" - UNRECONCILED = "Unreconciled" - RECONCILED = "Reconciled" - VOID = "Void" - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateTransferResponseAccountingTransferTypedDict(TypedDict): - r"""A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction).""" - - contact_ref: NotRequired[ContactRefTypedDict] - 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. - """ - deposited_record_refs: NotRequired[Nullable[List[AccountingRecordRefTypedDict]]] - r"""List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.""" - description: NotRequired[Nullable[str]] - r"""Description of the transfer.""" - from_: NotRequired[TransferAccountTypedDict] - r"""Account details of the account sending or receiving the transfer.""" - id: NotRequired[str] - r"""Unique identifier for the transfer.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - source_modified_date: NotRequired[str] - status: NotRequired[Nullable[AccountingCreateTransferResponseStatus]] - r"""The status of the transfer in the 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. - """ - to: NotRequired[TransferAccountTypedDict] - r"""Account details of the account sending or receiving the transfer.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Reference to the tracking categories this transfer is being tracked against.""" - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class AccountingCreateTransferResponseAccountingTransfer(BaseModel): - r"""A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction).""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None - ) - - 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: - - ``` - 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. - """ - - deposited_record_refs: Annotated[ - OptionalNullable[List[AccountingRecordRef]], - pydantic.Field(alias="depositedRecordRefs"), - ] = UNSET - r"""List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.""" - - description: OptionalNullable[str] = UNSET - r"""Description of the transfer.""" - - from_: Annotated[Optional[TransferAccount], pydantic.Field(alias="from")] = None - r"""Account details of the account sending or receiving the transfer.""" - - id: Optional[str] = None - r"""Unique identifier for the transfer.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - status: OptionalNullable[AccountingCreateTransferResponseStatus] = UNSET - r"""The status of the transfer in the account""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - to: Optional[TransferAccount] = None - r"""Account details of the account sending or receiving the transfer.""" - - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field(alias="trackingCategoryRefs"), - ] = UNSET - r"""Reference to the tracking categories this transfer is being tracked against.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "contactRef", - "date", - "depositedRecordRefs", - "description", - "from", - "id", - "metadata", - "modifiedDate", - "sourceModifiedDate", - "status", - "supplementalData", - "to", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - ["depositedRecordRefs", "description", "status", "trackingCategoryRefs"] - ) - 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 AccountingCreateTransferResponseTypedDict(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[AccountingCreateTransferResponseAccountingTransferTypedDict] - ] - 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 AccountingCreateTransferResponse(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. - """ - - 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[AccountingCreateTransferResponseAccountingTransfer] = 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: - AccountingCreateTransferResponseAccountingTransfer.model_rebuild() -except NameError: - pass -try: - AccountingCreateTransferResponse.model_rebuild() -except NameError: - pass + """Speakeasy-name compat for AccountingTransferStatus (matched by value set).""" + UNKNOWN = 'Unknown' + UNRECONCILED = 'Unreconciled' + RECONCILED = 'Reconciled' + VOID = 'Void' diff --git a/lending/src/codat_lending/models/shared/accountingcreditnote.py b/lending/src/codat_lending/models/shared/accountingcreditnote.py index f1dd92d7c..86af9ba9b 100644 --- a/lending/src/codat_lending/models/shared/accountingcreditnote.py +++ b/lending/src/codat_lending/models/shared/accountingcreditnote.py @@ -1,467 +1,212 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .creditnotelineitem import CreditNoteLineItem, CreditNoteLineItemTypedDict -from .creditnotestatus import CreditNoteStatus -from .items import Items, ItemsTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingCreditNoteTypedDict(TypedDict): - r"""## Overview - - Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. - - In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/lending-api#/schemas/Customer) accounts receivable. - - It contains details of: - * The amount of credit remaining and its status. - * Payment allocations against the payments type, in this case an invoice. - * Which customers the credit notes have been issued to. - """ - - discount_percentage: Decimal - r"""Percentage rate (from 0 to 100) of discounts applied to the credit note.""" - remaining_credit: Decimal - r"""Unused balance of totalAmount originally raised.""" - status: CreditNoteStatus - r"""Current state of the credit note.""" - sub_total: Decimal - r"""Value of the credit note, including discounts and excluding tax.""" - total_amount: Decimal - r"""Total amount of credit that has been applied to the customer's accounts receivable""" - total_discount: Decimal - r"""Any discounts applied to the credit note amount.""" - total_tax_amount: Decimal - r"""Any tax applied to the credit note amount.""" - additional_tax_amount: NotRequired[Decimal] - r"""Additional tax amount applied to credit note.""" - additional_tax_percentage: NotRequired[Decimal] - r"""Percentage rate of any additional tax applied to the credit note.""" - allocated_on_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. - """ - credit_note_number: NotRequired[Nullable[str]] - r"""Friendly reference for the credit note.""" - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | +""" + Lending - ## Examples with base currency of USD + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - id: NotRequired[str] - r"""Identifier for the credit note, unique to the company in the accounting software.""" - issue_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. - """ - line_items: NotRequired[Nullable[List[CreditNoteLineItemTypedDict]]] - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer.""" - payment_allocations: NotRequired[ - Nullable[List[AccountingPaymentAllocationTypedDict]] - ] - r"""An array of payment allocations.""" - source_modified_date: NotRequired[str] - 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. - """ - withholding_tax: NotRequired[Nullable[List[ItemsTypedDict]]] + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.shared.creditnotelineitem import CreditNoteLineItem, CreditNoteLineItemTypedDict +from codat_lending.models.shared.creditnotestatus import CreditNoteStatus +from codat_lending.models.shared.items import Items, ItemsTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingCreditNote(BaseModel): - r"""## Overview - - Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. - - In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/lending-api#/schemas/Customer) accounts receivable. - - It contains details of: - * The amount of credit remaining and its status. - * Payment allocations against the payments type, in this case an invoice. - * Which customers the credit notes have been issued to. - """ - - discount_percentage: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] - r"""Percentage rate (from 0 to 100) of discounts applied to the credit note.""" - - remaining_credit: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="remainingCredit"), - ] - r"""Unused balance of totalAmount originally raised.""" - - status: CreditNoteStatus - r"""Current state of the credit note.""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""Value of the credit note, including discounts and excluding tax.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""Total amount of credit that has been applied to the customer's accounts receivable""" - - total_discount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalDiscount"), - ] - r"""Any discounts applied to the credit note amount.""" - - total_tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalTaxAmount"), - ] - r"""Any tax applied to the credit note amount.""" - - additional_tax_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="additionalTaxAmount"), - ] = None - r"""Additional tax amount applied to credit note.""" - additional_tax_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="additionalTaxPercentage"), - ] = None - r"""Percentage rate of any additional tax applied to the credit note.""" - - allocated_on_date: Annotated[ - Optional[str], pydantic.Field(alias="allocatedOnDate") - ] = 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. - """ - - credit_note_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="creditNoteNumber") - ] = UNSET - r"""Friendly reference for the credit note.""" - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None - - id: Optional[str] = None - r"""Identifier for the credit note, unique to the company in the accounting software.""" - - issue_date: Annotated[Optional[str], pydantic.Field(alias="issueDate")] = 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 = {'creditNoteNumber', 'credit_note_number', 'currencyRate', 'currency_rate', 'lineItems', 'line_items', 'note', 'paymentAllocations', 'payment_allocations', 'withholdingTax', 'withholding_tax'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - line_items: Annotated[ - OptionalNullable[List[CreditNoteLineItem]], pydantic.Field(alias="lineItems") - ] = UNSET - + ## Overview Think of a credit note as a voucher issued to a customer. It is a reduction that can be applied against one or multiple invoices. A credit note can either reduce the amount owed or cancel out an invoice entirely. In the Codat system a credit note is issued to a [customer's](https://docs.codat.io/lending-api#/schemas/Customer) accounts receivable. It contains details of: * The amount of credit remaining and its status. * Payment allocations against the payments type, in this case an invoice. * Which customers the credit notes have been issued to. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the credit note, unique to the company in the accounting software.") + credit_note_number: OptionalNullable[str] = Field(default=UNSET, description="Friendly reference for the credit note.", alias="creditNoteNumber") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, description="Reference to the customer the credit note has been issued to.", alias="customerRef") + withholding_tax: OptionalNullable[List[Items]] = Field(default=UNSET, alias="withholdingTax") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Total amount of credit that has been applied to the customer's accounts receivable", alias="totalAmount") + total_discount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Any discounts applied to the credit note amount.", alias="totalDiscount") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Value of the credit note, including discounts and excluding tax.", alias="subTotal") + additional_tax_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Additional tax amount applied to credit note.", alias="additionalTaxAmount") + additional_tax_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Percentage rate of any additional tax applied to the credit note.", alias="additionalTaxPercentage") + total_tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Any tax applied to the credit note amount.", alias="totalTaxAmount") + discount_percentage: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Percentage rate (from 0 to 100) of discounts applied to the credit note.", alias="discountPercentage") + remaining_credit: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Unused balance of totalAmount originally raised.", alias="remainingCredit") + status: CreditNoteStatus = Field(description="Current state of the credit note.") + issue_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="issueDate") + allocated_on_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="allocatedOnDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: OptionalNullable[List[CreditNoteLineItem]] = Field(default=UNSET, alias="lineItems") + payment_allocations: OptionalNullable[List[AccountingPaymentAllocation]] = Field(default=UNSET, description="An array of payment allocations.", alias="paymentAllocations") + note: OptionalNullable[str] = Field(default=UNSET, description="Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer.") metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Any additional information about the credit note. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when a credit note is emailed from the accounting software to the customer.""" - - payment_allocations: Annotated[ - OptionalNullable[List[AccountingPaymentAllocation]], - pydantic.Field(alias="paymentAllocations"), - ] = UNSET - r"""An array of payment allocations.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - withholding_tax: Annotated[ - OptionalNullable[List[Items]], pydantic.Field(alias="withholdingTax") - ] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "additionalTaxAmount", - "additionalTaxPercentage", - "allocatedOnDate", - "creditNoteNumber", - "currency", - "currencyRate", - "customerRef", - "id", - "issueDate", - "lineItems", - "metadata", - "modifiedDate", - "note", - "paymentAllocations", - "sourceModifiedDate", - "supplementalData", - "withholdingTax", - ] + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "creditNoteNumber", "customerRef", "withholdingTax", "totalAmount", "totalDiscount", "subTotal", "additionalTaxAmount", "additionalTaxPercentage", "totalTaxAmount", "discountPercentage", "remainingCredit", "status", "issueDate", "allocatedOnDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "note", "metadata", "supplementalData"] + + 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 AccountingCreditNote 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, ) - nullable_fields = set( - [ - "creditNoteNumber", - "currencyRate", - "lineItems", - "note", - "paymentAllocations", - "withholdingTax", - ] - ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in withholding_tax (list) + _items = [] + if self.withholding_tax: + for _item_withholding_tax in self.withholding_tax: + if _item_withholding_tax: + _items.append(_item_withholding_tax.to_dict()) + _dict['withholdingTax'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # 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 AccountingCreditNote from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "creditNoteNumber": obj.get("creditNoteNumber"), + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "withholdingTax": [Items.from_dict(_item) for _item in obj["withholdingTax"]] if obj.get("withholdingTax") is not None else None, + "totalAmount": obj.get("totalAmount"), + "totalDiscount": obj.get("totalDiscount"), + "subTotal": obj.get("subTotal"), + "additionalTaxAmount": obj.get("additionalTaxAmount"), + "additionalTaxPercentage": obj.get("additionalTaxPercentage"), + "totalTaxAmount": obj.get("totalTaxAmount"), + "discountPercentage": obj.get("discountPercentage"), + "remainingCredit": obj.get("remainingCredit"), + "status": obj.get("status"), + "issueDate": obj.get("issueDate"), + "allocatedOnDate": obj.get("allocatedOnDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [CreditNoteLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "note": obj.get("note"), + "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 + }) + 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 -try: - AccountingCreditNote.model_rebuild() -except NameError: - pass +class AccountingCreditNoteTypedDict(TypedDict): + """TypedDict variant of AccountingCreditNote, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + credit_note_number: NotRequired[Optional[str]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + withholding_tax: NotRequired[Optional[List[ItemsTypedDict]]] + total_amount: NotRequired[Decimal] + total_discount: NotRequired[Decimal] + sub_total: NotRequired[Decimal] + additional_tax_amount: NotRequired[Optional[Decimal]] + additional_tax_percentage: NotRequired[Optional[Decimal]] + total_tax_amount: NotRequired[Decimal] + discount_percentage: NotRequired[Decimal] + remaining_credit: NotRequired[Decimal] + status: NotRequired[CreditNoteStatus] + issue_date: NotRequired[Optional[str]] + allocated_on_date: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[Optional[List[CreditNoteLineItemTypedDict]]] + payment_allocations: NotRequired[Optional[List[AccountingPaymentAllocationTypedDict]]] + note: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingcreditnotes.py b/lending/src/codat_lending/models/shared/accountingcreditnotes.py index 6578e82e2..94703c549 100644 --- a/lending/src/codat_lending/models/shared/accountingcreditnotes.py +++ b/lending/src/codat_lending/models/shared/accountingcreditnotes.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingcreditnote import AccountingCreditNote, AccountingCreditNoteTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingcreditnote import AccountingCreditNote, AccountingCreditNoteTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingCreditNotes(BaseModel): -class AccountingCreditNotesTypedDict(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[AccountingCreditNoteTypedDict]]] + @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} + """ + AccountingCreditNotes + """ # 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[AccountingCreditNote]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingCreditNotes(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 AccountingCreditNotes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingCreditNote]]] = 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 AccountingCreditNotes 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": [AccountingCreditNote.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingCreditNotes.model_rebuild() -except NameError: - pass + + + + +class AccountingCreditNotesTypedDict(TypedDict): + """TypedDict variant of AccountingCreditNotes, 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[AccountingCreditNoteTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingcustomer.py b/lending/src/codat_lending/models/shared/accountingcustomer.py index f38c1694b..1d6f23dad 100644 --- a/lending/src/codat_lending/models/shared/accountingcustomer.py +++ b/lending/src/codat_lending/models/shared/accountingcustomer.py @@ -1,204 +1,171 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .accountingaddress import AccountingAddress, AccountingAddressTypedDict -from .contact import Contact, ContactTypedDict -from .customerstatus import CustomerStatus -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.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 +# coding: utf-8 +""" + Lending -class AccountingCustomerTypedDict(TypedDict): - r"""## Overview + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Customers' data links to accounts receivable [invoices](https://docs.codat.io/lending-api#/schemas/Invoice). - - """ - - status: CustomerStatus - r"""Status of customer.""" - addresses: NotRequired[Nullable[List[AccountingAddressTypedDict]]] - r"""An array of Addresses.""" - contact_name: NotRequired[Nullable[str]] - r"""Name of the main contact for the identified customer.""" - contacts: NotRequired[Nullable[List[ContactTypedDict]]] - r"""An array of Contacts.""" - customer_name: NotRequired[Nullable[str]] - r"""Name of the customer as recorded in the accounting system, typically the company name.""" - default_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. - """ - email_address: NotRequired[Nullable[str]] - r"""Email address the customer can be contacted by.""" - id: NotRequired[str] - r"""Identifier for the customer, unique to the company in the accounting software.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - phone: NotRequired[Nullable[str]] - r"""Phone number the customer can be contacted by.""" - registration_number: NotRequired[Nullable[str]] - r"""Company number. In the UK, this is typically the Companies House company registration number.""" - source_modified_date: NotRequired[str] - 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. - """ - tax_number: NotRequired[Nullable[str]] - r"""Company tax number.""" + 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_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict +from codat_lending.models.shared.contact import Contact, ContactTypedDict +from codat_lending.models.shared.customerstatus import CustomerStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingCustomer(BaseModel): - r"""## Overview - - A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). - - Customers' data links to accounts receivable [invoices](https://docs.codat.io/lending-api#/schemas/Invoice). + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'addresses', 'contactName', 'contact_name', 'contacts', 'customerName', 'customer_name', 'emailAddress', 'email_address', 'phone', 'registrationNumber', 'registration_number', 'taxNumber', 'tax_number'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + ## Overview A customer is a person or organisation that buys goods or services. From the Customers endpoints, you can retrieve a [list of all the customers of a company](https://api.codat.io/swagger/index.html#/Customers/get_companies__companyId__data_customers). Customers' data links to accounts receivable [invoices](https://docs.codat.io/lending-api#/schemas/Invoice). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the customer, unique to the company in the accounting software.") + customer_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the customer as recorded in the accounting system, typically the company name.", alias="customerName") + contact_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the main contact for the identified customer.", alias="contactName") + email_address: OptionalNullable[str] = Field(default=UNSET, description="Email address the customer can be contacted by.", alias="emailAddress") + default_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="defaultCurrency") + phone: OptionalNullable[str] = Field(default=UNSET, description="Phone number the customer can be contacted by.") + addresses: OptionalNullable[List[AccountingAddress]] = Field(default=UNSET, description="An array of Addresses.") + contacts: OptionalNullable[List[Contact]] = Field(default=UNSET, description="An array of Contacts.") + registration_number: OptionalNullable[str] = Field(default=UNSET, description="Company number. In the UK, this is typically the Companies House company registration number.", alias="registrationNumber") + tax_number: OptionalNullable[str] = Field(default=UNSET, description="Company tax number.", alias="taxNumber") + status: CustomerStatus = Field(description="Current state of the customer.") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "customerName", "contactName", "emailAddress", "defaultCurrency", "phone", "addresses", "contacts", "registrationNumber", "taxNumber", "status", "metadata", "supplementalData"] - status: CustomerStatus - r"""Status of customer.""" - - addresses: OptionalNullable[List[AccountingAddress]] = UNSET - r"""An array of Addresses.""" - - contact_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="contactName") - ] = UNSET - r"""Name of the main contact for the identified customer.""" - - contacts: OptionalNullable[List[Contact]] = UNSET - r"""An array of Contacts.""" - - customer_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="customerName") - ] = UNSET - r"""Name of the customer as recorded in the accounting system, typically the company name.""" - - default_currency: Annotated[ - Optional[str], pydantic.Field(alias="defaultCurrency") - ] = 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 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - 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. - """ + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - email_address: Annotated[ - OptionalNullable[str], pydantic.Field(alias="emailAddress") - ] = UNSET - r"""Email address the customer can be contacted by.""" + 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()) - id: Optional[str] = None - r"""Identifier for the customer, unique to the company in the accounting software.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingCustomer from a JSON string""" + return cls.from_dict(json.loads(json_str)) - metadata: Optional[Metadata] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - phone: OptionalNullable[str] = UNSET - r"""Phone number the customer can be contacted by.""" + * `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([ + ]) - registration_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="registrationNumber") - ] = UNSET - r"""Company number. In the UK, this is typically the Companies House company registration number.""" + _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 addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in contacts (list) + _items = [] + if self.contacts: + for _item_contacts in self.contacts: + if _item_contacts: + _items.append(_item_contacts.to_dict()) + _dict['contacts'] = _items + # 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 AccountingCustomer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "customerName": obj.get("customerName"), + "contactName": obj.get("contactName"), + "emailAddress": obj.get("emailAddress"), + "defaultCurrency": obj.get("defaultCurrency"), + "phone": obj.get("phone"), + "addresses": [AccountingAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "contacts": [Contact.from_dict(_item) for _item in obj["contacts"]] if obj.get("contacts") is not None else None, + "registrationNumber": obj.get("registrationNumber"), + "taxNumber": obj.get("taxNumber"), + "status": obj.get("status"), + "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 + }) + return _obj - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - tax_number: Annotated[OptionalNullable[str], pydantic.Field(alias="taxNumber")] = ( - UNSET - ) - r"""Company tax number.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "addresses", - "contactName", - "contacts", - "customerName", - "defaultCurrency", - "emailAddress", - "id", - "metadata", - "modifiedDate", - "phone", - "registrationNumber", - "sourceModifiedDate", - "supplementalData", - "taxNumber", - ] - ) - nullable_fields = set( - [ - "addresses", - "contactName", - "contacts", - "customerName", - "emailAddress", - "phone", - "registrationNumber", - "taxNumber", - ] - ) - 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: - AccountingCustomer.model_rebuild() -except NameError: - pass +class AccountingCustomerTypedDict(TypedDict): + """TypedDict variant of AccountingCustomer, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + customer_name: NotRequired[Optional[str]] + contact_name: NotRequired[Optional[str]] + email_address: NotRequired[Optional[str]] + default_currency: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[AccountingAddressTypedDict]]] + contacts: NotRequired[Optional[List[ContactTypedDict]]] + registration_number: NotRequired[Optional[str]] + tax_number: NotRequired[Optional[str]] + status: NotRequired[CustomerStatus] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingcustomerref.py b/lending/src/codat_lending/models/shared/accountingcustomerref.py index 7bfbf9b96..461b668c7 100644 --- a/lending/src/codat_lending/models/shared/accountingcustomerref.py +++ b/lending/src/codat_lending/models/shared/accountingcustomerref.py @@ -1,61 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountingCustomerRefTypedDict(TypedDict): - id: str - r"""`id` from the Customers data type""" - company_name: NotRequired[Nullable[str]] - r"""`customerName` from the Customer data type""" + 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 AccountingCustomerRef(BaseModel): - id: str - r"""`id` from the Customers data type""" - company_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="companyName") - ] = UNSET - r"""`customerName` from the Customer data type""" +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 typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingCustomerRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["companyName"]) - nullable_fields = set(["companyName"]) + 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: - AccountingCustomerRef.model_rebuild() -except NameError: - pass + _nullable = {'companyName', 'company_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + AccountingCustomerRef + """ # noqa: E501 + id: str = Field(description="`id` from the Customers data type") + company_name: OptionalNullable[str] = Field(default=UNSET, description="`customerName` from the Customer data type", alias="companyName") + __properties: ClassVar[List[str]] = ["id", "companyName"] + + 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 AccountingCustomerRef 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 AccountingCustomerRef 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"), + "companyName": obj.get("companyName") + }) + return _obj + + + + + +class AccountingCustomerRefTypedDict(TypedDict): + """TypedDict variant of AccountingCustomerRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + company_name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountingcustomers.py b/lending/src/codat_lending/models/shared/accountingcustomers.py index 6705d2502..a43eeb35e 100644 --- a/lending/src/codat_lending/models/shared/accountingcustomers.py +++ b/lending/src/codat_lending/models/shared/accountingcustomers.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingcustomer import AccountingCustomer, AccountingCustomerTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingcustomer import AccountingCustomer, AccountingCustomerTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingCustomers(BaseModel): -class AccountingCustomersTypedDict(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[AccountingCustomerTypedDict]]] + @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} + """ + AccountingCustomers + """ # 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[AccountingCustomer]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingCustomers(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 AccountingCustomers from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingCustomer]]] = 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 AccountingCustomers 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": [AccountingCustomer.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingCustomers.model_rebuild() -except NameError: - pass + + + + +class AccountingCustomersTypedDict(TypedDict): + """TypedDict variant of AccountingCustomers, 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[AccountingCustomerTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingdirectcost.py b/lending/src/codat_lending/models/shared/accountingdirectcost.py index 84f20c545..350d7ce21 100644 --- a/lending/src/codat_lending/models/shared/accountingdirectcost.py +++ b/lending/src/codat_lending/models/shared/accountingdirectcost.py @@ -1,330 +1,179 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .contactref import ContactRef, ContactRefTypedDict -from .directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingDirectCostTypedDict(TypedDict): - r"""> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - - ## Overview - - Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - - Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - - Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - """ +""" + Lending - 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_. + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ## 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. - """ - issue_date: 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. - """ - line_items: List[DirectCostLineItemTypedDict] - r"""An array of line items.""" - payment_allocations: List[AccountingPaymentAllocationTypedDict] - r"""An array of payment allocations.""" - sub_total: Decimal - r"""The total amount of the direct costs, excluding any taxes.""" - tax_amount: Decimal - r"""The total amount of tax on the direct costs.""" - total_amount: Decimal - r"""The amount of the direct costs, inclusive of tax.""" - contact_ref: NotRequired[ContactRefTypedDict] - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier of the direct cost, unique for the company.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""A note attached to the direct cost.""" - reference: NotRequired[Nullable[str]] - r"""User-friendly reference for the direct cost.""" - source_modified_date: NotRequired[str] - 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingDirectCost(BaseModel): - r"""> **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. - - ## Overview - - Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. - - Direct costs include: - * Purchasing an item and paying it off at the point of the purchase - * Receiving cash from a refunded item if the refund is made by the supplier - - Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - """ - - 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. - """ - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - 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 = {'currencyRate', 'currency_rate', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + > **Language tip:** Direct costs may also be referred to as **Spend transactions**, **Spend money transactions**, or **Payments** in various accounting software. ## Overview Direct costs are money that leave the business without impacting Accounts Payable, and refunds associated with such transactions. Direct costs include: * Purchasing an item and paying it off at the point of the purchase * Receiving cash from a refunded item if the refund is made by the supplier Direct costs is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + """ # noqa: E501 + reference: OptionalNullable[str] = Field(default=UNSET, description="User-friendly reference for the direct cost.") + note: OptionalNullable[str] = Field(default=UNSET, description="A note attached to the direct cost.") + contact_ref: Optional[ContactRef] = Field(default=None, description="A customer or supplier associated with the direct cost.", alias="contactRef") + issue_date: 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="issueDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: List[DirectCostLineItem] = Field(description="An array of line items.", alias="lineItems") + payment_allocations: List[AccountingPaymentAllocation] = Field(description="An array of payment allocations.", alias="paymentAllocations") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of the direct costs, excluding any taxes.", alias="subTotal") + tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of tax on the direct costs.", alias="taxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The amount of the direct costs, inclusive of tax.", alias="totalAmount") + 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") + id: Optional[str] = Field(default=None, description="Identifier of the direct cost, unique for the company.") + metadata: Optional[Metadata] = None + __properties: ClassVar[List[str]] = ["reference", "note", "contactRef", "issueDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "subTotal", "taxAmount", "totalAmount", "supplementalData", "modifiedDate", "sourceModifiedDate", "id", "metadata"] - line_items: Annotated[List[DirectCostLineItem], pydantic.Field(alias="lineItems")] - r"""An array of line items.""" - - payment_allocations: Annotated[ - List[AccountingPaymentAllocation], pydantic.Field(alias="paymentAllocations") - ] - r"""An array of payment allocations.""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""The total amount of the direct costs, excluding any taxes.""" - - tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] - r"""The total amount of tax on the direct costs.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""The amount of the direct costs, inclusive of tax.""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + 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()) - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingDirectCost from a JSON string""" + return cls.from_dict(json.loads(json_str)) - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - ## Examples with base currency of GBP + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + * `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([ + ]) - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - id: Optional[str] = None - r"""Identifier of the direct cost, unique for the company.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""A note attached to the direct cost.""" - - reference: OptionalNullable[str] = UNSET - r"""User-friendly reference for the direct cost.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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( - [ - "contactRef", - "currencyRate", - "id", - "metadata", - "modifiedDate", - "note", - "reference", - "sourceModifiedDate", - "supplementalData", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencyRate", "note", "reference"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # override the default output from pydantic by calling `to_dict()` of supplemental_data + if self.supplemental_data: + _dict['supplementalData'] = self.supplemental_data.to_dict() + # override the default output from pydantic by calling `to_dict()` of metadata + if self.metadata: + _dict['metadata'] = self.metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingDirectCost from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reference": obj.get("reference"), + "note": obj.get("note"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "issueDate": obj.get("issueDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [DirectCostLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") 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 -try: - AccountingDirectCost.model_rebuild() -except NameError: - pass +class AccountingDirectCostTypedDict(TypedDict): + """TypedDict variant of AccountingDirectCost, for dict-literal request/response inputs.""" + reference: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + issue_date: NotRequired[str] + currency: NotRequired[str] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[List[DirectCostLineItemTypedDict]] + payment_allocations: NotRequired[List[AccountingPaymentAllocationTypedDict]] + sub_total: NotRequired[Decimal] + tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingdirectcosts.py b/lending/src/codat_lending/models/shared/accountingdirectcosts.py index 495555c6f..8896d63c5 100644 --- a/lending/src/codat_lending/models/shared/accountingdirectcosts.py +++ b/lending/src/codat_lending/models/shared/accountingdirectcosts.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingdirectcost import AccountingDirectCost, AccountingDirectCostTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingdirectcost import AccountingDirectCost, AccountingDirectCostTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingDirectCosts(BaseModel): -class AccountingDirectCostsTypedDict(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[AccountingDirectCostTypedDict]]] + @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} + """ + AccountingDirectCosts + """ # 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[AccountingDirectCost]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingDirectCosts(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 AccountingDirectCosts from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingDirectCost]]] = 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 AccountingDirectCosts 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": [AccountingDirectCost.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingDirectCosts.model_rebuild() -except NameError: - pass + + + + +class AccountingDirectCostsTypedDict(TypedDict): + """TypedDict variant of AccountingDirectCosts, 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[AccountingDirectCostTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingdirectincome.py b/lending/src/codat_lending/models/shared/accountingdirectincome.py index 2bf8a6c43..8e3612ec6 100644 --- a/lending/src/codat_lending/models/shared/accountingdirectincome.py +++ b/lending/src/codat_lending/models/shared/accountingdirectincome.py @@ -1,332 +1,179 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .contactref import ContactRef, ContactRefTypedDict -from .directincomelineitem import DirectIncomeLineItem, DirectIncomeLineItemTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingDirectIncomeTypedDict(TypedDict): - r"""> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. - - ## Overview +""" + Lending - Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes made at the point of sale. - - Direct incomes include: - - - Selling an item directly to a contact, and receiving payment at the point of the sale. - - Refunding an item sold at the point of sale in cash to a contact. - - Direct incomes is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - """ + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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_. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## 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. - """ - issue_date: 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. - """ - line_items: List[DirectIncomeLineItemTypedDict] - r"""An array of line items.""" - payment_allocations: List[AccountingPaymentAllocationTypedDict] - sub_total: Decimal - r"""The total amount of the direct incomes, excluding any taxes.""" - tax_amount: Decimal - r"""The total amount of tax on the direct incomes.""" - total_amount: Decimal - r"""The amount of the direct incomes, inclusive of tax.""" - contact_ref: NotRequired[ContactRefTypedDict] - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier of the direct income, unique for the company.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""An optional note on the direct income that can be used to assign the direct income with a reference ID in your application.""" - reference: NotRequired[Nullable[str]] - r"""User-friendly reference for the direct income.""" - source_modified_date: NotRequired[str] - 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.directincomelineitem import DirectIncomeLineItem, DirectIncomeLineItemTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingDirectIncome(BaseModel): - r"""> **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. - - ## Overview - - Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes made at the point of sale. - - Direct incomes include: - - - Selling an item directly to a contact, and receiving payment at the point of the sale. - - Refunding an item sold at the point of sale in cash to a contact. - Direct incomes is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - """ - - 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. - """ - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - 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 = {'currencyRate', 'currency_rate', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + > **Language tip:** Direct incomes may also be referred to as **Receive transactions**, **Receive money transactions**, **Sales receipts**, or **Cash sales** in various accounting software. ## Overview Direct incomes are incomes received directly from the business' operations. For example, cash sales of items to a customer, referral commissions, and service fee refunds are considered direct incomes made at the point of sale. Direct incomes include: - Selling an item directly to a contact, and receiving payment at the point of the sale. - Refunding an item sold at the point of sale in cash to a contact. Direct incomes is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier of the direct income, unique for the company.") + reference: OptionalNullable[str] = Field(default=UNSET, description="User-friendly reference for the direct income.") + note: OptionalNullable[str] = Field(default=UNSET, description="An optional note on the direct income that can be used to assign the direct income with a reference ID in your application.") + contact_ref: Optional[ContactRef] = Field(default=None, description="A customer or supplier associated with the direct income.", alias="contactRef") + issue_date: 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="issueDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: List[DirectIncomeLineItem] = Field(description="An array of line items.", alias="lineItems") + payment_allocations: List[AccountingPaymentAllocation] = Field(alias="paymentAllocations") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of the direct incomes, excluding any taxes.", alias="subTotal") + tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of tax on the direct incomes.", alias="taxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The amount of the direct incomes, inclusive of tax.", alias="totalAmount") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "reference", "note", "contactRef", "issueDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "subTotal", "taxAmount", "totalAmount", "metadata", "supplementalData"] - line_items: Annotated[List[DirectIncomeLineItem], pydantic.Field(alias="lineItems")] - r"""An array of line items.""" - - payment_allocations: Annotated[ - List[AccountingPaymentAllocation], pydantic.Field(alias="paymentAllocations") - ] - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""The total amount of the direct incomes, excluding any taxes.""" - - tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] - r"""The total amount of tax on the direct incomes.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""The amount of the direct incomes, inclusive of tax.""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - ### Integration-specific details + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - id: Optional[str] = None - r"""Identifier of the direct income, unique for the company.""" - - metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + 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()) - note: OptionalNullable[str] = UNSET - r"""An optional note on the direct income that can be used to assign the direct income with a reference ID in your application.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingDirectIncome from a JSON string""" + return cls.from_dict(json.loads(json_str)) - reference: OptionalNullable[str] = UNSET - r"""User-friendly reference for the direct income.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - supplemental_data: Annotated[ - Optional[SupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. + * `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([ + ]) - 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( - [ - "contactRef", - "currencyRate", - "id", - "metadata", - "modifiedDate", - "note", - "reference", - "sourceModifiedDate", - "supplementalData", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencyRate", "note", "reference"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # 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 AccountingDirectIncome from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "reference": obj.get("reference"), + "note": obj.get("note"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "issueDate": obj.get("issueDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [DirectIncomeLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "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 + }) + 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 -try: - AccountingDirectIncome.model_rebuild() -except NameError: - pass +class AccountingDirectIncomeTypedDict(TypedDict): + """TypedDict variant of AccountingDirectIncome, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + reference: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + issue_date: NotRequired[str] + currency: NotRequired[str] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[List[DirectIncomeLineItemTypedDict]] + payment_allocations: NotRequired[List[AccountingPaymentAllocationTypedDict]] + sub_total: NotRequired[Decimal] + tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingdirectincomes.py b/lending/src/codat_lending/models/shared/accountingdirectincomes.py index 49bf743ae..14c3f842c 100644 --- a/lending/src/codat_lending/models/shared/accountingdirectincomes.py +++ b/lending/src/codat_lending/models/shared/accountingdirectincomes.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingdirectincome import ( - AccountingDirectIncome, - AccountingDirectIncomeTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingdirectincome import AccountingDirectIncome, AccountingDirectIncomeTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingDirectIncomes(BaseModel): -class AccountingDirectIncomesTypedDict(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[AccountingDirectIncomeTypedDict]]] + @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} + """ + AccountingDirectIncomes + """ # 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[AccountingDirectIncome]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingDirectIncomes(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 AccountingDirectIncomes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingDirectIncome]]] = 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 AccountingDirectIncomes 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": [AccountingDirectIncome.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingDirectIncomes.model_rebuild() -except NameError: - pass + + + + +class AccountingDirectIncomesTypedDict(TypedDict): + """TypedDict variant of AccountingDirectIncomes, 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[AccountingDirectIncomeTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountinginvoice.py b/lending/src/codat_lending/models/shared/accountinginvoice.py index 972a80b84..79b8ba5b7 100644 --- a/lending/src/codat_lending/models/shared/accountinginvoice.py +++ b/lending/src/codat_lending/models/shared/accountinginvoice.py @@ -1,618 +1,226 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .invoicelineitem import InvoiceLineItem, InvoiceLineItemTypedDict -from .invoicestatus import InvoiceStatus -from .items import Items, ItemsTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingInvoiceDataType(str, Enum): - r"""The underlying data type associated to the reference `id`.""" - - SALES_ORDERS = "salesOrders" +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class SalesOrderReferenceTypedDict(TypedDict): - data_type: NotRequired[AccountingInvoiceDataType] - r"""The underlying data type associated to the reference `id`.""" - id: NotRequired[str] - r"""Unique identifier to a record in `dataType`.""" + 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 SalesOrderReference(BaseModel): - data_type: Annotated[ - Optional[AccountingInvoiceDataType], pydantic.Field(alias="dataType") - ] = None - r"""The underlying data type associated to the reference `id`.""" - id: Optional[str] = None - r"""Unique identifier to a record in `dataType`.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.shared.invoicelineitem import InvoiceLineItem, InvoiceLineItemTypedDict +from codat_lending.models.shared.invoicestatus import InvoiceStatus +from codat_lending.models.shared.items import Items, ItemsTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.sales_order_reference import SalesOrderReference, SalesOrderReferenceTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountingInvoice(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 = {} - - 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 AccountingInvoiceTypedDict(TypedDict): - r"""> **Invoices or bills?** - > - > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. - > - > See [Bills](https://docs.codat.io/lending-api#/schemas/Bill) for the accounts payable equivalent of bills. - - ## Overview - - An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/lending-api#/schemas/Customer). - - In Codat, an invoice contains details of: - - - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - - Who the invoice has been raised to; the _customer_. - - The breakdown of what the invoice is for; the _line items_. - - Any [payments](https://docs.codat.io/lending-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. - - > **Invoice PDF downloads** - > - > You can download a PDF version of an invoice for supported integrations. - > - > The filename will be invoice-{number}.pdf. - - > **Referencing an invoice in Sage 50 and ClearBooks** - > - > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. - """ - - amount_due: Decimal - r"""Amount outstanding on the invoice.""" - issue_date: 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. - """ + _nullable = {'currencyRate', 'currency_rate', 'discountPercentage', 'discount_percentage', 'invoiceNumber', 'invoice_number', 'lineItems', 'line_items', 'note', 'paymentAllocations', 'payment_allocations', 'salesOrderRefs', 'sales_order_refs', 'subTotal', 'sub_total', 'totalDiscount', 'total_discount', 'withholdingTax', 'withholding_tax'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + > **Invoices or bills?** > > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. > > See [Bills](https://docs.codat.io/lending-api#/schemas/Bill) for the accounts payable equivalent of bills. ## Overview An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/lending-api#/schemas/Customer). In Codat, an invoice contains details of: - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - Who the invoice has been raised to; the _customer_. - The breakdown of what the invoice is for; the _line items_. - Any [payments](https://docs.codat.io/lending-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. > **Invoice PDF downloads** > > You can download a PDF version of an invoice for supported integrations. > > The filename will be invoice-{number}.pdf. > **Referencing an invoice in Sage 50 and ClearBooks** > > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the invoice, unique to the company in the accounting software.") + invoice_number: OptionalNullable[str] = Field(default=UNSET, description="Friendly reference for the invoice. If available, this appears in the file name of invoice attachments.", alias="invoiceNumber") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, description="Reference to the customer the invoice has been issued to.", alias="customerRef") + sales_order_refs: OptionalNullable[List[SalesOrderReference]] = Field(default=UNSET, description="List of references to related Sales orders.", alias="salesOrderRefs") + issue_date: 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="issueDate") + due_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="dueDate") + paid_on_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="paidOnDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: OptionalNullable[List[InvoiceLineItem]] = Field(default=UNSET, description="An array of line items.", alias="lineItems") + payment_allocations: OptionalNullable[List[AccountingPaymentAllocation]] = Field(default=UNSET, description="An array of payment allocations.", alias="paymentAllocations") + withholding_tax: OptionalNullable[List[Items]] = Field(default=UNSET, alias="withholdingTax") + total_discount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Numerical value of discounts applied to the invoice.", alias="totalDiscount") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the invoice excluding any taxes.", alias="subTotal") + additional_tax_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Additional tax amount applied to invoice.", alias="additionalTaxAmount") + additional_tax_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Percentage rate of any additional tax applied to the invoice.", alias="additionalTaxPercentage") + total_tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of tax on the invoice.", alias="totalTaxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of the invoice, inclusive of tax.", alias="totalAmount") + amount_due: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount outstanding on the invoice.", alias="amountDue") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`.", alias="discountPercentage") status: InvoiceStatus - r"""Current state of the invoice: - - - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. - """ - total_amount: Decimal - r"""Amount of the invoice, inclusive of tax.""" - total_tax_amount: Decimal - r"""Amount of tax on the invoice.""" - additional_tax_amount: NotRequired[Decimal] - r"""Additional tax amount applied to invoice.""" - additional_tax_percentage: NotRequired[Decimal] - r"""Percentage rate of any additional tax applied to the invoice.""" - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`.""" - due_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. - """ - id: NotRequired[str] - r"""Identifier for the invoice, unique to the company in the accounting software.""" - invoice_number: NotRequired[Nullable[str]] - r"""Friendly reference for the invoice. If available, this appears in the file name of invoice attachments.""" - line_items: NotRequired[Nullable[List[InvoiceLineItemTypedDict]]] - r"""An array of line items.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer.""" - paid_on_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. - """ - payment_allocations: NotRequired[ - Nullable[List[AccountingPaymentAllocationTypedDict]] - ] - r"""An array of payment allocations.""" - sales_order_refs: NotRequired[Nullable[List[SalesOrderReferenceTypedDict]]] - r"""List of references to related Sales orders.""" - source_modified_date: NotRequired[str] - sub_total: NotRequired[Nullable[Decimal]] - r"""Total amount of the invoice excluding any taxes.""" - 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. - """ - total_discount: NotRequired[Nullable[Decimal]] - r"""Numerical value of discounts applied to the invoice.""" - withholding_tax: NotRequired[Nullable[List[ItemsTypedDict]]] - - -class AccountingInvoice(BaseModel): - r"""> **Invoices or bills?** - > - > We distinguish between invoices where the company *owes money* vs. *is owed money*. If the company issued an invoice, and is owed money (accounts receivable) we call this an Invoice. - > - > See [Bills](https://docs.codat.io/lending-api#/schemas/Bill) for the accounts payable equivalent of bills. - - ## Overview - - An invoice is an itemized record of goods sold or services provided to a [customer](https://docs.codat.io/lending-api#/schemas/Customer). - - In Codat, an invoice contains details of: - - - The timeline of the invoice—when it was raised, marked as paid, last edited, and so on. - - How much the invoice is for, what portion of the invoice is tax or discounts, and what currency the amounts are represented in. - - Who the invoice has been raised to; the _customer_. - - The breakdown of what the invoice is for; the _line items_. - - Any [payments](https://docs.codat.io/lending-api#/schemas/Payment) assigned to the invoice; the _payment allocations_. - - > **Invoice PDF downloads** - > - > You can download a PDF version of an invoice for supported integrations. - > - > The filename will be invoice-{number}.pdf. - - > **Referencing an invoice in Sage 50 and ClearBooks** - > - > In Sage 50 and ClearBooks, you may prefer to use the **invoiceNumber** to identify an invoice rather than the invoice **id**. Each time a draft invoice is submitted or printed, the draft **id** becomes void and a submitted invoice with a new **id** exists in its place. In both platforms, the **invoiceNumber** should remain the same. - """ - - amount_due: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="amountDue"), - ] - r"""Amount outstanding on the invoice.""" - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - 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: InvoiceStatus - r"""Current state of the invoice: - - - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. - """ - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""Amount of the invoice, inclusive of tax.""" - - total_tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalTaxAmount"), - ] - r"""Amount of tax on the invoice.""" - - additional_tax_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="additionalTaxAmount"), - ] = None - r"""Additional tax amount applied to invoice.""" - - additional_tax_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="additionalTaxPercentage"), - ] = None - r"""Percentage rate of any additional tax applied to the invoice.""" - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Percentage rate (from 0 to 100) of discounts applied to the invoice. For example: A 5% discount will return a value of `5`, not `0.05`.""" - - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = 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. - """ - - id: Optional[str] = None - r"""Identifier for the invoice, unique to the company in the accounting software.""" - - invoice_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="invoiceNumber") - ] = UNSET - r"""Friendly reference for the invoice. If available, this appears in the file name of invoice attachments.""" - - line_items: Annotated[ - OptionalNullable[List[InvoiceLineItem]], pydantic.Field(alias="lineItems") - ] = UNSET - r"""An array of line items.""" - + note: OptionalNullable[str] = Field(default=UNSET, description="Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer.") metadata: Optional[Metadata] = None - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - note: OptionalNullable[str] = UNSET - r"""Any additional information about the invoice. Where possible, Codat links to a data field in the accounting software that is publicly available. This means that the contents of the note field are included when an invoice is emailed from the accounting software to the customer.""" - - paid_on_date: Annotated[Optional[str], pydantic.Field(alias="paidOnDate")] = 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. - """ - - payment_allocations: Annotated[ - OptionalNullable[List[AccountingPaymentAllocation]], - pydantic.Field(alias="paymentAllocations"), - ] = UNSET - r"""An array of payment allocations.""" - - sales_order_refs: Annotated[ - OptionalNullable[List[SalesOrderReference]], - pydantic.Field(alias="salesOrderRefs"), - ] = UNSET - r"""List of references to related Sales orders.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Total amount of the invoice excluding any taxes.""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - total_discount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalDiscount"), - ] = UNSET - r"""Numerical value of discounts applied to the invoice.""" - - withholding_tax: Annotated[ - OptionalNullable[List[Items]], pydantic.Field(alias="withholdingTax") - ] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "additionalTaxAmount", - "additionalTaxPercentage", - "currency", - "currencyRate", - "customerRef", - "discountPercentage", - "dueDate", - "id", - "invoiceNumber", - "lineItems", - "metadata", - "modifiedDate", - "note", - "paidOnDate", - "paymentAllocations", - "salesOrderRefs", - "sourceModifiedDate", - "subTotal", - "supplementalData", - "totalDiscount", - "withholdingTax", - ] + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "invoiceNumber", "customerRef", "salesOrderRefs", "issueDate", "dueDate", "paidOnDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "withholdingTax", "totalDiscount", "subTotal", "additionalTaxAmount", "additionalTaxPercentage", "totalTaxAmount", "totalAmount", "amountDue", "discountPercentage", "status", "note", "metadata", "supplementalData"] + + 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 AccountingInvoice 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, ) - nullable_fields = set( - [ - "currencyRate", - "discountPercentage", - "invoiceNumber", - "lineItems", - "note", - "paymentAllocations", - "salesOrderRefs", - "subTotal", - "totalDiscount", - "withholdingTax", - ] - ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in sales_order_refs (list) + _items = [] + if self.sales_order_refs: + for _item_sales_order_refs in self.sales_order_refs: + if _item_sales_order_refs: + _items.append(_item_sales_order_refs.to_dict()) + _dict['salesOrderRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in withholding_tax (list) + _items = [] + if self.withholding_tax: + for _item_withholding_tax in self.withholding_tax: + if _item_withholding_tax: + _items.append(_item_withholding_tax.to_dict()) + _dict['withholdingTax'] = _items + # 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 AccountingInvoice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "invoiceNumber": obj.get("invoiceNumber"), + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "salesOrderRefs": [SalesOrderReference.from_dict(_item) for _item in obj["salesOrderRefs"]] if obj.get("salesOrderRefs") is not None else None, + "issueDate": obj.get("issueDate"), + "dueDate": obj.get("dueDate"), + "paidOnDate": obj.get("paidOnDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [InvoiceLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "withholdingTax": [Items.from_dict(_item) for _item in obj["withholdingTax"]] if obj.get("withholdingTax") is not None else None, + "totalDiscount": obj.get("totalDiscount"), + "subTotal": obj.get("subTotal"), + "additionalTaxAmount": obj.get("additionalTaxAmount"), + "additionalTaxPercentage": obj.get("additionalTaxPercentage"), + "totalTaxAmount": obj.get("totalTaxAmount"), + "totalAmount": obj.get("totalAmount"), + "amountDue": obj.get("amountDue"), + "discountPercentage": obj.get("discountPercentage"), + "status": obj.get("status"), + "note": obj.get("note"), + "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 + }) + 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 -try: - SalesOrderReference.model_rebuild() -except NameError: - pass -try: - AccountingInvoice.model_rebuild() -except NameError: - pass +class AccountingInvoiceTypedDict(TypedDict): + """TypedDict variant of AccountingInvoice, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + invoice_number: NotRequired[Optional[str]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + sales_order_refs: NotRequired[Optional[List[SalesOrderReferenceTypedDict]]] + issue_date: NotRequired[str] + due_date: NotRequired[Optional[str]] + paid_on_date: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[Optional[List[InvoiceLineItemTypedDict]]] + payment_allocations: NotRequired[Optional[List[AccountingPaymentAllocationTypedDict]]] + withholding_tax: NotRequired[Optional[List[ItemsTypedDict]]] + total_discount: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + additional_tax_amount: NotRequired[Optional[Decimal]] + additional_tax_percentage: NotRequired[Optional[Decimal]] + total_tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + amount_due: NotRequired[Decimal] + discount_percentage: NotRequired[Optional[Decimal]] + status: InvoiceStatus + note: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountinginvoices.py b/lending/src/codat_lending/models/shared/accountinginvoices.py index 8190412f0..5dae2fda6 100644 --- a/lending/src/codat_lending/models/shared/accountinginvoices.py +++ b/lending/src/codat_lending/models/shared/accountinginvoices.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountinginvoice import AccountingInvoice, AccountingInvoiceTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountinginvoice import AccountingInvoice, AccountingInvoiceTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingInvoices(BaseModel): -class AccountingInvoicesTypedDict(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[AccountingInvoiceTypedDict]]] + @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} + """ + AccountingInvoices + """ # 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[AccountingInvoice]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingInvoices(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 AccountingInvoices from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingInvoice]]] = 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 AccountingInvoices 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": [AccountingInvoice.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingInvoices.model_rebuild() -except NameError: - pass + + + + +class AccountingInvoicesTypedDict(TypedDict): + """TypedDict variant of AccountingInvoices, 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[AccountingInvoiceTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingjournal.py b/lending/src/codat_lending/models/shared/accountingjournal.py index f0a95cc5f..e567f98b7 100644 --- a/lending/src/codat_lending/models/shared/accountingjournal.py +++ b/lending/src/codat_lending/models/shared/accountingjournal.py @@ -1,213 +1,139 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .journalstatus import JournalStatus -from .metadata import Metadata, MetadataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingJournalTypedDict(TypedDict): - r"""> **Language tip:** For line items, or individual transactions, of a company's financial documents, refer to the [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) data type - - ## Overview - - In accounting software, journals are used to record all the financial transactions of a company. Each transaction in a journal is represented by a separate [journal entry](https://docs.codat.io/lending-api#/schemas/JournalEntry). These entries are used to create the general ledger, which is then used to create the financial statements of a business. - - When a company records all their transactions in a single journal, it can become large and difficult to maintain and track. This is why large companies often use multiple journals (also known as subjournals) to categorize and manage journal entries. - - Such journals can be divided into two categories: - - - Special journals: journals used to record specific types of transactions; for example, a purchases journal, a sales journal, or a cash management journal. - - General journals: journals used to record transactions that fall outside the scope of the special journals. - - Multiple journals or subjournals are used in the following Codat integrations: - - - [Sage Intacct](https://docs.codat.io/integrations/accounting/sage-intacct/accounting-sage-intacct) (mandatory) - - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) - - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) - - > When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. +""" + Lending - """ - - created_on: 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: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - 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` + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - > 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. - """ - has_children: NotRequired[bool] - r"""If the journal has child journals, this value is true. If it doesn’t, it is false.""" - id: NotRequired[str] - r"""Journal ID.""" - journal_code: NotRequired[Nullable[str]] - r"""Native journal number or code.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - name: NotRequired[Nullable[str]] - r"""Journal name. - The maximum length for a journal name is 256 characters. All characters above that number will be truncated. - """ - parent_id: NotRequired[Nullable[str]] - r"""Parent journal ID. - If the journal is a parent journal, this value is not present. - """ - source_modified_date: NotRequired[str] - status: NotRequired[JournalStatus] - r"""Current journal status.""" - type: NotRequired[Nullable[str]] - r"""The type of the journal.""" + 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_lending.models.shared.journalstatus import JournalStatus +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingJournal(BaseModel): - r"""> **Language tip:** For line items, or individual transactions, of a company's financial documents, refer to the [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) data type - - ## Overview - - In accounting software, journals are used to record all the financial transactions of a company. Each transaction in a journal is represented by a separate [journal entry](https://docs.codat.io/lending-api#/schemas/JournalEntry). These entries are used to create the general ledger, which is then used to create the financial statements of a business. - - When a company records all their transactions in a single journal, it can become large and difficult to maintain and track. This is why large companies often use multiple journals (also known as subjournals) to categorize and manage journal entries. - - Such journals can be divided into two categories: - - - Special journals: journals used to record specific types of transactions; for example, a purchases journal, a sales journal, or a cash management journal. - - General journals: journals used to record transactions that fall outside the scope of the special journals. - - Multiple journals or subjournals are used in the following Codat integrations: - - - [Sage Intacct](https://docs.codat.io/integrations/accounting/sage-intacct/accounting-sage-intacct) (mandatory) - - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) - - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) - - > When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'journalCode', 'journal_code', 'name', 'parentId', 'parent_id', 'type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + > **Language tip:** For line items, or individual transactions, of a company's financial documents, refer to the [Journal entries](https://docs.codat.io/lending-api#/schemas/JournalEntry) data type ## Overview In accounting software, journals are used to record all the financial transactions of a company. Each transaction in a journal is represented by a separate [journal entry](https://docs.codat.io/lending-api#/schemas/JournalEntry). These entries are used to create the general ledger, which is then used to create the financial statements of a business. When a company records all their transactions in a single journal, it can become large and difficult to maintain and track. This is why large companies often use multiple journals (also known as subjournals) to categorize and manage journal entries. Such journals can be divided into two categories: - Special journals: journals used to record specific types of transactions; for example, a purchases journal, a sales journal, or a cash management journal. - General journals: journals used to record transactions that fall outside the scope of the special journals. Multiple journals or subjournals are used in the following Codat integrations: - [Sage Intacct](https://docs.codat.io/integrations/accounting/sage-intacct/accounting-sage-intacct) (mandatory) - [Exact Online](https://docs.codat.io/integrations/accounting/exact-online/accounting-exact-online) (mandatory) - [Oracle NetSuite](https://docs.codat.io/integrations/accounting/netsuite/accounting-netsuite) (optional) > When pushing journal entries to an accounting software that doesn’t support multiple journals (multi-book accounting), the entries will be linked to the platform-generic journal. The Journals data type will only include one object. + """ # noqa: E501 + journal_code: OptionalNullable[str] = Field(default=UNSET, description="Native journal number or code.", alias="journalCode") + name: OptionalNullable[str] = Field(default=UNSET, description="Journal name. The maximum length for a journal name is 256 characters. All characters above that number will be truncated.") + type: OptionalNullable[str] = Field(default=UNSET, description="The type of the journal.") + parent_id: OptionalNullable[str] = Field(default=UNSET, description="Parent journal ID. If the journal is a parent journal, this value is not present.", alias="parentId") + has_children: Optional[bool] = Field(default=None, description="If the journal has child journals, this value is true. If it doesn’t, it is false.", alias="hasChildren") + created_on: 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="createdOn") + status: Optional[JournalStatus] = None + 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") + id: Optional[str] = Field(default=None, description="Journal ID.") + metadata: Optional[Metadata] = None + __properties: ClassVar[List[str]] = ["journalCode", "name", "type", "parentId", "hasChildren", "createdOn", "status", "modifiedDate", "sourceModifiedDate", "id", "metadata"] - created_on: Annotated[Optional[str], pydantic.Field(alias="createdOn")] = 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: + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - ``` - 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 AccountingJournal 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)`: - has_children: Annotated[Optional[bool], pydantic.Field(alias="hasChildren")] = None - r"""If the journal has child journals, this value is true. If it doesn’t, it is false.""" + * `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([ + ]) - id: Optional[str] = None - r"""Journal ID.""" + _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() + return _dict - journal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="journalCode") - ] = UNSET - r"""Native journal number or code.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingJournal from a dict""" + if obj is None: + return None - metadata: Optional[Metadata] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + _obj = cls.model_validate({ + "journalCode": obj.get("journalCode"), + "name": obj.get("name"), + "type": obj.get("type"), + "parentId": obj.get("parentId"), + "hasChildren": obj.get("hasChildren"), + "createdOn": obj.get("createdOn"), + "status": obj.get("status"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "metadata": Metadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None + }) + return _obj - name: OptionalNullable[str] = UNSET - r"""Journal name. - The maximum length for a journal name is 256 characters. All characters above that number will be truncated. - """ - parent_id: Annotated[OptionalNullable[str], pydantic.Field(alias="parentId")] = ( - UNSET - ) - r"""Parent journal ID. - If the journal is a parent journal, this value is not present. - """ - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - status: Optional[JournalStatus] = None - r"""Current journal status.""" - type: OptionalNullable[str] = UNSET - r"""The type of the journal.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "createdOn", - "hasChildren", - "id", - "journalCode", - "metadata", - "modifiedDate", - "name", - "parentId", - "sourceModifiedDate", - "status", - "type", - ] - ) - nullable_fields = set(["journalCode", "name", "parentId", "type"]) - 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: - AccountingJournal.model_rebuild() -except NameError: - pass +class AccountingJournalTypedDict(TypedDict): + """TypedDict variant of AccountingJournal, for dict-literal request/response inputs.""" + journal_code: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + parent_id: NotRequired[Optional[str]] + has_children: NotRequired[Optional[bool]] + created_on: NotRequired[Optional[str]] + status: NotRequired[Optional[JournalStatus]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingjournalentries.py b/lending/src/codat_lending/models/shared/accountingjournalentries.py index a95e3175b..267daf3d9 100644 --- a/lending/src/codat_lending/models/shared/accountingjournalentries.py +++ b/lending/src/codat_lending/models/shared/accountingjournalentries.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingjournalentry import ( - AccountingJournalEntry, - AccountingJournalEntryTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingjournalentry import AccountingJournalEntry, AccountingJournalEntryTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingJournalEntries(BaseModel): -class AccountingJournalEntriesTypedDict(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[AccountingJournalEntryTypedDict]]] + @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} + """ + AccountingJournalEntries + """ # 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[AccountingJournalEntry]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingJournalEntries(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 AccountingJournalEntries from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingJournalEntry]]] = 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 AccountingJournalEntries 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": [AccountingJournalEntry.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingJournalEntries.model_rebuild() -except NameError: - pass + + + + +class AccountingJournalEntriesTypedDict(TypedDict): + """TypedDict variant of AccountingJournalEntries, 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[AccountingJournalEntryTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingjournalentry.py b/lending/src/codat_lending/models/shared/accountingjournalentry.py index f53d658fe..346b17168 100644 --- a/lending/src/codat_lending/models/shared/accountingjournalentry.py +++ b/lending/src/codat_lending/models/shared/accountingjournalentry.py @@ -1,298 +1,161 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .journalentryrecordref import JournalEntryRecordRef, JournalEntryRecordRefTypedDict -from .journalline import JournalLine, JournalLineTypedDict -from .journalref import JournalRef, JournalRefTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.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 AccountingJournalEntryTypedDict(TypedDict): - r"""> **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/lending-api#/schemas/Journal) data type - - ## Overview - - A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/lending-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. - - A journal entry line item is a single transaction line on the journal entry. For example: - - - When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. - - When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. - - In Codat a journal entry contains details of: - - - The date on which the entry was created and posted. - - Itemised lines, including amounts and currency. - - A reference to the associated accounts. - - A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. +""" + Lending - > **Pushing journal entries** - > Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. - """ - - created_on: 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. - """ - description: NotRequired[Nullable[str]] - r"""Optional description of the journal entry.""" - id: NotRequired[str] - r"""Unique identifier of the journal entry for the company in the accounting software.""" - journal_lines: NotRequired[Nullable[List[JournalLineTypedDict]]] - r"""An array of journal lines.""" - journal_ref: NotRequired[JournalRefTypedDict] - r"""Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals).""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - posted_on: 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: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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. - """ - record_ref: NotRequired[JournalEntryRecordRefTypedDict] - r"""Links a journal entry to the underlying record that created it.""" - source_modified_date: NotRequired[str] - 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. - """ - updated_on: 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. - """ - - +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_lending.models.shared.journalentryrecordref import JournalEntryRecordRef, JournalEntryRecordRefTypedDict +from codat_lending.models.journal_line import JournalLine, JournalLineTypedDict +from codat_lending.models.shared.journalref import JournalRef, JournalRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingJournalEntry(BaseModel): - r"""> **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/lending-api#/schemas/Journal) data type - - ## Overview - - A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/lending-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. - - A journal entry line item is a single transaction line on the journal entry. For example: - - When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. - - When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. - - In Codat a journal entry contains details of: - - - The date on which the entry was created and posted. - - Itemised lines, including amounts and currency. - - A reference to the associated accounts. - - A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. - - > **Pushing journal entries** - > Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. - """ - - created_on: Annotated[Optional[str], pydantic.Field(alias="createdOn")] = 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 = {'description', 'journalLines', 'journal_lines'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - description: OptionalNullable[str] = UNSET - r"""Optional description of the journal entry.""" - - id: Optional[str] = None - r"""Unique identifier of the journal entry for the company in the accounting software.""" - - journal_lines: Annotated[ - OptionalNullable[List[JournalLine]], pydantic.Field(alias="journalLines") - ] = UNSET - r"""An array of journal lines.""" - - journal_ref: Annotated[Optional[JournalRef], pydantic.Field(alias="journalRef")] = ( - None - ) - r"""Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals).""" - + > **Language tip:** For the top-level record of a company's financial transactions, refer to the [Journals](https://docs.codat.io/lending-api#/schemas/Journal) data type ## Overview A journal entry report shows the entries made in a company's general ledger, or [accounts](https://docs.codat.io/lending-api#/schemas/Account), when transactions are approved. The journal line items for each journal entry should balance. A journal entry line item is a single transaction line on the journal entry. For example: - When a journal entry is recording a receipt of cash, the credit to accounts receivable and the debit to cash are separate line items. - When a company needs to recognise revenue from an annual contract on a monthly basis, on receipt of cash for month one, they make a debit to deferred income and a credit to revenue. In Codat a journal entry contains details of: - The date on which the entry was created and posted. - Itemised lines, including amounts and currency. - A reference to the associated accounts. - A reference to the underlying record. For example, the invoice, bill, or other data type that triggered the posting of the journal entry to the general ledger. > **Pushing journal entries** > Codat only supports journal entries in the base currency of the company that are pushed into accounts denominated in the same base currency. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Unique identifier of the journal entry for the company in the accounting software.") + description: OptionalNullable[str] = Field(default=UNSET, description="Optional description of the journal entry.") + posted_on: 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="postedOn") + created_on: 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="createdOn") + updated_on: 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="updatedOn") + journal_ref: Optional[JournalRef] = Field(default=None, alias="journalRef") + journal_lines: OptionalNullable[List[JournalLine]] = Field(default=UNSET, description="An array of journal lines.", alias="journalLines") + record_ref: Optional[JournalEntryRecordRef] = Field(default=None, alias="recordRef") metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "description", "postedOn", "createdOn", "updatedOn", "journalRef", "journalLines", "recordRef", "metadata", "supplementalData"] - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - posted_on: Annotated[Optional[str], pydantic.Field(alias="postedOn")] = 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. - """ - - record_ref: Annotated[ - Optional[JournalEntryRecordRef], pydantic.Field(alias="recordRef") - ] = None - r"""Links a journal entry to the underlying record that created it.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - updated_on: Annotated[Optional[str], pydantic.Field(alias="updatedOn")] = 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 AccountingJournalEntry 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. + """ + excluded_fields: Set[str] = set([ + ]) - - 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( - [ - "createdOn", - "description", - "id", - "journalLines", - "journalRef", - "metadata", - "modifiedDate", - "postedOn", - "recordRef", - "sourceModifiedDate", - "supplementalData", - "updatedOn", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["description", "journalLines"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of journal_ref + if self.journal_ref: + _dict['journalRef'] = self.journal_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in journal_lines (list) + _items = [] + if self.journal_lines: + for _item_journal_lines in self.journal_lines: + if _item_journal_lines: + _items.append(_item_journal_lines.to_dict()) + _dict['journalLines'] = _items + # override the default output from pydantic by calling `to_dict()` of record_ref + if self.record_ref: + _dict['recordRef'] = self.record_ref.to_dict() + # 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 AccountingJournalEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "description": obj.get("description"), + "postedOn": obj.get("postedOn"), + "createdOn": obj.get("createdOn"), + "updatedOn": obj.get("updatedOn"), + "journalRef": JournalRef.from_dict(obj["journalRef"]) if obj.get("journalRef") is not None else None, + "journalLines": [JournalLine.from_dict(_item) for _item in obj["journalLines"]] if obj.get("journalLines") is not None else None, + "recordRef": JournalEntryRecordRef.from_dict(obj["recordRef"]) if obj.get("recordRef") is not None else None, + "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 + }) + 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 -try: - AccountingJournalEntry.model_rebuild() -except NameError: - pass +class AccountingJournalEntryTypedDict(TypedDict): + """TypedDict variant of AccountingJournalEntry, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + posted_on: NotRequired[Optional[str]] + created_on: NotRequired[Optional[str]] + updated_on: NotRequired[Optional[str]] + journal_ref: NotRequired[Optional[JournalRefTypedDict]] + journal_lines: NotRequired[Optional[List[JournalLineTypedDict]]] + record_ref: NotRequired[Optional[JournalEntryRecordRefTypedDict]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingjournals.py b/lending/src/codat_lending/models/shared/accountingjournals.py index 1489e5254..bc9ffee61 100644 --- a/lending/src/codat_lending/models/shared/accountingjournals.py +++ b/lending/src/codat_lending/models/shared/accountingjournals.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingjournal import AccountingJournal, AccountingJournalTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingjournal import AccountingJournal, AccountingJournalTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingJournals(BaseModel): -class AccountingJournalsTypedDict(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[AccountingJournalTypedDict]]] + @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} + """ + AccountingJournals + """ # 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[AccountingJournal]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingJournals(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 AccountingJournals from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingJournal]]] = 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 AccountingJournals 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": [AccountingJournal.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingJournals.model_rebuild() -except NameError: - pass + + + + +class AccountingJournalsTypedDict(TypedDict): + """TypedDict variant of AccountingJournals, 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[AccountingJournalTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingpayment.py b/lending/src/codat_lending/models/shared/accountingpayment.py index 755403469..8944c3272 100644 --- a/lending/src/codat_lending/models/shared/accountingpayment.py +++ b/lending/src/codat_lending/models/shared/accountingpayment.py @@ -1,1646 +1,176 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .accountref import AccountRef, AccountRefTypedDict -from .metadata import Metadata, MetadataTypedDict -from .paymentline import PaymentLine, PaymentLineTypedDict -from .paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AccountingPaymentTypedDict(TypedDict): - r"""> **Payments or bill payments?** - > - > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - - ## Overview - - Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - - - A payment made against an invoice, like a credit card, cheque, or cash payment. - - An allocation of a customer's credit note, either to an invoice or maybe a refund. - - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - - Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - - In Codat, a payment contains details of: - - - When the payment was recorded in the accounting system. - - How much it is for and in what currency that amount is in. - - Who the payment was _paid by_ – the _customer_. - - The payment method used. - - The breakdown of the types of payments – the _line items_. - - Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - ## Payment types - - ## Payment of an invoice - - A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - - - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Payment of multiple invoices - - A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - - - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - - Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - - ## Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - - - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the customer. - - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - - It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - - ## Using a credit note to pay an invoice - - The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - - A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Refunding a credit note - - A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - - ## Refunding a payment - - If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - - - One for the incoming over payment. - - Another for the outgoing refund. - - The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - - - An **amount** that indicates the amount that was refunded. This is always negative. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - - The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - - The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - - For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - - - One for £1,000 linked to the invoice that was paid. - - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - - The **line** linked to the payment has the following properties: - - - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - - > **Support for linked payments** - > - > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are included in the payments data type: - - Payment currency rate: - - - Base currency of the accounts receivable account. - - Foreign currency of the payment. - - Payment line link currency rate: - - - Base currency of the item the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - - - The base currency for the accounts receivable account. - - The currency of the item. - - ```json title=\"Currency rate example\" - { - \"id\": \"123\", - \"note\": \"\", - \"totalAmount\": 99.99, - \"currency\": \"GBP\", - \"lines\": [ - { - \"amount\": 99.99, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"178\", - \"amount\": -50, - \"currencyRate\": 1.9998 - } - ] - } - ] - } - ``` - - - - ## Example data - - > **Object properties** - > - > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - - ## Simple examples - - ```json title=\"Payment for invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Allocation of credit note\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - +# coding: utf-8 +""" + Lending - ```json title=\"Payment of invoice and payment on account\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - - ```json title=\"Refund of credit note\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund on accounts receivable account\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Linked refund on accounts receivable account\" - { - \"id\" : \"payment-001\", - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Using a credit note and cash to pay an invoice\" - { - \"totalAmount\": 250, - \"lines\": [ - { - \"amount\": 0, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -750 - }, - { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - } - ] - }, - { - \"amount\": 250, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -250 - } - ] - } - ] - } - ``` - - - - ## Complex examples - - ```json title=\"Use two credit notes and 1000 in to \"bank\" (cash, cheque etc.) to pay invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Pay an invoice with two credit notes and cash, with 1000 left 'on account'\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"customer-001\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes pay two invoices with no allocation amount specified\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"u\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title=\"January\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-01-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 4000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title=\"February\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-02-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-y\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 3000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and some cash pay two invoices with no allocations specified\" - { - \"totalAmount\": 500, - \"lines\": [ - { - \"amount\": 500, - \"links\": [{ - \"type\": \"Invoice\", - \"id\": \"a\", - \"amount\": -1000 - }, { - \"type\": \"Invoice\", - \"id\": \"b\", - \"amount\": -1000 - }, { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - },{ - \"type\": \"CreditNote\", - \"id\": \"z\", - \"amount\": 750 - } - ] - } - ] - } - ``` - """ - - date_: 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. - """ - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - id: NotRequired[str] - r"""Identifier for the payment, unique to the company in the accounting software.""" - lines: NotRequired[Nullable[List[PaymentLineTypedDict]]] - r"""An array of payment lines.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - note: NotRequired[Nullable[str]] - r"""Any additional information associated with the payment.""" - payment_method_ref: NotRequired[PaymentMethodRefTypedDict] - r"""The payment method the record is linked to in the accounting or commerce software.""" - reference: NotRequired[Nullable[str]] - r"""Friendly reference for the payment.""" - source_modified_date: NotRequired[str] - 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. - """ - total_amount: NotRequired[Decimal] - r"""Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.paymentline import PaymentLine, PaymentLineTypedDict +from codat_lending.models.shared.paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingPayment(BaseModel): - r"""> **Payments or bill payments?** - > - > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. - - ## Overview - - Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). - - A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - - - A payment made against an invoice, like a credit card, cheque, or cash payment. - - An allocation of a customer's credit note, either to an invoice or maybe a refund. - - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. - Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. - - In Codat, a payment contains details of: - - - When the payment was recorded in the accounting system. - - How much it is for and in what currency that amount is in. - - Who the payment was _paid by_ – the _customer_. - - The payment method used. - - The breakdown of the types of payments – the _line items_. - - Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). - - ## Payment types - - ## Payment of an invoice - - A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - - - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Payment of multiple invoices - - A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - - - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. - - Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. - - ## Payments and refunds on account - - A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - - - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - - The **id** containing the ID of the customer. - - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. - - It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. - - ## Using a credit note to pay an invoice - - The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - - A **links** array containing two elements: - - The first **link** has: - - A **type** that indicates the type of **link**, in this case an `Invoice`. - - An **id** that contains the ID of the invoice that was paid. - - The second **link** has: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note used by this payment. - - The **amount** field on the **line** equals the **totalAmount** on the payment. - - ## Refunding a credit note - - A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - - - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `CreditNote`. - - An **id** that contains the ID of the credit note that was refunded. - - The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. - - ## Refunding a payment - - If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - - - One for the incoming over payment. - - Another for the outgoing refund. - - The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - - - An **amount** that indicates the amount that was refunded. This is always negative. - - A **links** array that contains one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Payment`. - - An **id** that contains the ID of the payment that was refunded. - - The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. - - The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. - - For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - - - One for £1,000 linked to the invoice that was paid. - - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. - - The **line** linked to the payment has the following properties: - - - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - - A **links** array containing one element with the following properties: - - A **type** that indicates the type of **link**, in this case a `Refund`. - - An **id** that contains the ID of the payment that refunded this line. - - > **Support for linked payments** - > - > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. - - ## Foreign currencies - - There are two types of currency rate that are included in the payments data type: - - Payment currency rate: - - - Base currency of the accounts receivable account. - - Foreign currency of the payment. - - Payment line link currency rate: - - - Base currency of the item the link represents. - - Foreign currency of the payment. - - These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - - - The base currency for the accounts receivable account. - - The currency of the item. - - ```json title=\"Currency rate example\" - { - \"id\": \"123\", - \"note\": \"\", - \"totalAmount\": 99.99, - \"currency\": \"GBP\", - \"lines\": [ - { - \"amount\": 99.99, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"178\", - \"amount\": -50, - \"currencyRate\": 1.9998 - } - ] - } - ] - } - ``` - - - - ## Example data - - > **Object properties** - > - > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). - - ## Simple examples - - ```json title=\"Payment for invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Allocation of credit note\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Payment of invoice and payment on account\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund of credit note\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Refund on accounts receivable account\" - { - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Linked refund on accounts receivable account\" - { - \"id\" : \"payment-001\", - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Using a credit note and cash to pay an invoice\" - { - \"totalAmount\": 250, - \"lines\": [ - { - \"amount\": 0, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -750 - }, - { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - } - ] - }, - { - \"amount\": 250, - \"links\": [ - { - \"type\": \"Invoice\", - \"id\": \"x\", - \"amount\": -250 - } - ] - } - ] - } - ``` - - - - ## Complex examples - - ```json title=\"Use two credit notes and 1000 in to \"bank\" (cash, cheque etc.) to pay invoice\" - { - \"totalAmount\": 1000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Pay an invoice with two credit notes and cash, with 1000 left 'on account'\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"customer-001\", - \"amount\" : -1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes pay two invoices with no allocation amount specified\" - { - \"totalAmount\": 0, - \"lines\": [ - { - \"amount\" : 0, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash\" - { - \"totalAmount\": 2000, - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"w\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"x\", - \"amount\" : -1000 - }, - { - \"type\" : \"Invoice\", - \"id\" : \"u\", - \"amount\" : -1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"y\", - \"amount\" : 1000 - }, - { - \"type\" : \"CreditNote\", - \"id\" : \"z\", - \"amount\" : 1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Refund\", - \"id\" : \"refund-001\", - \"amount\" : -1000 - } - ] - } - ] - } - { - \"id\" : \"refund-001\", - \"totalAmount\": -1000, - \"lines\": [ - { - \"amount\" : -1000, - \"links\" : [ - { - \"type\" : \"Payment\", - \"id\" : \"payment-001\", - \"amount\" : 1000 - } - ] - } - ] - } - ``` - - - - In this example, a payment on account is used to pay the same invoice in January and again in February. - - ```json title=\"January\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-01-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 4000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -4000 - } - ] - } - ] - } - ``` - - - - ```json title=\"February\" - { - \"id\": \"001\", - \"totalAmount\": 5000, - \"date\" : \"1901-02-01\", - \"lines\": [ - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-x\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 1000, - \"links\" : [ - { - \"type\" : \"Invoice\", - \"id\" : \"Invoice-y\", - \"amount\" : -1000 - } - ] - }, - { - \"amount\" : 3000, - \"links\" : [ - { - \"type\" : \"PaymentOnAccount\", - \"id\" : \"PaymentOnAccount-y\", - \"amount\" : -3000 - } - ] - } - ] - } - ``` - - - - ```json title=\"Two credit notes and some cash pay two invoices with no allocations specified\" - { - \"totalAmount\": 500, - \"lines\": [ - { - \"amount\": 500, - \"links\": [{ - \"type\": \"Invoice\", - \"id\": \"a\", - \"amount\": -1000 - }, { - \"type\": \"Invoice\", - \"id\": \"b\", - \"amount\": -1000 - }, { - \"type\": \"CreditNote\", - \"id\": \"y\", - \"amount\": 750 - },{ - \"type\": \"CreditNote\", - \"id\": \"z\", - \"amount\": 750 - } - ] - } - ] - } - ``` - """ - - date_: Annotated[str, pydantic.Field(alias="date")] - 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. - """ - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'currencyRate', 'currency_rate', 'lines', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None - - id: Optional[str] = None - r"""Identifier for the payment, unique to the company in the accounting software.""" - - lines: OptionalNullable[List[PaymentLine]] = UNSET - r"""An array of payment lines.""" - + > **Payments or bill payments?** > > In Codat, payments represent accounts receivable only. For accounts payable, see [bill payments](https://docs.codat.io/lending-api#/schemas/BillPayment). These include [bills](https://docs.codat.io/lending-api#/schemas/Bill) and credit notes against bills. ## Overview Payments include all accounts receivable transaction data. This includes [invoices](https://docs.codat.io/lending-api#/schemas/Invoice) and [credit notes](https://docs.codat.io/lending-api#/schemas/CreditNote). A payment in Codat usually represents an allocation of money within any customer accounts receivable account. This includes, but is not strictly limited to: - A payment made against an invoice, like a credit card, cheque, or cash payment. - An allocation of a customer's credit note, either to an invoice or maybe a refund. - A payment made directly to that accounts receivable account. This might be an overpayment or a prepayment. It might also be the refund of a payment made directly to an accounts receivable account. Depending on the payments allowed by the underlying accounting software, some payment types may be combined. Please see the example for more details. In Codat, a payment contains details of: - When the payment was recorded in the accounting system. - How much it is for and in what currency that amount is in. - Who the payment was _paid by_ – the _customer_. - The payment method used. - The breakdown of the types of payments – the _line items_. Payments is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). ## Payment types ## Payment of an invoice A payment paying a single invoice has one entry in its `lines` array. This **line** has the following properties: - An _amount_ that indicates the amount of the invoice that was paid. This is always positive. - A **links** array containing one element with the following properties: - A **type** that indicates the type of **link**, in this case an `Invoice`. - An **id** that contains the ID of the invoice that was paid. - An **amount** for the link. The sum of the **line.amount** and the **links.amount** must equal `0`. The **amount** field on the **line** equals the **totalAmount** on the payment. ## Payment of multiple invoices A single payment can pay multiple invoices. This can be represented in one of two formats depending on how the customer keeps their books: - The payment has multiple entries in its **lines** array, one for each invoice that is paid. Each line follows the example and rules described in [Payment of an invoice](#payment-of-an-invoice). - The payment has a line with multiple links to each invoice. This occurs when the proportion of the original payment allocated to each invoice is not available. Each **line** has the same properties as those described in [Payment of an invoice](#payment-of-an-invoice), with the **amount** indicating how much of the payment was allocated to the invoice. The sum of line amounts equals the **totalAmount** on the payment. ## Payments and refunds on account A payment on account, that is a payment that doesn’t pay a specific invoice, has one entry in its lines array. The **line** has the following properties: - A **totalAmount** that indicates the amount paid by a customer or refunded to them by a company. A payment to the customer is always negative. A refund is always positive. - A **links** array containing one element with the following properties: - A **type** that indicates the type of link. For a payment this is `PaymentOnAccount`. For a refund this is `Refund`. - The **id** containing the ID of the customer. - The **amount** for the link is `0` – the **totalAmount** _or_ the amount of the payment or refund. It is possible to have a payment that is part _on account_ and part _allocated_ to an invoice. Each line should follow the examples above. ## Using a credit note to pay an invoice The payment of an invoice using a credit note has one entry in its **lines** array. This **line** has the following properties: - An **amount** that indicates the amount of money moved, which in this case is `0`, as the credit note and invoice allocation must balance each other. - A **links** array containing two elements: - The first **link** has: - A **type** that indicates the type of **link**, in this case an `Invoice`. - An **id** that contains the ID of the invoice that was paid. - The second **link** has: - A **type** that indicates the type of **link**, in this case a `CreditNote`. - An **id** that contains the ID of the credit note used by this payment. The **amount** field on the **line** equals the **totalAmount** on the payment. ## Refunding a credit note A payment refunding a credit note has one entry in its **lines** array. This **line** has the following properties: - An **amount** that indicates the amount of the credit note that was refunded. This is always negative for a refund. - A **links** array that contains one element with the following properties: - A **type** that indicates the type of **link**, in this case a `CreditNote`. - An **id** that contains the ID of the credit note that was refunded. The **totalAmount** field on the payment equals the **amount** field of the **line**. These are both negative, as this is money leaving accounts receivable. ## Refunding a payment If a payment is refunded, for example, if a customer overpaid an invoice and the overpayment is returned to the customer, there are two payment records: - One for the incoming over payment. - Another for the outgoing refund. The payment issuing the refund has a negative **totalAmount**. This payment also has one entry in its lines array with the following properties: - An **amount** that indicates the amount that was refunded. This is always negative. - A **links** array that contains one element with the following properties: - A **type** that indicates the type of **link**, in this case a `Payment`. - An **id** that contains the ID of the payment that was refunded. The **amount** field on the **line** equals the **totalAmount** on the payment and is negative, as this is money leaving accounts receivable. The payment that was refunded has a line where the **amount** is positive and the type of the link is `Refund`. This payment may have several entries in its **lines** array if it was used to partly pay an invoice. For example: A £1,050 payment on a £1,000 invoice with a refund of £50 has two lines: - One for £1,000 linked to the invoice that was paid. - Another for £50 linked to the payment that refunded the overpayment with a** type** of `Refund` and an ID that corresponds to the payment. The **line** linked to the payment has the following properties: - An **amount** that indicates the amount that was refunded. This is positive as its money that was added to accounts receivable. It's balanced out by the negative amount of the refund. - A **links** array containing one element with the following properties: - A **type** that indicates the type of **link**, in this case a `Refund`. - An **id** that contains the ID of the payment that refunded this line. > **Support for linked payments** > > Not all accounting software support linking payments in this way. In some platforms, you may see a payment on account and a refund on account. ## Foreign currencies There are two types of currency rate that are included in the payments data type: Payment currency rate: - Base currency of the accounts receivable account. - Foreign currency of the payment. Payment line link currency rate: - Base currency of the item the link represents. - Foreign currency of the payment. These two rates allow the calculation of currency loss or gain for any of the transactions affected by the payment lines. The second rate is used when a payment is applied to an item in a currency that doesn't match either: - The base currency for the accounts receivable account. - The currency of the item. ```json title=\"Currency rate example\" { \"id\": \"123\", \"note\": \"\", \"totalAmount\": 99.99, \"currency\": \"GBP\", \"lines\": [ { \"amount\": 99.99, \"links\": [ { \"type\": \"Invoice\", \"id\": \"178\", \"amount\": -50, \"currencyRate\": 1.9998 } ] } ] } ``` ## Example data > **Object properties** > > For the sake of brevity, the examples here may omit properties from objects. For the full object definition, see [Payments](https://api.codat.io/swagger/index.html#/Payments). ## Simple examples ```json title=\"Payment for invoice\" { \"totalAmount\": 1000, \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 } ] } ] } ``` ```json title=\"Allocation of credit note\" { \"totalAmount\": 0, \"lines\": [ { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 } ] } ] } ``` ```json title=\"Payment of invoice and payment on account\" { \"totalAmount\": 2000, \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"PaymentOnAccount\", \"id\" : \"y\", \"amount\" : -1000 } ] } ] } ``` ```json title=\"Refund of credit note\" { \"totalAmount\": -1000, \"lines\": [ { \"amount\" : -1000, \"links\" : [ { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 } ] } ] } ``` ```json title=\"Refund on accounts receivable account\" { \"totalAmount\": -1000, \"lines\": [ { \"amount\" : -1000, \"links\" : [ { \"type\" : \"PaymentOnAccount\", \"id\" : \"y\", \"amount\" : 1000 } ] } ] } ``` ```json title=\"Linked refund on accounts receivable account\" { \"id\" : \"payment-001\", \"totalAmount\": 1000, \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Refund\", \"id\" : \"refund-001\", \"amount\" : -1000 } ] } ] } { \"id\" : \"refund-001\", \"totalAmount\": -1000, \"lines\": [ { \"amount\" : -1000, \"links\" : [ { \"type\" : \"Payment\", \"id\" : \"payment-001\", \"amount\" : 1000 } ] } ] } ``` ```json title=\"Using a credit note and cash to pay an invoice\" { \"totalAmount\": 250, \"lines\": [ { \"amount\": 0, \"links\": [ { \"type\": \"Invoice\", \"id\": \"x\", \"amount\": -750 }, { \"type\": \"CreditNote\", \"id\": \"y\", \"amount\": 750 } ] }, { \"amount\": 250, \"links\": [ { \"type\": \"Invoice\", \"id\": \"x\", \"amount\": -250 } ] } ] } ``` ## Complex examples ```json title=\"Use two credit notes and 1000 in to \"bank\" (cash, cheque etc.) to pay invoice\" { \"totalAmount\": 1000, \"lines\": [ { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 } ] }, { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"z\", \"amount\" : 1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 } ] } ] } ``` ```json title=\"Pay an invoice with two credit notes and cash, with 1000 left 'on account'\" { \"totalAmount\": 2000, \"lines\": [ { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 } ] }, { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"z\", \"amount\" : 1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"PaymentOnAccount\", \"id\" : \"customer-001\", \"amount\" : -1000 } ] } ] } ``` ```json title=\"Two credit notes pay two invoices with no allocation amount specified\" { \"totalAmount\": 0, \"lines\": [ { \"amount\" : 0, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"w\", \"amount\" : -1000 }, { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 }, { \"type\" : \"CreditNote\", \"id\" : \"z\", \"amount\" : 1000 } ] } ] } ``` ```json title=\"Two credit notes and cash pay three invoices with no allocation amount specified, and refund cash\" { \"totalAmount\": 2000, \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"w\", \"amount\" : -1000 }, { \"type\" : \"Invoice\", \"id\" : \"x\", \"amount\" : -1000 }, { \"type\" : \"Invoice\", \"id\" : \"u\", \"amount\" : -1000 }, { \"type\" : \"CreditNote\", \"id\" : \"y\", \"amount\" : 1000 }, { \"type\" : \"CreditNote\", \"id\" : \"z\", \"amount\" : 1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Refund\", \"id\" : \"refund-001\", \"amount\" : -1000 } ] } ] } { \"id\" : \"refund-001\", \"totalAmount\": -1000, \"lines\": [ { \"amount\" : -1000, \"links\" : [ { \"type\" : \"Payment\", \"id\" : \"payment-001\", \"amount\" : 1000 } ] } ] } ``` In this example, a payment on account is used to pay the same invoice in January and again in February. ```json title=\"January\" { \"id\": \"001\", \"totalAmount\": 5000, \"date\" : \"1901-01-01\", \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"Invoice-x\", \"amount\" : -1000 } ] }, { \"amount\" : 4000, \"links\" : [ { \"type\" : \"PaymentOnAccount\", \"id\" : \"PaymentOnAccount-y\", \"amount\" : -4000 } ] } ] } ``` ```json title=\"February\" { \"id\": \"001\", \"totalAmount\": 5000, \"date\" : \"1901-02-01\", \"lines\": [ { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"Invoice-x\", \"amount\" : -1000 } ] }, { \"amount\" : 1000, \"links\" : [ { \"type\" : \"Invoice\", \"id\" : \"Invoice-y\", \"amount\" : -1000 } ] }, { \"amount\" : 3000, \"links\" : [ { \"type\" : \"PaymentOnAccount\", \"id\" : \"PaymentOnAccount-y\", \"amount\" : -3000 } ] } ] } ``` ```json title=\"Two credit notes and some cash pay two invoices with no allocations specified\" { \"totalAmount\": 500, \"lines\": [ { \"amount\": 500, \"links\": [{ \"type\": \"Invoice\", \"id\": \"a\", \"amount\": -1000 }, { \"type\": \"Invoice\", \"id\": \"b\", \"amount\": -1000 }, { \"type\": \"CreditNote\", \"id\": \"y\", \"amount\": 750 },{ \"type\": \"CreditNote\", \"id\": \"z\", \"amount\": 750 } ] } ] } ``` + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the payment, unique to the company in the accounting software.") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, description="Customer the payment is recorded against in the accounting software.", alias="customerRef") + account_ref: Optional[AccountRef] = Field(default=None, description="Account the payment is recorded against in the accounting software.", alias="accountRef") + payment_method_ref: Optional[PaymentMethodRef] = Field(default=None, description="The Payment Method to which the payment is linked in the accounting software.", alias="paymentMethodRef") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's account.", alias="totalAmount") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + date_: 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="date") + note: OptionalNullable[str] = Field(default=UNSET, description="Any additional information associated with the payment.") + lines: OptionalNullable[List[PaymentLine]] = Field(default=UNSET, description="An array of payment lines.") + reference: OptionalNullable[str] = Field(default=UNSET, description="Friendly reference for the payment.") metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "customerRef", "accountRef", "paymentMethodRef", "totalAmount", "currency", "currencyRate", "date", "note", "lines", "reference", "metadata", "supplementalData"] - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - note: OptionalNullable[str] = UNSET - r"""Any additional information associated with the payment.""" - payment_method_ref: Annotated[ - Optional[PaymentMethodRef], pydantic.Field(alias="paymentMethodRef") - ] = None - r"""The payment method the record is linked to in the accounting or commerce software.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - reference: OptionalNullable[str] = UNSET - r"""Friendly reference for the payment.""" + 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 AccountingPayment from a JSON string""" + return cls.from_dict(json.loads(json_str)) - supplemental_data: Annotated[ - Optional[SupplementalData], pydantic.Field(alias="supplementalData") - ] = None - r"""Supplemental data is additional data you can include in our standard data types. + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Amount of the payment in the payment currency. This value should never change and represents the amount of money paid into the customer's 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([ + ]) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "currency", - "currencyRate", - "customerRef", - "id", - "lines", - "metadata", - "modifiedDate", - "note", - "paymentMethodRef", - "reference", - "sourceModifiedDate", - "supplementalData", - "totalAmount", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencyRate", "lines", "note", "reference"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment_method_ref + if self.payment_method_ref: + _dict['paymentMethodRef'] = self.payment_method_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in lines (list) + _items = [] + if self.lines: + for _item_lines in self.lines: + if _item_lines: + _items.append(_item_lines.to_dict()) + _dict['lines'] = _items + # 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 AccountingPayment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "paymentMethodRef": PaymentMethodRef.from_dict(obj["paymentMethodRef"]) if obj.get("paymentMethodRef") is not None else None, + "totalAmount": obj.get("totalAmount"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "date": obj.get("date"), + "note": obj.get("note"), + "lines": [PaymentLine.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None, + "reference": obj.get("reference"), + "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 + }) + 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 -try: - AccountingPayment.model_rebuild() -except NameError: - pass +class AccountingPaymentTypedDict(TypedDict): + """TypedDict variant of AccountingPayment, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + payment_method_ref: NotRequired[Optional[PaymentMethodRefTypedDict]] + total_amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + date_: NotRequired[str] + note: NotRequired[Optional[str]] + lines: NotRequired[Optional[List[PaymentLineTypedDict]]] + reference: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingpaymentallocation.py b/lending/src/codat_lending/models/shared/accountingpaymentallocation.py index f2de0d6ed..72b866bd6 100644 --- a/lending/src/codat_lending/models/shared/accountingpaymentallocation.py +++ b/lending/src/codat_lending/models/shared/accountingpaymentallocation.py @@ -1,223 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .paymentallocationpayment import ( - PaymentAllocationPayment, - PaymentAllocationPaymentTypedDict, -) -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 AllocationTypedDict(TypedDict): - allocated_on_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. - """ - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD +""" + Lending - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ### Integration-specific details + Do not edit the class manually. +""" # noqa: E501 - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - total_amount: NotRequired[Decimal] - r"""The total amount that has been allocated.""" - - -class Allocation(BaseModel): - allocated_on_date: Annotated[ - Optional[str], pydantic.Field(alias="allocatedOnDate") - ] = 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. - """ - - 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_. +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - ## Unknown currencies +from pydantic import BaseModel, ConfigDict, model_serializer +from typing import Any, ClassVar, Dict, List +from codat_lending.models.accounting_payment_allocation_allocation import AccountingPaymentAllocationAllocation, AccountingPaymentAllocationAllocationTypedDict +from codat_lending.models.shared.paymentallocationpayment import PaymentAllocationPayment, PaymentAllocationPaymentTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. +class AccountingPaymentAllocation(BaseModel): - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + AccountingPaymentAllocation + """ # noqa: E501 + payment: PaymentAllocationPayment + allocation: AccountingPaymentAllocationAllocation + __properties: ClassVar[List[str]] = ["payment", "allocation"] + + 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 AccountingPaymentAllocation 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 payment + if self.payment: + _dict['payment'] = self.payment.to_dict() + # override the default output from pydantic by calling `to_dict()` of allocation + if self.allocation: + _dict['allocation'] = self.allocation.to_dict() + return _dict - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingPaymentAllocation from a dict""" + if obj is None: + return None - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""The total amount that has been allocated.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["allocatedOnDate", "currency", "currencyRate", "totalAmount"] - ) - nullable_fields = set(["currencyRate"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "payment": PaymentAllocationPayment.from_dict(obj["payment"]) if obj.get("payment") is not None else None, + "allocation": AccountingPaymentAllocationAllocation.from_dict(obj["allocation"]) if obj.get("allocation") 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 AccountingPaymentAllocationTypedDict(TypedDict): - allocation: AllocationTypedDict + """TypedDict variant of AccountingPaymentAllocation, for dict-literal request/response inputs.""" payment: PaymentAllocationPaymentTypedDict - - -class AccountingPaymentAllocation(BaseModel): - allocation: Allocation - - payment: PaymentAllocationPayment - - -try: - Allocation.model_rebuild() -except NameError: - pass + allocation: AccountingPaymentAllocationAllocationTypedDict diff --git a/lending/src/codat_lending/models/shared/accountingpayments.py b/lending/src/codat_lending/models/shared/accountingpayments.py index cd88adf18..d56c0b235 100644 --- a/lending/src/codat_lending/models/shared/accountingpayments.py +++ b/lending/src/codat_lending/models/shared/accountingpayments.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingpayment import AccountingPayment, AccountingPaymentTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingpayment import AccountingPayment, AccountingPaymentTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingPayments(BaseModel): -class AccountingPaymentsTypedDict(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[AccountingPaymentTypedDict]]] + @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} + """ + AccountingPayments + """ # 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[AccountingPayment]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingPayments(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 AccountingPayments from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingPayment]]] = 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 AccountingPayments 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": [AccountingPayment.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingPayments.model_rebuild() -except NameError: - pass + + + + +class AccountingPaymentsTypedDict(TypedDict): + """TypedDict variant of AccountingPayments, 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[AccountingPaymentTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingprofitandlossreport.py b/lending/src/codat_lending/models/shared/accountingprofitandlossreport.py index 40ad7916d..eeac03ea8 100644 --- a/lending/src/codat_lending/models/shared/accountingprofitandlossreport.py +++ b/lending/src/codat_lending/models/shared/accountingprofitandlossreport.py @@ -1,188 +1,120 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .profitandlossreport import ProfitAndLossReport, ProfitAndLossReportTypedDict -from .reportbasis import ReportBasis -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingProfitAndLossReportTypedDict(TypedDict): - r"""> **Language tip:** Profit and loss statement is also referred to as **income statement** under US GAAP (Generally Accepted Accounting Principles). - - ## Overview - - The purpose of a profit and loss report is to present the financial performance of a company over a specified time period. - - A profit and loss report shows a company's total income and expenses for a specified period of time and whether a profit or loss has been made. - - > **Profit and loss or balance sheet?** - > Profit and loss reports summarise the total revenue, expenses, and profit or loss over a specified time period. A balance sheet report presents all assets, liability, and equity for a given date. - - - **Structure of this report** - This report will reflect the structure and line descriptions that the business has set in their own accounting software. - - **History** - By default, Codat pulls (up to) 24 months of profit and loss history for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `profitAndLoss` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/post-profile-syncSettings). - - **Want to pull this in a standardised structure?** - Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - """ - - report_basis: ReportBasis - r"""The basis of a report.""" - reports: List[ProfitAndLossReportTypedDict] - r"""An array of profit and loss reports.""" - currency: NotRequired[str] - r"""Base currency of the company in which the profit and loss report is presented.""" - earliest_available_month: 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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - most_recent_available_month: 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. - """ +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_lending.models.shared.profitandlossreport import ProfitAndLossReport, ProfitAndLossReportTypedDict +from codat_lending.models.shared.reportbasis import ReportBasis +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AccountingProfitAndLossReport(BaseModel): - r"""> **Language tip:** Profit and loss statement is also referred to as **income statement** under US GAAP (Generally Accepted Accounting Principles). - - ## Overview - - The purpose of a profit and loss report is to present the financial performance of a company over a specified time period. - - A profit and loss report shows a company's total income and expenses for a specified period of time and whether a profit or loss has been made. - - > **Profit and loss or balance sheet?** - > Profit and loss reports summarise the total revenue, expenses, and profit or loss over a specified time period. A balance sheet report presents all assets, liability, and equity for a given date. - - **Structure of this report** - This report will reflect the structure and line descriptions that the business has set in their own accounting software. - - **History** - By default, Codat pulls (up to) 24 months of profit and loss history for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `profitAndLoss` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/post-profile-syncSettings). - - **Want to pull this in a standardised structure?** - Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. - """ - - report_basis: Annotated[ReportBasis, pydantic.Field(alias="reportBasis")] - r"""The basis of a report.""" - - reports: List[ProfitAndLossReport] - r"""An array of profit and loss reports.""" - - currency: Optional[str] = None - r"""Base currency of the company in which the profit and loss report is presented.""" - - earliest_available_month: Annotated[ - Optional[str], pydantic.Field(alias="earliestAvailableMonth") - ] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + > **Language tip:** Profit and loss statement is also referred to as **income statement** under US GAAP (Generally Accepted Accounting Principles). ## Overview The purpose of a profit and loss report is to present the financial performance of a company over a specified time period. A profit and loss report shows a company's total income and expenses for a specified period of time and whether a profit or loss has been made. > **Profit and loss or balance sheet?** > Profit and loss reports summarise the total revenue, expenses, and profit or loss over a specified time period. A balance sheet report presents all assets, liability, and equity for a given date. **Structure of this report** This report will reflect the structure and line descriptions that the business has set in their own accounting software. **History** By default, Codat pulls (up to) 24 months of profit and loss history for a company. You can adjust this to fetch more history, where available, by updating the `monthsToSync` value for `profitAndLoss` on the [data type settings endpoint](https://docs.codat.io/lending-api#/operations/post-profile-syncSettings). **Want to pull this in a standardised structure?** Our [Enhanced Financials](https://docs.codat.io/lending/features/financial-statements-overview) endpoints provide the same report under standardized headings, allowing you to pull it in the same format for all of your business customers. + """ # noqa: E501 + reports: List[ProfitAndLossReport] = Field(description="An array of profit and loss reports.") + report_basis: ReportBasis = Field(alias="reportBasis") + currency: Optional[str] = Field(default=None, description="Base currency of the company in which the profit and loss report is presented.") + most_recent_available_month: 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="mostRecentAvailableMonth") + earliest_available_month: 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="earliestAvailableMonth") + __properties: ClassVar[List[str]] = ["reports", "reportBasis", "currency", "mostRecentAvailableMonth", "earliestAvailableMonth"] + + 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 AccountingProfitAndLossReport 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 reports (list) + _items = [] + if self.reports: + for _item_reports in self.reports: + if _item_reports: + _items.append(_item_reports.to_dict()) + _dict['reports'] = _items + return _dict - most_recent_available_month: Annotated[ - Optional[str], pydantic.Field(alias="mostRecentAvailableMonth") - ] = 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` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountingProfitAndLossReport from a dict""" + if obj is None: + return None - > 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. - """ + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["currency", "earliestAvailableMonth", "mostRecentAvailableMonth"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "reports": [ProfitAndLossReport.from_dict(_item) for _item in obj["reports"]] if obj.get("reports") is not None else None, + "reportBasis": obj.get("reportBasis"), + "currency": obj.get("currency"), + "mostRecentAvailableMonth": obj.get("mostRecentAvailableMonth"), + "earliestAvailableMonth": obj.get("earliestAvailableMonth") + }) + 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: - AccountingProfitAndLossReport.model_rebuild() -except NameError: - pass +class AccountingProfitAndLossReportTypedDict(TypedDict): + """TypedDict variant of AccountingProfitAndLossReport, for dict-literal request/response inputs.""" + reports: NotRequired[List[ProfitAndLossReportTypedDict]] + report_basis: NotRequired[ReportBasis] + currency: NotRequired[Optional[str]] + most_recent_available_month: NotRequired[Optional[str]] + earliest_available_month: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountingrecordref.py b/lending/src/codat_lending/models/shared/accountingrecordref.py index 325cf7fa6..d87d7f786 100644 --- a/lending/src/codat_lending/models/shared/accountingrecordref.py +++ b/lending/src/codat_lending/models/shared/accountingrecordref.py @@ -1,55 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountingRecordRefTypedDict(TypedDict): - r"""Links the current record to the underlying record or data type that created it. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ + Do not edit the class manually. +""" # noqa: E501 - data_type: NotRequired[str] - r"""Allowed name of the 'dataType'.""" - id: NotRequired[str] - r"""'id' of the underlying record or data type.""" +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 AccountingRecordRef(BaseModel): - r"""Links the current record to the underlying record or data type that created it. - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. + @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} """ + Links the current record to the underlying record or data type that created it. For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' of the underlying record or data type.") + data_type: Optional[str] = Field(default=None, description="Allowed name of the 'dataType'.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] - data_type: Annotated[Optional[str], pydantic.Field(alias="dataType")] = None - r"""Allowed name of the 'dataType'.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - id: Optional[str] = None - r"""'id' of the underlying record or data type.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id"]) - serialized = handler(self) - 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()) - 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 AccountingRecordRef 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([ + ]) -try: - AccountingRecordRef.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 AccountingRecordRef 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") + }) + return _obj + + + + + +class AccountingRecordRefTypedDict(TypedDict): + """TypedDict variant of AccountingRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accountingsupplier.py b/lending/src/codat_lending/models/shared/accountingsupplier.py index 459483cb5..a45047843 100644 --- a/lending/src/codat_lending/models/shared/accountingsupplier.py +++ b/lending/src/codat_lending/models/shared/accountingsupplier.py @@ -1,177 +1,160 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .accountingaddress import AccountingAddress, AccountingAddressTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .supplierstatus import SupplierStatus -from codat_lending.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 +# coding: utf-8 +""" + Lending -class AccountingSupplierTypedDict(TypedDict): - r"""## Overview + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). - """ + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - status: SupplierStatus - r"""Status of the supplier.""" - addresses: NotRequired[Nullable[List[AccountingAddressTypedDict]]] - r"""An array of Addresses.""" - contact_name: NotRequired[Nullable[str]] - r"""Name of the main contact for the supplier.""" - default_currency: NotRequired[Nullable[str]] - r"""Default currency the supplier's transactional data is recorded in.""" - email_address: NotRequired[Nullable[str]] - r"""Email address that the supplier may be contacted on.""" - id: NotRequired[str] - r"""Identifier for the supplier, unique to the company in the accounting software.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - phone: NotRequired[Nullable[str]] - r"""Phone number that the supplier may be contacted on.""" - registration_number: NotRequired[Nullable[str]] - r"""Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.""" - source_modified_date: NotRequired[str] - 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. - """ - supplier_name: NotRequired[Nullable[str]] - r"""Name of the supplier as recorded in the accounting system, typically the company name.""" - tax_number: NotRequired[Nullable[str]] - r"""Supplier's company tax number.""" + 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_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.supplierstatus import SupplierStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingSupplier(BaseModel): - r"""## Overview - From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'addresses', 'contactName', 'contact_name', 'defaultCurrency', 'default_currency', 'emailAddress', 'email_address', 'phone', 'registrationNumber', 'registration_number', 'supplierName', 'supplier_name', 'taxNumber', 'tax_number'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - + ## Overview From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers for a company](https://docs.codat.io/lending-api#/operations/list-suppliers). Suppliers' data links to accounts payable [bills](https://docs.codat.io/lending-api#/schemas/Bill). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Identifier for the supplier, unique to the company in the accounting software.") + supplier_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the supplier as recorded in the accounting system, typically the company name.", alias="supplierName") + contact_name: OptionalNullable[str] = Field(default=UNSET, description="Name of the main contact for the supplier.", alias="contactName") + email_address: OptionalNullable[str] = Field(default=UNSET, description="Email address that the supplier may be contacted on.", alias="emailAddress") + phone: OptionalNullable[str] = Field(default=UNSET, description="Phone number that the supplier may be contacted on.") + addresses: OptionalNullable[List[AccountingAddress]] = Field(default=UNSET, description="An array of Addresses.") + registration_number: OptionalNullable[str] = Field(default=UNSET, description="Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.", alias="registrationNumber") + tax_number: OptionalNullable[str] = Field(default=UNSET, description="Supplier's company tax number.", alias="taxNumber") status: SupplierStatus - r"""Status of the supplier.""" - - addresses: OptionalNullable[List[AccountingAddress]] = UNSET - r"""An array of Addresses.""" + default_currency: OptionalNullable[str] = Field(default=UNSET, description="Default currency the supplier's transactional data is recorded in.", alias="defaultCurrency") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "supplierName", "contactName", "emailAddress", "phone", "addresses", "registrationNumber", "taxNumber", "status", "defaultCurrency", "metadata", "supplementalData"] - contact_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="contactName") - ] = UNSET - r"""Name of the main contact for the supplier.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - default_currency: Annotated[ - OptionalNullable[str], pydantic.Field(alias="defaultCurrency") - ] = UNSET - r"""Default currency the supplier's transactional data is recorded in.""" - email_address: Annotated[ - OptionalNullable[str], pydantic.Field(alias="emailAddress") - ] = UNSET - r"""Email address that the supplier may be contacted on.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - id: Optional[str] = None - r"""Identifier for the supplier, unique to the company in the accounting software.""" + 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()) - metadata: Optional[Metadata] = None + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingSupplier from a JSON string""" + return cls.from_dict(json.loads(json_str)) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - phone: OptionalNullable[str] = UNSET - r"""Phone number that the supplier may be contacted on.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - registration_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="registrationNumber") - ] = UNSET - r"""Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House.""" + * `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_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = 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 each item in addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + # 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 AccountingSupplier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "supplierName": obj.get("supplierName"), + "contactName": obj.get("contactName"), + "emailAddress": obj.get("emailAddress"), + "phone": obj.get("phone"), + "addresses": [AccountingAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "registrationNumber": obj.get("registrationNumber"), + "taxNumber": obj.get("taxNumber"), + "status": obj.get("status"), + "defaultCurrency": obj.get("defaultCurrency"), + "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 + }) + return _obj - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - supplier_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="supplierName") - ] = UNSET - r"""Name of the supplier as recorded in the accounting system, typically the company name.""" - tax_number: Annotated[OptionalNullable[str], pydantic.Field(alias="taxNumber")] = ( - UNSET - ) - r"""Supplier's company tax number.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "addresses", - "contactName", - "defaultCurrency", - "emailAddress", - "id", - "metadata", - "modifiedDate", - "phone", - "registrationNumber", - "sourceModifiedDate", - "supplementalData", - "supplierName", - "taxNumber", - ] - ) - nullable_fields = set( - [ - "addresses", - "contactName", - "defaultCurrency", - "emailAddress", - "phone", - "registrationNumber", - "supplierName", - "taxNumber", - ] - ) - 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: - AccountingSupplier.model_rebuild() -except NameError: - pass +class AccountingSupplierTypedDict(TypedDict): + """TypedDict variant of AccountingSupplier, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + supplier_name: NotRequired[Optional[str]] + contact_name: NotRequired[Optional[str]] + email_address: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[AccountingAddressTypedDict]]] + registration_number: NotRequired[Optional[str]] + tax_number: NotRequired[Optional[str]] + status: SupplierStatus + default_currency: NotRequired[Optional[str]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingsuppliers.py b/lending/src/codat_lending/models/shared/accountingsuppliers.py index 926def84f..8225bb41f 100644 --- a/lending/src/codat_lending/models/shared/accountingsuppliers.py +++ b/lending/src/codat_lending/models/shared/accountingsuppliers.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingsupplier import AccountingSupplier, AccountingSupplierTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingsupplier import AccountingSupplier, AccountingSupplierTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingSuppliers(BaseModel): -class AccountingSuppliersTypedDict(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[AccountingSupplierTypedDict]]] + @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} + """ + AccountingSuppliers + """ # 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[AccountingSupplier]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingSuppliers(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 AccountingSuppliers from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingSupplier]]] = 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 AccountingSuppliers 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": [AccountingSupplier.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingSuppliers.model_rebuild() -except NameError: - pass + + + + +class AccountingSuppliersTypedDict(TypedDict): + """TypedDict variant of AccountingSuppliers, 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[AccountingSupplierTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountingtransfer.py b/lending/src/codat_lending/models/shared/accountingtransfer.py index 916a5cbf4..97b9c3e46 100644 --- a/lending/src/codat_lending/models/shared/accountingtransfer.py +++ b/lending/src/codat_lending/models/shared/accountingtransfer.py @@ -1,201 +1,186 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from .contactref import ContactRef, ContactRefTypedDict -from .metadata import Metadata, MetadataTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from .transferaccount import TransferAccount, TransferAccountTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountingTransferStatus(str, Enum): - r"""The status of the transfer in the account""" - - UNKNOWN = "Unknown" - UNRECONCILED = "Unreconciled" - RECONCILED = "Reconciled" - VOID = "Void" - - -class AccountingTransferTypedDict(TypedDict): - r"""A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction).""" - - contact_ref: NotRequired[ContactRefTypedDict] - 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 +""" + Lending - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - 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` + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - > 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. - """ - deposited_record_refs: NotRequired[Nullable[List[AccountingRecordRefTypedDict]]] - r"""List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.""" - description: NotRequired[Nullable[str]] - r"""Description of the transfer.""" - from_: NotRequired[TransferAccountTypedDict] - r"""Account details of the account sending or receiving the transfer.""" - id: NotRequired[str] - r"""Unique identifier for the transfer.""" - metadata: NotRequired[MetadataTypedDict] - modified_date: NotRequired[str] - source_modified_date: NotRequired[str] - status: NotRequired[Nullable[AccountingTransferStatus]] - r"""The status of the transfer in the 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. - """ - to: NotRequired[TransferAccountTypedDict] - r"""Account details of the account sending or receiving the transfer.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Reference to the tracking categories this transfer is being tracked against.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from codat_lending.models.accounting_transfer_status import AccountingTransferStatus +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_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.metadata import Metadata, MetadataTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from codat_lending.models.shared.transferaccount import TransferAccount, TransferAccountTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class AccountingTransfer(BaseModel): - r"""A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction).""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None - ) - - 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: - - ``` - 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 = {'depositedRecordRefs', 'deposited_record_refs', 'description', 'status', 'trackingCategoryRefs', 'tracking_category_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + A transfer records the movement of money between two bank accounts, or between a bank account and a nominal account. It is a child data type of [account transactions](https://docs.codat.io/lending-api#/schemas/AccountTransaction). + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="Unique identifier for the transfer.") + description: OptionalNullable[str] = Field(default=UNSET, description="Description of the transfer.") + contact_ref: Optional[ContactRef] = Field(default=None, description="The customer or supplier for the transfer, if available.", alias="contactRef") + 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="date") + from_: Optional[TransferAccount] = Field(default=None, description="The details of the accounts the transfer is moving from.", alias="from") + to: Optional[TransferAccount] = Field(default=None, description="The details of the accounts the transfer is moving to.") + status: OptionalNullable[AccountingTransferStatus] = Field(default=UNSET, description="The status of the transfer in the account") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Reference to the tracking categories this transfer is being tracked against.", alias="trackingCategoryRefs") + deposited_record_refs: OptionalNullable[List[AccountingRecordRef]] = Field(default=UNSET, description="List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.", alias="depositedRecordRefs") + metadata: Optional[Metadata] = None + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "description", "contactRef", "date", "from", "to", "status", "trackingCategoryRefs", "depositedRecordRefs", "metadata", "supplementalData"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Unreconciled', 'Reconciled', 'Void']): + raise ValueError("must be one of enum values ('Unknown', 'Unreconciled', 'Reconciled', 'Void')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - deposited_record_refs: Annotated[ - OptionalNullable[List[AccountingRecordRef]], - pydantic.Field(alias="depositedRecordRefs"), - ] = UNSET - r"""List of selected transactions to associate with the transfer. Use this field to include transactions which are posted to the _undeposited funds_ (or other holding) account within the transfer.""" - description: OptionalNullable[str] = UNSET - r"""Description of the transfer.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - from_: Annotated[Optional[TransferAccount], pydantic.Field(alias="from")] = None - r"""Account details of the account sending or receiving the transfer.""" + 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()) - id: Optional[str] = None - r"""Unique identifier for the transfer.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountingTransfer from a JSON string""" + return cls.from_dict(json.loads(json_str)) - metadata: Optional[Metadata] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + * `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([ + ]) - status: OptionalNullable[AccountingTransferStatus] = UNSET - r"""The status of the transfer in the account""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of var_from + if self.from_: + _dict['from'] = self.from_.to_dict() + # override the default output from pydantic by calling `to_dict()` of to + if self.to: + _dict['to'] = self.to.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in deposited_record_refs (list) + _items = [] + if self.deposited_record_refs: + for _item_deposited_record_refs in self.deposited_record_refs: + if _item_deposited_record_refs: + _items.append(_item_deposited_record_refs.to_dict()) + _dict['depositedRecordRefs'] = _items + # 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 AccountingTransfer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "description": obj.get("description"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "date": obj.get("date"), + "from": TransferAccount.from_dict(obj["from"]) if obj.get("from") is not None else None, + "to": TransferAccount.from_dict(obj["to"]) if obj.get("to") is not None else None, + "status": obj.get("status"), + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "depositedRecordRefs": [AccountingRecordRef.from_dict(_item) for _item in obj["depositedRecordRefs"]] if obj.get("depositedRecordRefs") is not None else None, + "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 + }) + return _obj - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - to: Optional[TransferAccount] = None - r"""Account details of the account sending or receiving the transfer.""" - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field(alias="trackingCategoryRefs"), - ] = UNSET - r"""Reference to the tracking categories this transfer is being tracked against.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "contactRef", - "date", - "depositedRecordRefs", - "description", - "from", - "id", - "metadata", - "modifiedDate", - "sourceModifiedDate", - "status", - "supplementalData", - "to", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - ["depositedRecordRefs", "description", "status", "trackingCategoryRefs"] - ) - 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: - AccountingTransfer.model_rebuild() -except NameError: - pass +class AccountingTransferTypedDict(TypedDict): + """TypedDict variant of AccountingTransfer, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + date_: NotRequired[Optional[str]] + from_: NotRequired[Optional[TransferAccountTypedDict]] + to: NotRequired[Optional[TransferAccountTypedDict]] + status: NotRequired[Optional[AccountingTransferStatus]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + deposited_record_refs: NotRequired[Optional[List[AccountingRecordRefTypedDict]]] + metadata: NotRequired[Optional[MetadataTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountingtransfers.py b/lending/src/codat_lending/models/shared/accountingtransfers.py index a9532d9fe..b25b9d346 100644 --- a/lending/src/codat_lending/models/shared/accountingtransfers.py +++ b/lending/src/codat_lending/models/shared/accountingtransfers.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountingtransfer import AccountingTransfer, AccountingTransferTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.accountingtransfer import AccountingTransfer, AccountingTransferTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class AccountingTransfers(BaseModel): -class AccountingTransfersTypedDict(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[AccountingTransferTypedDict]]] + @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} + """ + AccountingTransfers + """ # 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[AccountingTransfer]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class AccountingTransfers(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 AccountingTransfers from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[AccountingTransfer]]] = 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 AccountingTransfers 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": [AccountingTransfer.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - AccountingTransfers.model_rebuild() -except NameError: - pass + + + + +class AccountingTransfersTypedDict(TypedDict): + """TypedDict variant of AccountingTransfers, 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[AccountingTransferTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/accountinstitution.py b/lending/src/codat_lending/models/shared/accountinstitution.py index 730cfbc23..27b3be75a 100644 --- a/lending/src/codat_lending/models/shared/accountinstitution.py +++ b/lending/src/codat_lending/models/shared/accountinstitution.py @@ -1,42 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountInstitutionTypedDict(TypedDict): - r"""The bank or other financial institution providing the account.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: NotRequired[str] - r"""The institution's ID, according to the provider.""" - name: NotRequired[str] - r"""The institution's name, according to the underlying provider.""" + Do not edit the class manually. +""" # noqa: E501 -class AccountInstitution(BaseModel): - r"""The bank or other financial institution providing the account.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: Optional[str] = None - r"""The institution's ID, according to the provider.""" +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 - name: Optional[str] = None - r"""The institution's name, according to the underlying provider.""" +class AccountInstitution(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The bank or other financial institution providing the account. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The institution's ID, according to the provider.") + name: Optional[str] = Field(default=None, description="The institution's name, according to the underlying provider.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 AccountInstitution 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. - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + * `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", + ]) - return m + _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 AccountInstitution 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") + }) + # 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 AccountInstitutionTypedDict(TypedDict): + """TypedDict variant of AccountInstitution, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/accountprototype.py b/lending/src/codat_lending/models/shared/accountprototype.py index 0e87ad6e8..257780811 100644 --- a/lending/src/codat_lending/models/shared/accountprototype.py +++ b/lending/src/codat_lending/models/shared/accountprototype.py @@ -1,320 +1,153 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountstatus import AccountStatus -from .accounttype import AccountType -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 ValidDataTypeLinksTypedDict(TypedDict): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. - - For example, `validDatatypeLinks` might indicate the following references: - - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. - - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. - - ## `validDatatypeLinks` example - - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` - - - - ## Support for `validDatatypeLinks` - - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: NotRequired[Nullable[List[str]]] - r"""Supported `dataTypes` that the record can be linked to.""" - property: NotRequired[Nullable[str]] - r"""The property from the account that can be linked.""" - - -class ValidDataTypeLinks(BaseModel): - r"""When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. +""" + Lending - For example, `validDatatypeLinks` might indicate the following references: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - Which tax rates are valid to use on the line item of a bill. - - Which items can be used when creating an invoice. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. + Do not edit the class manually. +""" # noqa: E501 - ## `validDatatypeLinks` example - The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. - - ```json validDatatypeLinks for an account - { - \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", - \"nominalCode\": \"090\", - \"name\": \"Business Bank Account\", - #... - \"validDatatypeLinks\": [ - { - \"property\": \"Id\", - \"links\": [ - \"Payment.AccountRef.Id\", - \"BillPayment.AccountRef.Id\", - \"DirectIncome.LineItems.AccountRef.Id\", - \"DirectCost.LineItems.AccountRef.Id\" - ] - } - ] - } - ``` - - - - ## Support for `validDatatypeLinks` - - Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. - - If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. - """ - - links: OptionalNullable[List[str]] = UNSET - r"""Supported `dataTypes` that the record can be linked to.""" - - property: OptionalNullable[str] = UNSET - r"""The property from the account that can be linked.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountstatus import AccountStatus +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.valid_data_type_links import ValidDataTypeLinks, ValidDataTypeLinksTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.models.shared.accounttype import AccountType +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountPrototype(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["links", "property"]) - nullable_fields = set(["links", "property"]) + 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 AccountPrototypeTypedDict(TypedDict): - 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. - """ - current_balance: NotRequired[Nullable[Decimal]] - r"""Current balance in the account.""" - description: NotRequired[Nullable[str]] - r"""Description for the account.""" - fully_qualified_category: NotRequired[Nullable[str]] - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. - """ - fully_qualified_name: NotRequired[Nullable[str]] - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - is_bank_account: NotRequired[bool] - r"""Confirms whether the account is a bank account or not.""" - name: NotRequired[Nullable[str]] - r"""Name of the account.""" - nominal_code: NotRequired[Nullable[str]] - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - status: NotRequired[AccountStatus] - r"""Status of the 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. - """ - type: NotRequired[AccountType] - r"""Type of account""" - valid_datatype_links: NotRequired[Nullable[List[ValidDataTypeLinksTypedDict]]] - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" - - -class AccountPrototype(BaseModel): - 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. - """ - - current_balance: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currentBalance"), - ] = UNSET - r"""Current balance in the account.""" - - description: OptionalNullable[str] = UNSET - r"""Description for the account.""" - - fully_qualified_category: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedCategory") - ] = UNSET - r"""Full category of the account. - - For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation. + _nullable = {'currentBalance', 'current_balance', 'description', 'fullyQualifiedCategory', 'fullyQualifiedName', 'fully_qualified_category', 'fully_qualified_name', 'name', 'nominalCode', 'nominal_code', 'validDatatypeLinks', 'valid_datatype_links'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - fully_qualified_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="fullyQualifiedName") - ] = UNSET - r"""Full name of the account, for example: - - `Cash On Hand` - - `Rents Held In Trust` - - `Fixed Asset` - """ - - is_bank_account: Annotated[ - Optional[bool], pydantic.Field(alias="isBankAccount") - ] = None - r"""Confirms whether the account is a bank account or not.""" - - name: OptionalNullable[str] = UNSET - r"""Name of the account.""" - - nominal_code: Annotated[ - OptionalNullable[str], pydantic.Field(alias="nominalCode") - ] = UNSET - r"""Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.""" - + AccountPrototype + """ # noqa: E501 + nominal_code: OptionalNullable[str] = Field(default=UNSET, description="Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system.", alias="nominalCode") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the account.") + description: OptionalNullable[str] = Field(default=UNSET, description="Description for the account.") + fully_qualified_category: OptionalNullable[str] = Field(default=UNSET, description="Full category of the account. For example, `Liability.Current` or `Income.Revenue`. To determine a list of possible categories for each integration, see our examples, follow our [Create, update, delete data](https://docs.codat.io/using-the-api/push) guide, or refer to the integration's own documentation.", alias="fullyQualifiedCategory") + fully_qualified_name: OptionalNullable[str] = Field(default=UNSET, description="Full name of the account, for example: - `Cash On Hand` - `Rents Held In Trust` - `Fixed Asset`", alias="fullyQualifiedName") + 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.") + current_balance: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Current balance in the account.", alias="currentBalance") + type: Optional[AccountType] = Field(default=None, description="The type of bank account e.g. Credit.") status: Optional[AccountStatus] = None - r"""Status of the account""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - type: Optional[AccountType] = None - r"""Type of account""" - - valid_datatype_links: Annotated[ - OptionalNullable[List[ValidDataTypeLinks]], - pydantic.Field(alias="validDatatypeLinks"), - ] = UNSET - r"""The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "currency", - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "isBankAccount", - "name", - "nominalCode", - "status", - "supplementalData", - "type", - "validDatatypeLinks", - ] - ) - nullable_fields = set( - [ - "currentBalance", - "description", - "fullyQualifiedCategory", - "fullyQualifiedName", - "name", - "nominalCode", - "validDatatypeLinks", - ] + is_bank_account: Optional[bool] = Field(default=None, description="Confirms whether the account is a bank account or not.", alias="isBankAccount") + valid_datatype_links: OptionalNullable[List[ValidDataTypeLinks]] = Field(default=UNSET, description="The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/lending-api#/schemas/ValidDataTypeLinks).", alias="validDatatypeLinks") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["nominalCode", "name", "description", "fullyQualifiedCategory", "fullyQualifiedName", "currency", "currentBalance", "type", "status", "isBankAccount", "validDatatypeLinks", "supplementalData"] + + 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 AccountPrototype 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in valid_datatype_links (list) + _items = [] + if self.valid_datatype_links: + for _item_valid_datatype_links in self.valid_datatype_links: + if _item_valid_datatype_links: + _items.append(_item_valid_datatype_links.to_dict()) + _dict['validDatatypeLinks'] = _items + # 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 AccountPrototype from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "nominalCode": obj.get("nominalCode"), + "name": obj.get("name"), + "description": obj.get("description"), + "fullyQualifiedCategory": obj.get("fullyQualifiedCategory"), + "fullyQualifiedName": obj.get("fullyQualifiedName"), + "currency": obj.get("currency"), + "currentBalance": obj.get("currentBalance"), + "type": obj.get("type"), + "status": obj.get("status"), + "isBankAccount": obj.get("isBankAccount"), + "validDatatypeLinks": [ValidDataTypeLinks.from_dict(_item) for _item in obj["validDatatypeLinks"]] if obj.get("validDatatypeLinks") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") 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 -try: - AccountPrototype.model_rebuild() -except NameError: - pass +class AccountPrototypeTypedDict(TypedDict): + """TypedDict variant of AccountPrototype, for dict-literal request/response inputs.""" + nominal_code: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + fully_qualified_category: NotRequired[Optional[str]] + fully_qualified_name: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + current_balance: NotRequired[Optional[Decimal]] + type: NotRequired[Optional[AccountType]] + status: NotRequired[Optional[AccountStatus]] + is_bank_account: NotRequired[Optional[bool]] + valid_datatype_links: NotRequired[Optional[List[ValidDataTypeLinksTypedDict]]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountref.py b/lending/src/codat_lending/models/shared/accountref.py index 2ffd795d3..2704375ee 100644 --- a/lending/src/codat_lending/models/shared/accountref.py +++ b/lending/src/codat_lending/models/shared/accountref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountRefTypedDict(TypedDict): - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: NotRequired[str] - r"""'id' from the Accounts data type.""" - name: NotRequired[str] - r"""'name' from the Accounts data type.""" + Do not edit the class manually. +""" # noqa: E501 -class AccountRef(BaseModel): - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: Optional[str] = None - r"""'id' from the Accounts data type.""" +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 - name: Optional[str] = None - r"""'name' from the Accounts data type.""" +class AccountRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' from the Accounts data type.") + name: Optional[str] = Field(default=None, description="'name' from the Accounts data type.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 AccountRef 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 AccountRef 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") + }) + return _obj + + + + + +class AccountRefTypedDict(TypedDict): + """TypedDict variant of AccountRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/accounts.py b/lending/src/codat_lending/models/shared/accounts.py index ef4f009b0..f5e1a9b10 100644 --- a/lending/src/codat_lending/models/shared/accounts.py +++ b/lending/src/codat_lending/models/shared/accounts.py @@ -1,143 +1,123 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 ReportSourceReferenceTypedDict(TypedDict): - r"""A source reference containing the `sourceType` object \"Banking\".""" - - source_type: NotRequired[str] - r"""The data source type.""" - - -class ReportSourceReference(BaseModel): - r"""A source reference containing the `sourceType` object \"Banking\".""" - - source_type: Annotated[Optional[str], pydantic.Field(alias="sourceType")] = None - r"""The data source type.""" +""" + Lending - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["sourceType"]) - 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 + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - return m + 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 AccountsTypedDict(TypedDict): - account_name: NotRequired[str] - r"""The name of the account according to the provider.""" - account_provider: NotRequired[str] - r"""The bank or other financial institution providing the account.""" - account_type: NotRequired[str] - r"""The type of banking account, e.g. credit or debit.""" - 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. - """ - current_balance: NotRequired[Decimal] - r"""The balance of the bank account.""" - platform_name: NotRequired[str] - r"""Name of the banking data source, e.g. \"Plaid\".""" - source_ref: NotRequired[ReportSourceReferenceTypedDict] - r"""A source reference containing the `sourceType` object \"Banking\".""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.report_source_reference import ReportSourceReference, ReportSourceReferenceTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class Accounts(BaseModel): - account_name: Annotated[Optional[str], pydantic.Field(alias="accountName")] = None - r"""The name of the account according to the provider.""" - - account_provider: Annotated[ - Optional[str], pydantic.Field(alias="accountProvider") - ] = None - r"""The bank or other financial institution providing the account.""" - - account_type: Annotated[Optional[str], pydantic.Field(alias="accountType")] = None - r"""The type of banking account, e.g. credit or debit.""" - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + Accounts + """ # noqa: E501 + source_ref: Optional[ReportSourceReference] = Field(default=None, alias="sourceRef") + platform_name: Optional[str] = Field(default=None, description="Name of the banking data source, e.g. \"Plaid\".", alias="platformName") + account_provider: Optional[str] = Field(default=None, description="The bank or other financial institution providing the account.", alias="accountProvider") + account_name: Optional[str] = Field(default=None, description="The name of the account according to the provider.", alias="accountName") + account_type: Optional[str] = Field(default=None, description="The type of banking account, e.g. credit or debit.", alias="accountType") + 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.") + current_balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The balance of the bank account.", alias="currentBalance") + __properties: ClassVar[List[str]] = ["sourceRef", "platformName", "accountProvider", "accountName", "accountType", "currency", "currentBalance"] + + 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 Accounts 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 source_ref + if self.source_ref: + _dict['sourceRef'] = self.source_ref.to_dict() + return _dict - current_balance: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currentBalance"), - ] = None - r"""The balance of the bank account.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Accounts from a dict""" + if obj is None: + return None - platform_name: Annotated[Optional[str], pydantic.Field(alias="platformName")] = None - r"""Name of the banking data source, e.g. \"Plaid\".""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - source_ref: Annotated[ - Optional[ReportSourceReference], pydantic.Field(alias="sourceRef") - ] = None - r"""A source reference containing the `sourceType` object \"Banking\".""" + _obj = cls.model_validate({ + "sourceRef": ReportSourceReference.from_dict(obj["sourceRef"]) if obj.get("sourceRef") is not None else None, + "platformName": obj.get("platformName"), + "accountProvider": obj.get("accountProvider"), + "accountName": obj.get("accountName"), + "accountType": obj.get("accountType"), + "currency": obj.get("currency"), + "currentBalance": obj.get("currentBalance") + }) + return _obj - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountName", - "accountProvider", - "accountType", - "currency", - "currentBalance", - "platformName", - "sourceRef", - ] - ) - 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: - ReportSourceReference.model_rebuild() -except NameError: - pass -try: - Accounts.model_rebuild() -except NameError: - pass +class AccountsTypedDict(TypedDict): + """TypedDict variant of Accounts, for dict-literal request/response inputs.""" + source_ref: NotRequired[Optional[ReportSourceReferenceTypedDict]] + platform_name: NotRequired[Optional[str]] + account_provider: NotRequired[Optional[str]] + account_name: NotRequired[Optional[str]] + account_type: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + current_balance: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/accountspayabletracking.py b/lending/src/codat_lending/models/shared/accountspayabletracking.py index 26cd1f2d0..785809869 100644 --- a/lending/src/codat_lending/models/shared/accountspayabletracking.py +++ b/lending/src/codat_lending/models/shared/accountspayabletracking.py @@ -1,68 +1,128 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .billedtotype import BilledToType -from .projectref import ProjectRef, ProjectRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountsPayableTrackingTypedDict(TypedDict): - r"""Categories, and a project and customer, against which the item is tracked.""" +""" + Lending - category_refs: List[TrackingCategoryRefTypedDict] - is_billed_to: BilledToType - r"""Defines if the invoice or credit note is billed/rebilled to a project or customer.""" - is_rebilled_to: BilledToType - r"""Defines if the invoice or credit note is billed/rebilled to a project or customer.""" - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - project_ref: NotRequired[ProjectRefTypedDict] - - -class AccountsPayableTracking(BaseModel): - r"""Categories, and a project and customer, against which the item is tracked.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - category_refs: Annotated[ - List[TrackingCategoryRef], pydantic.Field(alias="categoryRefs") - ] + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - is_billed_to: Annotated[BilledToType, pydantic.Field(alias="isBilledTo")] - r"""Defines if the invoice or credit note is billed/rebilled to a project or customer.""" + Do not edit the class manually. +""" # noqa: E501 - is_rebilled_to: Annotated[BilledToType, pydantic.Field(alias="isRebilledTo")] - r"""Defines if the invoice or credit note is billed/rebilled to a project or customer.""" - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None +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_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.billedtotype import BilledToType +from codat_lending.models.shared.projectref import ProjectRef, ProjectRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - project_ref: Annotated[Optional[ProjectRef], pydantic.Field(alias="projectRef")] = ( - None - ) +class AccountsPayableTracking(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["customerRef", "projectRef"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Categories, and a project and customer, against which the item is tracked. + """ # noqa: E501 + category_refs: List[TrackingCategoryRef] = Field(alias="categoryRefs") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, alias="customerRef") + project_ref: Optional[ProjectRef] = Field(default=None, alias="projectRef") + is_billed_to: BilledToType = Field(alias="isBilledTo") + is_rebilled_to: BilledToType = Field(alias="isRebilledTo") + __properties: ClassVar[List[str]] = ["categoryRefs", "customerRef", "projectRef", "isBilledTo", "isRebilledTo"] + + 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)) + + 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 AccountsPayableTracking 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 category_refs (list) + _items = [] + if self.category_refs: + for _item_category_refs in self.category_refs: + if _item_category_refs: + _items.append(_item_category_refs.to_dict()) + _dict['categoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of project_ref + if self.project_ref: + _dict['projectRef'] = self.project_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountsPayableTracking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "categoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["categoryRefs"]] if obj.get("categoryRefs") is not None else None, + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "projectRef": ProjectRef.from_dict(obj["projectRef"]) if obj.get("projectRef") is not None else None, + "isBilledTo": obj.get("isBilledTo"), + "isRebilledTo": obj.get("isRebilledTo") + }) + return _obj - return m -try: - AccountsPayableTracking.model_rebuild() -except NameError: - pass + + +class AccountsPayableTrackingTypedDict(TypedDict): + """TypedDict variant of AccountsPayableTracking, for dict-literal request/response inputs.""" + category_refs: NotRequired[List[TrackingCategoryRefTypedDict]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + project_ref: NotRequired[Optional[ProjectRefTypedDict]] + is_billed_to: NotRequired[BilledToType] + is_rebilled_to: NotRequired[BilledToType] diff --git a/lending/src/codat_lending/models/shared/accountsreceivabletracking.py b/lending/src/codat_lending/models/shared/accountsreceivabletracking.py index 1638a853e..db1d84c97 100644 --- a/lending/src/codat_lending/models/shared/accountsreceivabletracking.py +++ b/lending/src/codat_lending/models/shared/accountsreceivabletracking.py @@ -1,82 +1,135 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from .billedtotype1 import BilledToType1 -from .projectref import ProjectRef, ProjectRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class AccountsReceivableTrackingTypedDict(TypedDict): - r"""Categories, and a project and customer, against which the item is tracked.""" - - category_refs: List[TrackingCategoryRefTypedDict] - is_billed_to: BilledToType1 - r"""Defines if the bill or bill credit note is billed/rebilled to a project.""" - is_rebilled_to: BilledToType1 - r"""Defines if the bill or bill credit note is billed/rebilled to a project.""" - customer_ref: NotRequired[AccountingCustomerRefTypedDict] - project_ref: NotRequired[ProjectRefTypedDict] - record_ref: NotRequired[AccountingRecordRefTypedDict] - r"""Links the current record to the underlying record or data type that created it. - - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountsReceivableTracking(BaseModel): - r"""Categories, and a project and customer, against which the item is tracked.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - category_refs: Annotated[ - List[TrackingCategoryRef], pydantic.Field(alias="categoryRefs") - ] + Do not edit the class manually. +""" # noqa: E501 - is_billed_to: Annotated[BilledToType1, pydantic.Field(alias="isBilledTo")] - r"""Defines if the bill or bill credit note is billed/rebilled to a project.""" - is_rebilled_to: Annotated[BilledToType1, pydantic.Field(alias="isRebilledTo")] - r"""Defines if the bill or bill credit note is billed/rebilled to a project.""" +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_lending.models.shared.accountingcustomerref import AccountingCustomerRef, AccountingCustomerRefTypedDict +from codat_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from codat_lending.models.shared.billedtotype1 import BilledToType1 +from codat_lending.models.shared.projectref import ProjectRef, ProjectRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - customer_ref: Annotated[ - Optional[AccountingCustomerRef], pydantic.Field(alias="customerRef") - ] = None +class AccountsReceivableTracking(BaseModel): - project_ref: Annotated[Optional[ProjectRef], pydantic.Field(alias="projectRef")] = ( - 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} + """ + Categories, and a project and customer, against which the item is tracked. + """ # noqa: E501 + category_refs: List[TrackingCategoryRef] = Field(alias="categoryRefs") + customer_ref: Optional[AccountingCustomerRef] = Field(default=None, alias="customerRef") + project_ref: Optional[ProjectRef] = Field(default=None, alias="projectRef") + is_billed_to: BilledToType1 = Field(alias="isBilledTo") + is_rebilled_to: BilledToType1 = Field(alias="isRebilledTo") + record_ref: Optional[AccountingRecordRef] = Field(default=None, alias="recordRef") + __properties: ClassVar[List[str]] = ["categoryRefs", "customerRef", "projectRef", "isBilledTo", "isRebilledTo", "recordRef"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - record_ref: Annotated[ - Optional[AccountingRecordRef], pydantic.Field(alias="recordRef") - ] = None - r"""Links the current record to the underlying record or data type that created it. - - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["customerRef", "projectRef", "recordRef"]) - serialized = handler(self) - 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()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountsReceivableTracking 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 category_refs (list) + _items = [] + if self.category_refs: + for _item_category_refs in self.category_refs: + if _item_category_refs: + _items.append(_item_category_refs.to_dict()) + _dict['categoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of project_ref + if self.project_ref: + _dict['projectRef'] = self.project_ref.to_dict() + # 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 AccountsReceivableTracking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "categoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["categoryRefs"]] if obj.get("categoryRefs") is not None else None, + "customerRef": AccountingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "projectRef": ProjectRef.from_dict(obj["projectRef"]) if obj.get("projectRef") is not None else None, + "isBilledTo": obj.get("isBilledTo"), + "isRebilledTo": obj.get("isRebilledTo"), + "recordRef": AccountingRecordRef.from_dict(obj["recordRef"]) if obj.get("recordRef") 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: - AccountsReceivableTracking.model_rebuild() -except NameError: - pass +class AccountsReceivableTrackingTypedDict(TypedDict): + """TypedDict variant of AccountsReceivableTracking, for dict-literal request/response inputs.""" + category_refs: NotRequired[List[TrackingCategoryRefTypedDict]] + customer_ref: NotRequired[Optional[AccountingCustomerRefTypedDict]] + project_ref: NotRequired[Optional[ProjectRefTypedDict]] + is_billed_to: NotRequired[BilledToType1] + is_rebilled_to: NotRequired[BilledToType1] + record_ref: NotRequired[Optional[AccountingRecordRefTypedDict]] diff --git a/lending/src/codat_lending/models/shared/accountstatus.py b/lending/src/codat_lending/models/shared/accountstatus.py index 2ae331abc..2fc0b049e 100644 --- a/lending/src/codat_lending/models/shared/accountstatus.py +++ b/lending/src/codat_lending/models/shared/accountstatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 AccountStatus(str, Enum): - r"""Status of the account""" + """ + Status of the 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 AccountStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" - PENDING = "Pending" diff --git a/lending/src/codat_lending/models/shared/accounttransactionline.py b/lending/src/codat_lending/models/shared/accounttransactionline.py index 4f30b93cb..9e7cb8a74 100644 --- a/lending/src/codat_lending/models/shared/accounttransactionline.py +++ b/lending/src/codat_lending/models/shared/accounttransactionline.py @@ -1,79 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accounttransactionlinerecordref import ( - AccountTransactionLineRecordRef, - AccountTransactionLineRecordRefTypedDict, -) -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AccountTransactionLineTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""Amount in the bill payment currency.""" - description: NotRequired[Nullable[str]] - r"""Description of the account transaction.""" - record_ref: NotRequired[AccountTransactionLineRecordRefTypedDict] - r"""Links an account transaction line to the underlying record that created it.""" + 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 AccountTransactionLine(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Amount in the bill payment currency.""" - description: OptionalNullable[str] = UNSET - r"""Description of the account transaction.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json - record_ref: Annotated[ - Optional[AccountTransactionLineRecordRef], pydantic.Field(alias="recordRef") - ] = None - r"""Links an account transaction line to the underlying record that created it.""" +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_lending.models.account_transaction_line_record_ref import AccountTransactionLineRecordRef, AccountTransactionLineRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class AccountTransactionLine(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "description", "recordRef"]) - nullable_fields = set(["description"]) + 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: - AccountTransactionLine.model_rebuild() -except NameError: - pass + _nullable = {'description'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + AccountTransactionLine + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Description of the account transaction.") + record_ref: Optional[AccountTransactionLineRecordRef] = Field(default=None, alias="recordRef") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount in the bill payment currency.") + __properties: ClassVar[List[str]] = ["description", "recordRef", "amount"] + + 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 AccountTransactionLine 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 AccountTransactionLine 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"), + "recordRef": AccountTransactionLineRecordRef.from_dict(obj["recordRef"]) if obj.get("recordRef") is not None else None, + "amount": obj.get("amount") + }) + return _obj + + + + + +class AccountTransactionLineTypedDict(TypedDict): + """TypedDict variant of AccountTransactionLine, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + record_ref: NotRequired[Optional[AccountTransactionLineRecordRefTypedDict]] + amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/accounttransactionlinerecordref.py b/lending/src/codat_lending/models/shared/accounttransactionlinerecordref.py index a2988191a..ea278e9c1 100644 --- a/lending/src/codat_lending/models/shared/accounttransactionlinerecordref.py +++ b/lending/src/codat_lending/models/shared/accounttransactionlinerecordref.py @@ -1,69 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel, 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 AccountTransactionLineRecordRefDataType(str, Enum): - r"""Name of underlying data type.""" - - BANK_TRANSACTIONS = "bankTransactions" - BILL_CREDIT_NOTES = "billCreditNotes" - BILL_PAYMENTS = "billPayments" - BILLS = "bills" - CREDIT_NOTES = "creditNotes" - DIRECT_COSTS = "directCosts" - DIRECT_INCOMES = "directIncomes" - INVOICES = "invoices" - JOURNAL_ENTRIES = "journalEntries" - PAYMENTS = "payments" - TRANSFERS = "transfers" - - -class AccountTransactionLineRecordRefTypedDict(TypedDict): - r"""Links an account transaction line to the underlying record that created it.""" - - data_type: NotRequired[AccountTransactionLineRecordRefDataType] - r"""Name of underlying data type.""" - id: NotRequired[str] - r"""'id' of the underlying record or data type.""" - -class AccountTransactionLineRecordRef(BaseModel): - r"""Links an account transaction line to the underlying record that created it.""" - - data_type: Annotated[ - Optional[AccountTransactionLineRecordRefDataType], - pydantic.Field(alias="dataType"), - ] = None - r"""Name of underlying data type.""" - - id: Optional[str] = None - r"""'id' of the underlying record or data type.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id"]) - 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 enum import Enum -try: - AccountTransactionLineRecordRef.model_rebuild() -except NameError: - pass +from codat_lending.models._compat.accounttransactionlinerecordref import AccountTransactionLineRecordRefDataType diff --git a/lending/src/codat_lending/models/shared/accounttype.py b/lending/src/codat_lending/models/shared/accounttype.py index b893d55ba..a171fc9da 100644 --- a/lending/src/codat_lending/models/shared/accounttype.py +++ b/lending/src/codat_lending/models/shared/accounttype.py @@ -1,15 +1,13 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations + from enum import Enum class AccountType(str, Enum): - r"""Type of account""" - - UNKNOWN = "Unknown" - ASSET = "Asset" - EXPENSE = "Expense" - INCOME = "Income" - LIABILITY = "Liability" - EQUITY = "Equity" + """AccountType enum (lifted from inline OAS enum).""" + ASSET = 'Asset' + EQUITY = 'Equity' + EXPENSE = 'Expense' + INCOME = 'Income' + LIABILITY = 'Liability' + UNKNOWN = 'Unknown' diff --git a/lending/src/codat_lending/models/shared/agedcreditor.py b/lending/src/codat_lending/models/shared/agedcreditor.py index 637ed431e..3524817d6 100644 --- a/lending/src/codat_lending/models/shared/agedcreditor.py +++ b/lending/src/codat_lending/models/shared/agedcreditor.py @@ -1,57 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .agedcurrencyoutstanding import ( - AgedCurrencyOutstanding, - AgedCurrencyOutstandingTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AgedCreditorTypedDict(TypedDict): - aged_currency_outstanding: NotRequired[List[AgedCurrencyOutstandingTypedDict]] - r"""Array of aged creditors by currency.""" - supplier_id: NotRequired[str] - r"""Supplier ID of the aged creditor.""" - supplier_name: NotRequired[str] - r"""Supplier name of the aged creditor.""" + 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 AgedCreditor(BaseModel): - aged_currency_outstanding: Annotated[ - Optional[List[AgedCurrencyOutstanding]], - pydantic.Field(alias="agedCurrencyOutstanding"), - ] = None - r"""Array of aged creditors by currency.""" - supplier_id: Annotated[Optional[str], pydantic.Field(alias="supplierId")] = None - r"""Supplier ID of the aged creditor.""" +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_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstanding, AgedCurrencyOutstandingTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - supplier_name: Annotated[Optional[str], pydantic.Field(alias="supplierName")] = None - r"""Supplier name of the aged creditor.""" +class AgedCreditor(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["agedCurrencyOutstanding", "supplierId", "supplierName"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AgedCreditor + """ # noqa: E501 + supplier_id: Optional[str] = Field(default=None, description="Supplier ID of the aged creditor.", alias="supplierId") + supplier_name: Optional[str] = Field(default=None, description="Supplier name of the aged creditor.", alias="supplierName") + aged_currency_outstanding: Optional[List[AgedCurrencyOutstanding]] = Field(default=None, description="Array of aged creditors by currency.", alias="agedCurrencyOutstanding") + __properties: ClassVar[List[str]] = ["supplierId", "supplierName", "agedCurrencyOutstanding"] + + 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 AgedCreditor 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([ + ]) -try: - AgedCreditor.model_rebuild() -except NameError: - pass + _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 aged_currency_outstanding (list) + _items = [] + if self.aged_currency_outstanding: + for _item_aged_currency_outstanding in self.aged_currency_outstanding: + if _item_aged_currency_outstanding: + _items.append(_item_aged_currency_outstanding.to_dict()) + _dict['agedCurrencyOutstanding'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgedCreditor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "supplierId": obj.get("supplierId"), + "supplierName": obj.get("supplierName"), + "agedCurrencyOutstanding": [AgedCurrencyOutstanding.from_dict(_item) for _item in obj["agedCurrencyOutstanding"]] if obj.get("agedCurrencyOutstanding") is not None else None + }) + return _obj + + + + + +class AgedCreditorTypedDict(TypedDict): + """TypedDict variant of AgedCreditor, for dict-literal request/response inputs.""" + supplier_id: NotRequired[Optional[str]] + supplier_name: NotRequired[Optional[str]] + aged_currency_outstanding: NotRequired[Optional[List[AgedCurrencyOutstandingTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/agedcurrencyoutstanding.py b/lending/src/codat_lending/models/shared/agedcurrencyoutstanding.py index f5447c090..1a5f472e2 100644 --- a/lending/src/codat_lending/models/shared/agedcurrencyoutstanding.py +++ b/lending/src/codat_lending/models/shared/agedcurrencyoutstanding.py @@ -1,63 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .agedoutstandingamount import AgedOutstandingAmount, AgedOutstandingAmountTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AgedCurrencyOutstandingTypedDict(TypedDict): - aged_outstanding_amounts: NotRequired[List[AgedOutstandingAmountTypedDict]] - r"""Array of outstanding amounts by period.""" - 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_. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Unknown currencies + Do not edit the class manually. +""" # noqa: E501 - 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. - """ +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_lending.models.shared.agedoutstandingamount import AgedOutstandingAmount, AgedOutstandingAmountTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AgedCurrencyOutstanding(BaseModel): - aged_outstanding_amounts: Annotated[ - Optional[List[AgedOutstandingAmount]], - pydantic.Field(alias="agedOutstandingAmounts"), - ] = None - r"""Array of outstanding amounts by period.""" - - 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_model(self, handler): - optional_fields = set(["agedOutstandingAmounts", "currency"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AgedCurrencyOutstanding + """ # noqa: E501 + 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.") + aged_outstanding_amounts: Optional[List[AgedOutstandingAmount]] = Field(default=None, description="Array of outstanding amounts by period.", alias="agedOutstandingAmounts") + __properties: ClassVar[List[str]] = ["currency", "agedOutstandingAmounts"] + + 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 AgedCurrencyOutstanding 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 aged_outstanding_amounts (list) + _items = [] + if self.aged_outstanding_amounts: + for _item_aged_outstanding_amounts in self.aged_outstanding_amounts: + if _item_aged_outstanding_amounts: + _items.append(_item_aged_outstanding_amounts.to_dict()) + _dict['agedOutstandingAmounts'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgedCurrencyOutstanding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "currency": obj.get("currency"), + "agedOutstandingAmounts": [AgedOutstandingAmount.from_dict(_item) for _item in obj["agedOutstandingAmounts"]] if obj.get("agedOutstandingAmounts") 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: - AgedCurrencyOutstanding.model_rebuild() -except NameError: - pass +class AgedCurrencyOutstandingTypedDict(TypedDict): + """TypedDict variant of AgedCurrencyOutstanding, for dict-literal request/response inputs.""" + currency: NotRequired[Optional[str]] + aged_outstanding_amounts: NotRequired[Optional[List[AgedOutstandingAmountTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/ageddebtor.py b/lending/src/codat_lending/models/shared/ageddebtor.py index f90401870..f8cec256b 100644 --- a/lending/src/codat_lending/models/shared/ageddebtor.py +++ b/lending/src/codat_lending/models/shared/ageddebtor.py @@ -1,57 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .agedcurrencyoutstanding import ( - AgedCurrencyOutstanding, - AgedCurrencyOutstandingTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AgedDebtorTypedDict(TypedDict): - aged_currency_outstanding: NotRequired[List[AgedCurrencyOutstandingTypedDict]] - r"""Array of aged debtors by currency.""" - customer_id: NotRequired[str] - r"""Customer ID of the aged debtor.""" - customer_name: NotRequired[str] - r"""Customer name of the aged debtor.""" + 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 AgedDebtor(BaseModel): - aged_currency_outstanding: Annotated[ - Optional[List[AgedCurrencyOutstanding]], - pydantic.Field(alias="agedCurrencyOutstanding"), - ] = None - r"""Array of aged debtors by currency.""" - customer_id: Annotated[Optional[str], pydantic.Field(alias="customerId")] = None - r"""Customer ID of the aged debtor.""" +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_lending.models.shared.agedcurrencyoutstanding import AgedCurrencyOutstanding, AgedCurrencyOutstandingTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - customer_name: Annotated[Optional[str], pydantic.Field(alias="customerName")] = None - r"""Customer name of the aged debtor.""" +class AgedDebtor(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["agedCurrencyOutstanding", "customerId", "customerName"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AgedDebtor + """ # noqa: E501 + customer_id: Optional[str] = Field(default=None, description="Customer ID of the aged debtor.", alias="customerId") + customer_name: Optional[str] = Field(default=None, description="Customer name of the aged debtor.", alias="customerName") + aged_currency_outstanding: Optional[List[AgedCurrencyOutstanding]] = Field(default=None, description="Array of aged debtors by currency.", alias="agedCurrencyOutstanding") + __properties: ClassVar[List[str]] = ["customerId", "customerName", "agedCurrencyOutstanding"] + + 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 AgedDebtor 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([ + ]) -try: - AgedDebtor.model_rebuild() -except NameError: - pass + _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 aged_currency_outstanding (list) + _items = [] + if self.aged_currency_outstanding: + for _item_aged_currency_outstanding in self.aged_currency_outstanding: + if _item_aged_currency_outstanding: + _items.append(_item_aged_currency_outstanding.to_dict()) + _dict['agedCurrencyOutstanding'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgedDebtor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "customerId": obj.get("customerId"), + "customerName": obj.get("customerName"), + "agedCurrencyOutstanding": [AgedCurrencyOutstanding.from_dict(_item) for _item in obj["agedCurrencyOutstanding"]] if obj.get("agedCurrencyOutstanding") is not None else None + }) + return _obj + + + + + +class AgedDebtorTypedDict(TypedDict): + """TypedDict variant of AgedDebtor, for dict-literal request/response inputs.""" + customer_id: NotRequired[Optional[str]] + customer_name: NotRequired[Optional[str]] + aged_currency_outstanding: NotRequired[Optional[List[AgedCurrencyOutstandingTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/agedoutstandingamount.py b/lending/src/codat_lending/models/shared/agedoutstandingamount.py index f8aa98130..74b80b884 100644 --- a/lending/src/codat_lending/models/shared/agedoutstandingamount.py +++ b/lending/src/codat_lending/models/shared/agedoutstandingamount.py @@ -1,143 +1,118 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .agedoutstandingamountdetail import ( - AgedOutstandingAmountDetail, - AgedOutstandingAmountDetailTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 AgedOutstandingAmountTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""The amount outstanding.""" - details: NotRequired[List[AgedOutstandingAmountDetailTypedDict]] - r"""Array of details.""" - from_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: +""" + Lending - - 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. - """ - to_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 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.agedoutstandingamountdetail import AgedOutstandingAmountDetail, AgedOutstandingAmountDetailTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class AgedOutstandingAmount(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The amount outstanding.""" - - details: Optional[List[AgedOutstandingAmountDetail]] = None - r"""Array of details.""" - - from_date: Annotated[Optional[str], pydantic.Field(alias="fromDate")] = 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. - """ - - to_date: Annotated[Optional[str], pydantic.Field(alias="toDate")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "details", "fromDate", "toDate"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AgedOutstandingAmount + """ # noqa: E501 + from_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="fromDate") + to_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="toDate") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount outstanding.") + details: Optional[List[AgedOutstandingAmountDetail]] = Field(default=None, description="Array of details.") + __properties: ClassVar[List[str]] = ["fromDate", "toDate", "amount", "details"] + + 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 AgedOutstandingAmount 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 details (list) + _items = [] + if self.details: + for _item_details in self.details: + if _item_details: + _items.append(_item_details.to_dict()) + _dict['details'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgedOutstandingAmount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fromDate": obj.get("fromDate"), + "toDate": obj.get("toDate"), + "amount": obj.get("amount"), + "details": [AgedOutstandingAmountDetail.from_dict(_item) for _item in obj["details"]] if obj.get("details") 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: - AgedOutstandingAmount.model_rebuild() -except NameError: - pass +class AgedOutstandingAmountTypedDict(TypedDict): + """TypedDict variant of AgedOutstandingAmount, for dict-literal request/response inputs.""" + from_date: NotRequired[Optional[str]] + to_date: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + details: NotRequired[Optional[List[AgedOutstandingAmountDetailTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/agedoutstandingamountdetail.py b/lending/src/codat_lending/models/shared/agedoutstandingamountdetail.py index 139970fad..63bdb3ac2 100644 --- a/lending/src/codat_lending/models/shared/agedoutstandingamountdetail.py +++ b/lending/src/codat_lending/models/shared/agedoutstandingamountdetail.py @@ -1,46 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import serialize_decimal, validate_decimal -from decimal import Decimal -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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AgedOutstandingAmountDetailTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""The amount outstanding.""" - name: NotRequired[str] - r"""Name of data type with outstanding amount for given period.""" + 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 AgedOutstandingAmountDetail(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The amount outstanding.""" - name: Optional[str] = None - r"""Name of data type with outstanding amount for given period.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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 AgedOutstandingAmountDetail(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + AgedOutstandingAmountDetail + """ # noqa: E501 + name: Optional[str] = Field(default=None, description="Name of data type with outstanding amount for given period.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount outstanding.") + __properties: ClassVar[List[str]] = ["name", "amount"] + + 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 AgedOutstandingAmountDetail 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)`: + + * `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 AgedOutstandingAmountDetail 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"), + "amount": obj.get("amount") + }) + return _obj + + + + + +class AgedOutstandingAmountDetailTypedDict(TypedDict): + """TypedDict variant of AgedOutstandingAmountDetail, for dict-literal request/response inputs.""" + name: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/attachments.py b/lending/src/codat_lending/models/shared/attachments.py index 2b42b49b4..bb13a3d99 100644 --- a/lending/src/codat_lending/models/shared/attachments.py +++ b/lending/src/codat_lending/models/shared/attachments.py @@ -1,47 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingattachment import AccountingAttachment, AccountingAttachmentTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class AttachmentsTypedDict(TypedDict): - attachments: NotRequired[Nullable[List[Nullable[AccountingAttachmentTypedDict]]]] + 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 codat_lending.models.shared.accountingattachment import AccountingAttachment, AccountingAttachmentTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +from codat_lending.types import Nullable class Attachments(BaseModel): - attachments: OptionalNullable[List[Nullable[AccountingAttachment]]] = UNSET @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["attachments"]) - nullable_fields = set(["attachments"]) + 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 = {'attachments'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Attachments + """ # noqa: E501 + attachments: OptionalNullable[List[Nullable[AccountingAttachment]]] = UNSET + __properties: ClassVar[List[str]] = ["attachments"] + + 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 Attachments 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 attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Attachments from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "attachments": [AccountingAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None + }) + return _obj + + + + + +class AttachmentsTypedDict(TypedDict): + """TypedDict variant of Attachments, for dict-literal request/response inputs.""" + attachments: NotRequired[Optional[List[Nullable[AccountingAttachmentTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/balancesheet.py b/lending/src/codat_lending/models/shared/balancesheet.py index 4ccd89982..4dfc0c5ad 100644 --- a/lending/src/codat_lending/models/shared/balancesheet.py +++ b/lending/src/codat_lending/models/shared/balancesheet.py @@ -1,104 +1,123 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .reportline import ReportLine, ReportLineTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 BalanceSheetTypedDict(TypedDict): - net_assets: Decimal - r"""Value of net assets for a company in their base currency.""" - assets: NotRequired[ReportLineTypedDict] - 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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - equity: NotRequired[ReportLineTypedDict] - liabilities: NotRequired[ReportLineTypedDict] +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.reportline import ReportLine, ReportLineTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class BalanceSheet(BaseModel): - net_assets: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="netAssets"), - ] - r"""Value of net assets for a company in their base currency.""" - - assets: Optional[ReportLine] = None - - 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: - - ``` - 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. - """ - - equity: Optional[ReportLine] = None - - liabilities: Optional[ReportLine] = None @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["assets", "date", "equity", "liabilities"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + BalanceSheet + """ # noqa: E501 + 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="date") + assets: Optional[ReportLine] = Field(default=None, description="ReportLines for assets. For example, fixed and current assets.") + liabilities: Optional[ReportLine] = Field(default=None, description="ReportLines for liabilities. For example, current liabilities.") + net_assets: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Value of net assets for a company in their base currency.", alias="netAssets") + equity: Optional[ReportLine] = Field(default=None, description="ReportLines for equities. For example, retained and current year earnings. See below.") + __properties: ClassVar[List[str]] = ["date", "assets", "liabilities", "netAssets", "equity"] + + 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 BalanceSheet 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 assets + if self.assets: + _dict['assets'] = self.assets.to_dict() + # override the default output from pydantic by calling `to_dict()` of liabilities + if self.liabilities: + _dict['liabilities'] = self.liabilities.to_dict() + # override the default output from pydantic by calling `to_dict()` of equity + if self.equity: + _dict['equity'] = self.equity.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BalanceSheet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "assets": ReportLine.from_dict(obj["assets"]) if obj.get("assets") is not None else None, + "liabilities": ReportLine.from_dict(obj["liabilities"]) if obj.get("liabilities") is not None else None, + "netAssets": obj.get("netAssets"), + "equity": ReportLine.from_dict(obj["equity"]) if obj.get("equity") 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: - BalanceSheet.model_rebuild() -except NameError: - pass +class BalanceSheetTypedDict(TypedDict): + """TypedDict variant of BalanceSheet, for dict-literal request/response inputs.""" + date_: NotRequired[Optional[str]] + assets: NotRequired[Optional[ReportLineTypedDict]] + liabilities: NotRequired[Optional[ReportLineTypedDict]] + net_assets: NotRequired[Decimal] + equity: NotRequired[Optional[ReportLineTypedDict]] diff --git a/lending/src/codat_lending/models/shared/bankaccountref.py b/lending/src/codat_lending/models/shared/bankaccountref.py index c18836ba5..e45a69592 100644 --- a/lending/src/codat_lending/models/shared/bankaccountref.py +++ b/lending/src/codat_lending/models/shared/bankaccountref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class BankAccountRefTypedDict(TypedDict): - r"""Links to the Account transactions data type.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: NotRequired[str] - r"""Bank account 'id' for the account transaction.""" - name: NotRequired[str] - r"""bank account 'name' for the account transaction.""" + Do not edit the class manually. +""" # noqa: E501 -class BankAccountRef(BaseModel): - r"""Links to the Account transactions data type.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: Optional[str] = None - r"""Bank account 'id' for the account transaction.""" +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 - name: Optional[str] = None - r"""bank account 'name' for the account transaction.""" +class BankAccountRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "name"]) + 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 to the Account transactions data type. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Bank account 'id' for the account transaction.") + name: Optional[str] = Field(default=None, description="bank account 'name' for the account transaction.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 BankAccountRef 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 BankAccountRef 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") + }) + return _obj + + + + + +class BankAccountRefTypedDict(TypedDict): + """TypedDict variant of BankAccountRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/bankaccountstatus.py b/lending/src/codat_lending/models/shared/bankaccountstatus.py index be857f929..15642d166 100644 --- a/lending/src/codat_lending/models/shared/bankaccountstatus.py +++ b/lending/src/codat_lending/models/shared/bankaccountstatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/bankfeedbankaccountmapping.py b/lending/src/codat_lending/models/shared/bankfeedbankaccountmapping.py index 2ba7e0b8b..e058a121d 100644 --- a/lending/src/codat_lending/models/shared/bankfeedbankaccountmapping.py +++ b/lending/src/codat_lending/models/shared/bankfeedbankaccountmapping.py @@ -1,107 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class BankFeedBankAccountMappingTypedDict(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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BankFeedBankAccountMapping(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""" + BankFeedBankAccountMapping + """ # 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 BankFeedBankAccountMapping(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 BankFeedBankAccountMapping 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 BankFeedBankAccountMapping 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: - BankFeedBankAccountMapping.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 BankFeedBankAccountMappingTypedDict(TypedDict): + """TypedDict variant of BankFeedBankAccountMapping, 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/lending/src/codat_lending/models/shared/bankfeedbankaccountmappingresponse.py b/lending/src/codat_lending/models/shared/bankfeedbankaccountmappingresponse.py index 2d43a6937..2c19b735e 100644 --- a/lending/src/codat_lending/models/shared/bankfeedbankaccountmappingresponse.py +++ b/lending/src/codat_lending/models/shared/bankfeedbankaccountmappingresponse.py @@ -1,74 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class BankFeedBankAccountMappingResponseTypedDict(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 BankFeedBankAccountMappingResponse(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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BankFeedBankAccountMappingResponse(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: - BankFeedBankAccountMappingResponse.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) + } + """ + BankFeedBankAccountMappingResponse + """ # 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 BankFeedBankAccountMappingResponse 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 BankFeedBankAccountMappingResponse 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 BankFeedBankAccountMappingResponseTypedDict(TypedDict): + """TypedDict variant of BankFeedBankAccountMappingResponse, 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/lending/src/codat_lending/models/shared/bankfeedmapping.py b/lending/src/codat_lending/models/shared/bankfeedmapping.py index 0ea43c417..afd5af12c 100644 --- a/lending/src/codat_lending/models/shared/bankfeedmapping.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.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_lending.models.shared.targetaccountoption import TargetAccountOption, TargetAccountOptionTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.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/lending/src/codat_lending/models/shared/bankingaccount.py b/lending/src/codat_lending/models/shared/bankingaccount.py index c658afe2d..18a83e2b1 100644 --- a/lending/src/codat_lending/models/shared/bankingaccount.py +++ b/lending/src/codat_lending/models/shared/bankingaccount.py @@ -1,127 +1,148 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountbalanceamounts import AccountBalanceAmounts, AccountBalanceAmountsTypedDict -from .accountidentifiers import AccountIdentifiers, AccountIdentifiersTypedDict -from .accountingbankaccounttype import AccountingBankAccountType -from .accountinstitution import AccountInstitution, AccountInstitutionTypedDict -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class BankingAccountTypedDict(TypedDict): - r"""This data type provides a list of all the SMB's bank accounts, with rich data like balances, account numbers, and institutions holding the accounts. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - """ + Do not edit the class manually. +""" # noqa: E501 - balance: AccountBalanceAmountsTypedDict - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" - currency: str - r"""The currency code for the account.""" - id: str - r"""The ID of the account from the provider.""" - identifiers: AccountIdentifiersTypedDict - r"""An object containing bank account identification information.""" - institution: AccountInstitutionTypedDict - r"""The bank or other financial institution providing the account.""" - name: str - r"""The name of the account according to the provider.""" - type: AccountingBankAccountType - 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. - """ - holder: NotRequired[Nullable[str]] - r"""The name of the person or company who holds the account.""" - informal_name: NotRequired[Nullable[str]] - r"""The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available.""" - modified_date: NotRequired[str] - source_modified_date: NotRequired[str] +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_lending.models.shared.accountbalanceamounts import AccountBalanceAmounts, AccountBalanceAmountsTypedDict +from codat_lending.models.shared.accountidentifiers import AccountIdentifiers, AccountIdentifiersTypedDict +from codat_lending.models.shared.accountinstitution import AccountInstitution, AccountInstitutionTypedDict +from codat_lending.models.shared.accountingbankaccounttype import AccountingBankAccountType +from typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class BankingAccount(BaseModel): - r"""This data type provides a list of all the SMB's bank accounts, with rich data like balances, account numbers, and institutions holding the accounts. - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'holder', 'informalName', 'informal_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - balance: AccountBalanceAmounts - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" - - currency: str - r"""The currency code for the account.""" - - id: str - r"""The ID of the account from the provider.""" - + This data type provides a list of all the SMB's bank accounts, with rich data like balances, account numbers, and institutions holding the accounts. Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + """ # noqa: E501 + 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") + id: str = Field(description="The ID of the account from the provider.") + name: str = Field(description="The name of the account according to the provider.") + informal_name: OptionalNullable[str] = Field(default=UNSET, description="The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available.", alias="informalName") + holder: OptionalNullable[str] = Field(default=UNSET, description="The name of the person or company who holds the account.") + type: AccountingBankAccountType + balance: AccountBalanceAmounts = Field(description="An object containing bank balance data.") identifiers: AccountIdentifiers - r"""An object containing bank account identification information.""" - + currency: str = Field(description="The currency code for the account.") institution: AccountInstitution - r"""The bank or other financial institution providing the account.""" - - name: str - r"""The name of the account according to the provider.""" - - type: AccountingBankAccountType - 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. - """ + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "informalName", "holder", "type", "balance", "identifiers", "currency", "institution"] + + 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 BankingAccount 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 balance + if self.balance: + _dict['balance'] = self.balance.to_dict() + # override the default output from pydantic by calling `to_dict()` of identifiers + if self.identifiers: + _dict['identifiers'] = self.identifiers.to_dict() + # override the default output from pydantic by calling `to_dict()` of institution + if self.institution: + _dict['institution'] = self.institution.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankingAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "informalName": obj.get("informalName"), + "holder": obj.get("holder"), + "type": obj.get("type"), + "balance": AccountBalanceAmounts.from_dict(obj["balance"]) if obj.get("balance") is not None else None, + "identifiers": AccountIdentifiers.from_dict(obj["identifiers"]) if obj.get("identifiers") is not None else None, + "currency": obj.get("currency"), + "institution": AccountInstitution.from_dict(obj["institution"]) if obj.get("institution") is not None else None + }) + return _obj - holder: OptionalNullable[str] = UNSET - r"""The name of the person or company who holds the account.""" - informal_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="informalName") - ] = UNSET - r"""The friendly name of the account, chosen by the holder. This may not have been set by the account holder and therefore is not always available.""" - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["holder", "informalName", "modifiedDate", "sourceModifiedDate"] - ) - nullable_fields = set(["holder", "informalName"]) - 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: - BankingAccount.model_rebuild() -except NameError: - pass +class BankingAccountTypedDict(TypedDict): + """TypedDict variant of BankingAccount, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[str] + name: NotRequired[str] + informal_name: NotRequired[Optional[str]] + holder: NotRequired[Optional[str]] + type: AccountingBankAccountType + balance: NotRequired[AccountBalanceAmountsTypedDict] + identifiers: AccountIdentifiersTypedDict + currency: NotRequired[str] + institution: AccountInstitutionTypedDict diff --git a/lending/src/codat_lending/models/shared/bankingaccountbalance.py b/lending/src/codat_lending/models/shared/bankingaccountbalance.py index eea82ec1d..ea0d75245 100644 --- a/lending/src/codat_lending/models/shared/bankingaccountbalance.py +++ b/lending/src/codat_lending/models/shared/bankingaccountbalance.py @@ -1,119 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountbalanceamounts import AccountBalanceAmounts, AccountBalanceAmountsTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class BankingAccountBalanceTypedDict(TypedDict): - r"""The Banking Account Balances data type provides a list of balances for a bank account including end-of-day batch balance or running balances per transaction. - - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. +""" + Lending - > **How often should I pull Account Balances?** - > - > Because these balances are closing balances, we recommend you pull Account Balance no more frequently than daily. If you require a live intraday balance, this can be found for each account on the [Account](https://docs.codat.io/lending-api#/schemas/Account) data type. - > - > Whilst you can choose to sync hourly, this may incur usage charges from Plaid or TrueLayer. - """ - - account_id: str - r"""The unique identifier of the account.""" - balance: AccountBalanceAmountsTypedDict - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" - date_: 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: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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. - """ - modified_date: NotRequired[str] - source_modified_date: NotRequired[str] +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_lending.models.shared.accountbalanceamounts import AccountBalanceAmounts, AccountBalanceAmountsTypedDict +from typing import Optional, Set +from typing_extensions import Self class BankingAccountBalance(BaseModel): - r"""The Banking Account Balances data type provides a list of balances for a bank account including end-of-day batch balance or running balances per transaction. - - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - > **How often should I pull Account Balances?** - > - > Because these balances are closing balances, we recommend you pull Account Balance no more frequently than daily. If you require a live intraday balance, this can be found for each account on the [Account](https://docs.codat.io/lending-api#/schemas/Account) data type. - > - > Whilst you can choose to sync hourly, this may incur usage charges from Plaid or TrueLayer. + @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} """ + The Banking Account Balances data type provides a list of balances for a bank account including end-of-day batch balance or running balances per transaction. Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. > **How often should I pull Account Balances?** > > Because these balances are closing balances, we recommend you pull Account Balance no more frequently than daily. If you require a live intraday balance, this can be found for each account on the [Account](https://docs.codat.io/lending-api#/schemas/Account) data type. > > Whilst you can choose to sync hourly, this may incur usage charges from Plaid or TrueLayer. + """ # noqa: E501 + 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") + account_id: str = Field(description="The unique identifier of the account.", alias="accountId") + balance: AccountBalanceAmounts + date_: 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="date") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "accountId", "balance", "date"] - account_id: Annotated[str, pydantic.Field(alias="accountId")] - r"""The unique identifier of the account.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - balance: AccountBalanceAmounts - r"""Depending on the data provided by the underlying bank, not all balances are always available.""" - date_: Annotated[str, pydantic.Field(alias="date")] - 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 BankingAccountBalance 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 balance + if self.balance: + _dict['balance'] = self.balance.to_dict() + return _dict - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankingAccountBalance from a dict""" + if obj is None: + return None - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["modifiedDate", "sourceModifiedDate"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "accountId": obj.get("accountId"), + "balance": AccountBalanceAmounts.from_dict(obj["balance"]) if obj.get("balance") is not None else None, + "date": obj.get("date") + }) + 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: - BankingAccountBalance.model_rebuild() -except NameError: - pass +class BankingAccountBalanceTypedDict(TypedDict): + """TypedDict variant of BankingAccountBalance, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + account_id: NotRequired[str] + balance: AccountBalanceAmountsTypedDict + date_: NotRequired[str] diff --git a/lending/src/codat_lending/models/shared/bankingaccountbalances.py b/lending/src/codat_lending/models/shared/bankingaccountbalances.py index f3027b53d..6dab4289e 100644 --- a/lending/src/codat_lending/models/shared/bankingaccountbalances.py +++ b/lending/src/codat_lending/models/shared/bankingaccountbalances.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .bankingaccountbalance import BankingAccountBalance, BankingAccountBalanceTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.bankingaccountbalance import BankingAccountBalance, BankingAccountBalanceTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class BankingAccountBalances(BaseModel): -class BankingAccountBalancesTypedDict(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[BankingAccountBalanceTypedDict]]] + @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} + """ + BankingAccountBalances + """ # 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[BankingAccountBalance]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class BankingAccountBalances(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 BankingAccountBalances from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[BankingAccountBalance]]] = 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 BankingAccountBalances 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": [BankingAccountBalance.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - BankingAccountBalances.model_rebuild() -except NameError: - pass + + + + +class BankingAccountBalancesTypedDict(TypedDict): + """TypedDict variant of BankingAccountBalances, 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[BankingAccountBalanceTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/bankingaccounts.py b/lending/src/codat_lending/models/shared/bankingaccounts.py index f306b7ac9..b3c3d14b5 100644 --- a/lending/src/codat_lending/models/shared/bankingaccounts.py +++ b/lending/src/codat_lending/models/shared/bankingaccounts.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .bankingaccount import BankingAccount, BankingAccountTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.bankingaccount import BankingAccount, BankingAccountTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class BankingAccounts(BaseModel): -class BankingAccountsTypedDict(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[BankingAccountTypedDict]]] + @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} + """ + BankingAccounts + """ # 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[BankingAccount]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class BankingAccounts(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 BankingAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[BankingAccount]]] = 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 BankingAccounts 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": [BankingAccount.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - BankingAccounts.model_rebuild() -except NameError: - pass + + + + +class BankingAccountsTypedDict(TypedDict): + """TypedDict variant of BankingAccounts, 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[BankingAccountTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/bankingtransaction.py b/lending/src/codat_lending/models/shared/bankingtransaction.py index dc3340bb8..ae5813163 100644 --- a/lending/src/codat_lending/models/shared/bankingtransaction.py +++ b/lending/src/codat_lending/models/shared/bankingtransaction.py @@ -1,225 +1,145 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .transactioncategoryref import ( - TransactionCategoryRef, - TransactionCategoryRefTypedDict, -) -from .transactioncode import TransactionCode -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 BankingTransactionTypedDict(TypedDict): - r"""The Banking Transactions data type provides an immutable source of up-to-date information on income and expenditure. - - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - """ - - account_id: str - r"""The unique identifier of the bank account.""" - currency: str - r"""The currency of the bank transaction.""" - id: str - r"""The unique identifier of the bank transaction.""" - amount: NotRequired[Decimal] - r"""The amount of the bank transaction.""" - authorized_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 +""" + Lending - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - 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. - """ - code: NotRequired[TransactionCode] - r"""Code to identify the underlying transaction.""" - description: NotRequired[Nullable[str]] - r"""The description of the bank transaction.""" - merchant_name: NotRequired[Nullable[str]] - r"""The name of the merchant.""" - modified_date: NotRequired[str] - posted_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 - ``` + 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. - """ - source_modified_date: NotRequired[str] - transaction_category_ref: NotRequired[TransactionCategoryRefTypedDict] - r"""An object of bank transaction category reference data.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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 Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict +from codat_lending.models.shared.transactioncategoryref import TransactionCategoryRef, TransactionCategoryRefTypedDict +from codat_lending.models.shared.transactioncode import TransactionCode +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class BankingTransaction(BaseModel): - r"""The Banking Transactions data type provides an immutable source of up-to-date information on income and expenditure. - - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - """ - - account_id: Annotated[str, pydantic.Field(alias="accountId")] - r"""The unique identifier of the bank account.""" - currency: str - r"""The currency of the bank transaction.""" - - id: str - r"""The unique identifier of the bank transaction.""" - - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The amount of the bank transaction.""" - - authorized_date: Annotated[ - Optional[str], pydantic.Field(alias="authorizedDate") - ] = 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 = {'description', 'merchantName', 'merchant_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - + The Banking Transactions data type provides an immutable source of up-to-date information on income and expenditure. Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + """ # noqa: E501 + 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") + id: str = Field(description="The unique identifier of the bank transaction.") + account_id: str = Field(description="The unique identifier of the bank account.", alias="accountId") + description: OptionalNullable[str] = Field(default=UNSET, description="The description of the bank transaction.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount of the bank transaction.") + currency: str = Field(description="The currency of the bank transaction.") + posted_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="postedDate") + authorized_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="authorizedDate") code: Optional[TransactionCode] = None - r"""Code to identify the underlying transaction.""" - - description: OptionalNullable[str] = UNSET - r"""The description of the bank transaction.""" - - merchant_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="merchantName") - ] = UNSET - r"""The name of the merchant.""" - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - posted_date: Annotated[Optional[str], pydantic.Field(alias="postedDate")] = 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: + merchant_name: OptionalNullable[str] = Field(default=UNSET, description="The name of the merchant.", alias="merchantName") + transaction_category_ref: Optional[TransactionCategoryRef] = Field(default=None, alias="transactionCategoryRef") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "accountId", "description", "amount", "currency", "postedDate", "authorizedDate", "code", "merchantName", "transactionCategoryRef"] + + 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 BankingTransaction 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 transaction_category_ref + if self.transaction_category_ref: + _dict['transactionCategoryRef'] = self.transaction_category_ref.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 BankingTransaction from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "accountId": obj.get("accountId"), + "description": obj.get("description"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "postedDate": obj.get("postedDate"), + "authorizedDate": obj.get("authorizedDate"), + "code": obj.get("code"), + "merchantName": obj.get("merchantName"), + "transactionCategoryRef": TransactionCategoryRef.from_dict(obj["transactionCategoryRef"]) if obj.get("transactionCategoryRef") 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. - """ - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - transaction_category_ref: Annotated[ - Optional[TransactionCategoryRef], pydantic.Field(alias="transactionCategoryRef") - ] = None - r"""An object of bank transaction category reference data.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amount", - "authorizedDate", - "code", - "description", - "merchantName", - "modifiedDate", - "postedDate", - "sourceModifiedDate", - "transactionCategoryRef", - ] - ) - nullable_fields = set(["description", "merchantName"]) - 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: - BankingTransaction.model_rebuild() -except NameError: - pass +class BankingTransactionTypedDict(TypedDict): + """TypedDict variant of BankingTransaction, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[str] + account_id: NotRequired[str] + description: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[str] + posted_date: NotRequired[Optional[str]] + authorized_date: NotRequired[Optional[str]] + code: NotRequired[Optional[TransactionCode]] + merchant_name: NotRequired[Optional[str]] + transaction_category_ref: NotRequired[Optional[TransactionCategoryRefTypedDict]] diff --git a/lending/src/codat_lending/models/shared/bankingtransactioncategories.py b/lending/src/codat_lending/models/shared/bankingtransactioncategories.py index ed4376755..a5bc81fa7 100644 --- a/lending/src/codat_lending/models/shared/bankingtransactioncategories.py +++ b/lending/src/codat_lending/models/shared/bankingtransactioncategories.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .bankingtransactioncategory import ( - BankingTransactionCategory, - BankingTransactionCategoryTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.bankingtransactioncategory import BankingTransactionCategory, BankingTransactionCategoryTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class BankingTransactionCategories(BaseModel): -class BankingTransactionCategoriesTypedDict(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[BankingTransactionCategoryTypedDict]]] + @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} + """ + BankingTransactionCategories + """ # 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[BankingTransactionCategory]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class BankingTransactionCategories(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 BankingTransactionCategories from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[BankingTransactionCategory]]] = 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 BankingTransactionCategories 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": [BankingTransactionCategory.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - BankingTransactionCategories.model_rebuild() -except NameError: - pass + + + + +class BankingTransactionCategoriesTypedDict(TypedDict): + """TypedDict variant of BankingTransactionCategories, 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[BankingTransactionCategoryTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/bankingtransactioncategory.py b/lending/src/codat_lending/models/shared/bankingtransactioncategory.py index 887421dec..c02d0dcd6 100644 --- a/lending/src/codat_lending/models/shared/bankingtransactioncategory.py +++ b/lending/src/codat_lending/models/shared/bankingtransactioncategory.py @@ -1,98 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .transactioncategorystatus import TransactionCategoryStatus -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class BankingTransactionCategoryTypedDict(TypedDict): - r"""The Banking Transaction Categories data type provides a list of hierarchical categories associated with a transaction for greater contextual meaning to transaction activity. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. - """ + Do not edit the class manually. +""" # noqa: E501 - id: str - r"""The unique identifier of the bank transaction category.""" - name: str - r"""The name of the bank transaction category.""" - has_children: NotRequired[bool] - r"""A Boolean indicating whether there are other bank transaction categories beneath this one in the hierarchy.""" - modified_date: NotRequired[str] - parent_id: NotRequired[Nullable[str]] - r"""The unique identifier of the parent bank transaction category.""" - source_modified_date: NotRequired[str] - status: NotRequired[TransactionCategoryStatus] - r"""The status of the transaction category.""" +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_lending.models.shared.transactioncategorystatus import TransactionCategoryStatus +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class BankingTransactionCategory(BaseModel): - r"""The Banking Transaction Categories data type provides a list of hierarchical categories associated with a transaction for greater contextual meaning to transaction activity. - Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'parentId', 'parent_id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + The Banking Transaction Categories data type provides a list of hierarchical categories associated with a transaction for greater contextual meaning to transaction activity. Responses are paged, so you should provide `page` and `pageSize` query parameters in your request. + """ # noqa: E501 + 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") + id: str = Field(description="The unique identifier of the bank transaction category.") + name: str = Field(description="The name of the bank transaction category.") + parent_id: OptionalNullable[str] = Field(default=UNSET, description="The unique identifier of the parent bank transaction category.", alias="parentId") + has_children: Optional[bool] = Field(default=None, description="A Boolean indicating whether there are other bank transaction categories beneath this one in the hierarchy.", alias="hasChildren") + status: Optional[TransactionCategoryStatus] = None + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "parentId", "hasChildren", "status"] - id: str - r"""The unique identifier of the bank transaction category.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - name: str - r"""The name of the bank transaction category.""" - has_children: Annotated[Optional[bool], pydantic.Field(alias="hasChildren")] = None - r"""A Boolean indicating whether there are other bank transaction categories beneath this one in the hierarchy.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + 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()) - parent_id: Annotated[OptionalNullable[str], pydantic.Field(alias="parentId")] = ( - UNSET - ) - r"""The unique identifier of the parent bank transaction category.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BankingTransactionCategory from a JSON string""" + return cls.from_dict(json.loads(json_str)) - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - status: Optional[TransactionCategoryStatus] = None - r"""The status of the transaction category.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["hasChildren", "modifiedDate", "parentId", "sourceModifiedDate", "status"] + * `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(["parentId"]) - 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: - BankingTransactionCategory.model_rebuild() -except NameError: - pass + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankingTransactionCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "parentId": obj.get("parentId"), + "hasChildren": obj.get("hasChildren"), + "status": obj.get("status") + }) + return _obj + + + + + +class BankingTransactionCategoryTypedDict(TypedDict): + """TypedDict variant of BankingTransactionCategory, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[str] + name: NotRequired[str] + parent_id: NotRequired[Optional[str]] + has_children: NotRequired[Optional[bool]] + status: NotRequired[Optional[TransactionCategoryStatus]] diff --git a/lending/src/codat_lending/models/shared/bankingtransactionref.py b/lending/src/codat_lending/models/shared/bankingtransactionref.py index dfbeeef7d..f82e9af1f 100644 --- a/lending/src/codat_lending/models/shared/bankingtransactionref.py +++ b/lending/src/codat_lending/models/shared/bankingtransactionref.py @@ -1,128 +1,119 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 BankingTransactionRefTypedDict(TypedDict): - account_id: NotRequired[str] - r"""Unique identifier of the bank transaction's account.""" - account_name: NotRequired[str] - r"""Name given to account.""" - amount: NotRequired[Decimal] - r"""Bank transaction amount.""" - data_connection_id: NotRequired[str] - r"""Unique identifier of the bank transaction's connection.""" - 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. - """ - description: NotRequired[str] - r"""Description given to bank transaction.""" - id: NotRequired[str] - r"""Unique identifier for the bank transaction.""" - - -class BankingTransactionRef(BaseModel): - account_id: Annotated[Optional[str], pydantic.Field(alias="accountId")] = None - r"""Unique identifier of the bank transaction's account.""" - - account_name: Annotated[Optional[str], pydantic.Field(alias="accountName")] = None - r"""Name given to account.""" - - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Bank transaction amount.""" +""" + Lending - data_connection_id: Annotated[ - Optional[str], pydantic.Field(alias="dataConnectionId") - ] = None - r"""Unique identifier of the bank transaction's connection.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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: + 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 +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +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 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 - - 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 BankingTransactionRef(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} """ + BankingTransactionRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for the bank transaction.") + data_connection_id: Optional[str] = Field(default=None, description="Unique identifier of the bank transaction's connection.", alias="dataConnectionId") + account_id: Optional[str] = Field(default=None, description="Unique identifier of the bank transaction's account.", alias="accountId") + account_name: Optional[str] = Field(default=None, description="Name given to account.", alias="accountName") + 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="date") + description: Optional[str] = Field(default=None, description="Description given to bank transaction.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Bank transaction amount.") + __properties: ClassVar[List[str]] = ["id", "dataConnectionId", "accountId", "accountName", "date", "description", "amount"] + + 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 BankingTransactionRef 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 - description: Optional[str] = None - r"""Description given to bank transaction.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BankingTransactionRef from a dict""" + if obj is None: + return None - id: Optional[str] = None - r"""Unique identifier for the bank transaction.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountId", - "accountName", - "amount", - "dataConnectionId", - "date", - "description", - "id", - ] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "id": obj.get("id"), + "dataConnectionId": obj.get("dataConnectionId"), + "accountId": obj.get("accountId"), + "accountName": obj.get("accountName"), + "date": obj.get("date"), + "description": obj.get("description"), + "amount": obj.get("amount") + }) + 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: - BankingTransactionRef.model_rebuild() -except NameError: - pass +class BankingTransactionRefTypedDict(TypedDict): + """TypedDict variant of BankingTransactionRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_connection_id: NotRequired[Optional[str]] + account_id: NotRequired[Optional[str]] + account_name: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/bankingtransactions.py b/lending/src/codat_lending/models/shared/bankingtransactions.py index 9b18719ca..5f5b6bf0b 100644 --- a/lending/src/codat_lending/models/shared/bankingtransactions.py +++ b/lending/src/codat_lending/models/shared/bankingtransactions.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .bankingtransaction import BankingTransaction, BankingTransactionTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.bankingtransaction import BankingTransaction, BankingTransactionTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class BankingTransactions(BaseModel): -class BankingTransactionsTypedDict(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[BankingTransactionTypedDict]]] + @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} + """ + BankingTransactions + """ # 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[BankingTransaction]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class BankingTransactions(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 BankingTransactions from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[BankingTransaction]]] = 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 BankingTransactions 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": [BankingTransaction.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - BankingTransactions.model_rebuild() -except NameError: - pass + + + + +class BankingTransactionsTypedDict(TypedDict): + """TypedDict variant of BankingTransactions, 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[BankingTransactionTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/bankstatementuploadconfiguration.py b/lending/src/codat_lending/models/shared/bankstatementuploadconfiguration.py index 8c991fada..f885bed78 100644 --- a/lending/src/codat_lending/models/shared/bankstatementuploadconfiguration.py +++ b/lending/src/codat_lending/models/shared/bankstatementuploadconfiguration.py @@ -1,61 +1,130 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +# coding: utf-8 +""" + Lending -class Source(str, Enum): - r"""The source of the banking data that determines its format""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - CODAT = "codat" + 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 BankStatementUploadConfigurationTypedDict(TypedDict): - r"""Configuration settings for uploading banking data to Codat""" - account_id: NotRequired[str] - r"""The ID of the account in the third-party platform""" - provider_id: NotRequired[str] - r"""TrueLayer provider ID (only required if source is TrueLayer)""" - source: NotRequired[Source] - r"""The source of the banking data that determines its format""" +from __future__ import annotations +from codat_lending.models.source import Source +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 BankStatementUploadConfiguration(BaseModel): - r"""Configuration settings for uploading banking data to Codat""" - - account_id: Annotated[Optional[str], pydantic.Field(alias="accountId")] = None - r"""The ID of the account in the third-party platform""" - - provider_id: Annotated[Optional[str], pydantic.Field(alias="providerId")] = None - r"""TrueLayer provider ID (only required if source is TrueLayer)""" - - source: Optional[Source] = None - r"""The source of the banking data that determines its format""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountId", "providerId", "source"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Configuration settings for uploading banking data to Codat + """ # noqa: E501 + source: Optional[Source] = Field(default=None, description="The source of the banking data that determines its format") + account_id: Optional[str] = Field(default=None, description="The ID of the account in the third-party platform", alias="accountId") + provider_id: Optional[str] = Field(default=None, description="TrueLayer provider ID (only required if source is TrueLayer)", alias="providerId") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["source", "accountId", "providerId"] + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['codat']): + raise ValueError("must be one of enum values ('codat')") + 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 BankStatementUploadConfiguration 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 BankStatementUploadConfiguration from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source": obj.get("source"), + "accountId": obj.get("accountId"), + "providerId": obj.get("providerId") + }) + # 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 - 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: - BankStatementUploadConfiguration.model_rebuild() -except NameError: - pass +class BankStatementUploadConfigurationTypedDict(TypedDict): + """TypedDict variant of BankStatementUploadConfiguration, for dict-literal request/response inputs.""" + source: NotRequired[Optional[Source]] + account_id: NotRequired[Optional[str]] + provider_id: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/banktransactiontype.py b/lending/src/codat_lending/models/shared/banktransactiontype.py index b3fcb1a00..2ec6f5403 100644 --- a/lending/src/codat_lending/models/shared/banktransactiontype.py +++ b/lending/src/codat_lending/models/shared/banktransactiontype.py @@ -1,27 +1,54 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 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" + """ + Type of transaction for the bank statement line. + """ + + """ + allowed enum values + """ + 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' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BankTransactionType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/billcreditnotelineitem.py b/lending/src/codat_lending/models/shared/billcreditnotelineitem.py index ffc32f519..210d9f502 100644 --- a/lending/src/codat_lending/models/shared/billcreditnotelineitem.py +++ b/lending/src/codat_lending/models/shared/billcreditnotelineitem.py @@ -1,364 +1,176 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .accountspayabletracking import ( - AccountsPayableTracking, - AccountsPayableTrackingTypedDict, -) -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from .zero import Zero, ZeroTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 ItemReferenceTypedDict(TypedDict): - r"""Reference to the item the line is linked to.""" +""" + Lending - id: str - r"""Unique identifier for the item in the accounting software.""" - name: NotRequired[Nullable[str]] - r"""Name of the item in the accounting software.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -class ItemReference(BaseModel): - r"""Reference to the item the line is linked to.""" + Do not edit the class manually. +""" # noqa: E501 - id: str - r"""Unique identifier for the item in the accounting software.""" - name: OptionalNullable[str] = UNSET - r"""Name of the item in the accounting software.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountspayabletracking import AccountsPayableTracking, AccountsPayableTrackingTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.record_line_reference import RecordLineReference, RecordLineReferenceTypedDict +from codat_lending.models.tax_rate_reference import TaxRateReference, TaxRateReferenceTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BillCreditNoteLineItem(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) + 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 TaxRateReferenceTypedDict(TypedDict): - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs', 'unitOfMeasurement', 'unit_of_measurement'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + BillCreditNoteLineItem + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Friendly name of each line item. For example, the goods or service for which credit has been received.") + unit_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Unit price of the goods or service.", alias="unitAmount") + quantity: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Number of units of the goods or service for which credit has been received.") + unit_of_measurement: OptionalNullable[str] = Field(default=UNSET, description="The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').", alias="unitOfMeasurement") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Value of any discounts applied.", alias="discountAmount") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of credit associated with the line item, including discounts but excluding tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of tax associated with the line item.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the line item, including discounts and tax.", alias="totalAmount") + account_ref: Optional[AccountRef] = Field(default=None, alias="accountRef") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Percentage rate of any discount applied to the line item.", alias="discountPercentage") + tax_rate_ref: Optional[TaxRateReference] = Field(default=None, alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, alias="itemRef") + created_from_line_ref: Optional[RecordLineReference] = Field(default=None, description="Reference to the line of the item that the current line was created from.", alias="createdFromLineRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Reference to the tracking categories to which the line item is linked.", alias="trackingCategoryRefs") + tracking: Optional[AccountsPayableTracking] = None + __properties: ClassVar[List[str]] = ["description", "unitAmount", "quantity", "unitOfMeasurement", "discountAmount", "subTotal", "taxAmount", "totalAmount", "accountRef", "discountPercentage", "taxRateRef", "itemRef", "createdFromLineRef", "trackingCategoryRefs", "tracking"] - effective_tax_rate: NotRequired[Decimal] - r"""Applicable tax rate.""" - id: NotRequired[str] - r"""Unique identifier for the tax rate in the accounting software.""" - name: NotRequired[str] - r"""Name of the tax rate in the accounting software.""" - - -class TaxRateReference(BaseModel): - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - - effective_tax_rate: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="effectiveTaxRate"), - ] = None - r"""Applicable tax rate.""" - - id: Optional[str] = None - r"""Unique identifier for the tax rate in the accounting software.""" - - name: Optional[str] = None - r"""Name of the tax rate in the accounting software.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["effectiveTaxRate", "id", "name"]) - 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 BillCreditNoteLineItemTypedDict(TypedDict): - quantity: Decimal - r"""Number of units of the goods or service for which credit has been received.""" - unit_amount: Decimal - r"""Unit price of the goods or service.""" - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - created_from_line_ref: NotRequired[ZeroTypedDict] - r"""Links the current record line to the underlying record line that created it. - - For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. - """ - description: NotRequired[Nullable[str]] - r"""Friendly name of each line item. For example, the goods or service for which credit has been received.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Value of any discounts applied.""" - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Percentage rate of any discount applied to the line item.""" - item_ref: NotRequired[ItemReferenceTypedDict] - r"""Reference to the item the line is linked to.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""Amount of credit associated with the line item, including discounts but excluding tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""Amount of tax associated with the line item.""" - tax_rate_ref: NotRequired[TaxRateReferenceTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""Total amount of the line item, including discounts and tax.""" - tracking: NotRequired[AccountsPayableTrackingTypedDict] - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Reference to the tracking categories to which the line item is linked.""" - unit_of_measurement: NotRequired[Nullable[str]] - r"""The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').""" - - -class BillCreditNoteLineItem(BaseModel): - quantity: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Number of units of the goods or service for which credit has been received.""" - - unit_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] - r"""Unit price of the goods or service.""" - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - created_from_line_ref: Annotated[ - Optional[Zero], pydantic.Field(alias="createdFromLineRef") - ] = None - r"""Links the current record line to the underlying record line that created it. - For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. - """ - - description: OptionalNullable[str] = UNSET - r"""Friendly name of each line item. For example, the goods or service for which credit has been received.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Value of any discounts applied.""" - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Percentage rate of any discount applied to the line item.""" - - item_ref: Annotated[Optional[ItemReference], pydantic.Field(alias="itemRef")] = None - r"""Reference to the item the line is linked to.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Amount of credit associated with the line item, including discounts but excluding tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""Amount of tax associated with the line item.""" - tax_rate_ref: Annotated[ - Optional[TaxRateReference], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Found on: + 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()) - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""Total amount of the line item, including discounts and tax.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BillCreditNoteLineItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - tracking: Optional[AccountsPayableTracking] = None - r"""Categories, and a project and customer, against which the item is tracked.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="trackingCategoryRefs", - ), - ] = UNSET - r"""Reference to the tracking categories to which the line item is linked.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - unit_of_measurement: Annotated[ - OptionalNullable[str], pydantic.Field(alias="unitOfMeasurement") - ] = UNSET - r"""The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').""" + * `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( - [ - "accountRef", - "createdFromLineRef", - "description", - "discountAmount", - "discountPercentage", - "itemRef", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "tracking", - "trackingCategoryRefs", - "unitOfMeasurement", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - "unitOfMeasurement", - ] - ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of created_from_line_ref + if self.created_from_line_ref: + _dict['createdFromLineRef'] = self.created_from_line_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BillCreditNoteLineItem 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"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "unitOfMeasurement": obj.get("unitOfMeasurement"), + "discountAmount": obj.get("discountAmount"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "discountPercentage": obj.get("discountPercentage"), + "taxRateRef": TaxRateReference.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "createdFromLineRef": RecordLineReference.from_dict(obj["createdFromLineRef"]) if obj.get("createdFromLineRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "tracking": AccountsPayableTracking.from_dict(obj["tracking"]) if obj.get("tracking") 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 -try: - TaxRateReference.model_rebuild() -except NameError: - pass -try: - BillCreditNoteLineItem.model_rebuild() -except NameError: - pass +class BillCreditNoteLineItemTypedDict(TypedDict): + """TypedDict variant of BillCreditNoteLineItem, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Decimal] + quantity: NotRequired[Decimal] + unit_of_measurement: NotRequired[Optional[str]] + discount_amount: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + discount_percentage: NotRequired[Optional[Decimal]] + tax_rate_ref: NotRequired[Optional[TaxRateReferenceTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + created_from_line_ref: NotRequired[Optional[RecordLineReferenceTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + tracking: NotRequired[Optional[AccountsPayableTrackingTypedDict]] diff --git a/lending/src/codat_lending/models/shared/billcreditnotestatus.py b/lending/src/codat_lending/models/shared/billcreditnotestatus.py index 271203f0e..f0dc68cdb 100644 --- a/lending/src/codat_lending/models/shared/billcreditnotestatus.py +++ b/lending/src/codat_lending/models/shared/billcreditnotestatus.py @@ -1,15 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 BillCreditNoteStatus(str, Enum): - r"""Current state of the bill credit note""" - - UNKNOWN = "Unknown" - DRAFT = "Draft" - SUBMITTED = "Submitted" - PAID = "Paid" - VOID = "Void" - PARTIALLY_PAID = "PartiallyPaid" + """ + Current state of the bill credit note + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + DRAFT = 'Draft' + SUBMITTED = 'Submitted' + PAID = 'Paid' + VOID = 'Void' + PARTIALLY_PAID = 'PartiallyPaid' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BillCreditNoteStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/billedtotype.py b/lending/src/codat_lending/models/shared/billedtotype.py index d5c914d9e..b9a2c5a55 100644 --- a/lending/src/codat_lending/models/shared/billedtotype.py +++ b/lending/src/codat_lending/models/shared/billedtotype.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 BilledToType(str, Enum): - r"""Defines if the invoice or credit note is billed/rebilled to a project or customer.""" + """ + Defines if the invoice or credit note is billed/rebilled to a project or customer. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + NOT_APPLICABLE = 'NotApplicable' + CUSTOMER = 'Customer' + PROJECT = 'Project' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BilledToType from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - NOT_APPLICABLE = "NotApplicable" - CUSTOMER = "Customer" - PROJECT = "Project" diff --git a/lending/src/codat_lending/models/shared/billedtotype1.py b/lending/src/codat_lending/models/shared/billedtotype1.py index 21c473f1c..65c515836 100644 --- a/lending/src/codat_lending/models/shared/billedtotype1.py +++ b/lending/src/codat_lending/models/shared/billedtotype1.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 BilledToType1(str, Enum): - r"""Defines if the bill or bill credit note is billed/rebilled to a project.""" + """ + Defines if the bill or bill credit note is billed/rebilled to a project. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + NOT_APPLICABLE = 'NotApplicable' + PROJECT = 'Project' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BilledToType1 from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - NOT_APPLICABLE = "NotApplicable" - PROJECT = "Project" diff --git a/lending/src/codat_lending/models/shared/billlineitem.py b/lending/src/codat_lending/models/shared/billlineitem.py index 6e24af39c..f6d175a37 100644 --- a/lending/src/codat_lending/models/shared/billlineitem.py +++ b/lending/src/codat_lending/models/shared/billlineitem.py @@ -1,320 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .accountspayabletracking import ( - AccountsPayableTracking, - AccountsPayableTrackingTypedDict, -) -from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict -from .taxrateref import TaxRateRef, TaxRateRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class BillLineItemDataType(str, Enum): - r"""Allowed name of the 'dataType'.""" - - PURCHASE_ORDERS = "purchaseOrders" - BILLS = "bills" - - -class RecordLineReferenceTypedDict(TypedDict): - r"""Reference to the purchase order line this line was generated from.""" - - data_type: NotRequired[BillLineItemDataType] - r"""Allowed name of the 'dataType'.""" - id: NotRequired[str] - r"""'id' of the underlying record.""" - line_number: NotRequired[str] - r"""Line number of the underlying record.""" - - -class RecordLineReference(BaseModel): - r"""Reference to the purchase order line this line was generated from.""" - - data_type: Annotated[ - Optional[BillLineItemDataType], pydantic.Field(alias="dataType") - ] = None - r"""Allowed name of the 'dataType'.""" - - id: Optional[str] = None - r"""'id' of the underlying record.""" - - line_number: Annotated[Optional[str], pydantic.Field(alias="lineNumber")] = None - r"""Line number of the underlying record.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id", "lineNumber"]) - 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 BillLineItemTypedDict(TypedDict): - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: NotRequired[Nullable[str]] - r"""Friendly name of the goods or services received.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Numerical value of any discounts applied. - - Do not use to apply discounts in Oracle NetSuite—see Oracle NetSuite integration reference. - """ - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Percentage rate of any discount applied to the bill.""" - is_direct_cost: NotRequired[bool] - r"""The bill is a direct cost if `True`.""" - item_ref: NotRequired[PropertieItemRefTypedDict] - r"""Reference to the item the line is linked to.""" - line_number: NotRequired[Nullable[str]] - r"""The bill line's number.""" - purchase_order_line_ref: NotRequired[RecordLineReferenceTypedDict] - quantity: NotRequired[Decimal] - r"""Number of units of goods or services received.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""Amount of tax for the line.""" - tax_rate_ref: NotRequired[TaxRateRefTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""Total amount of the line, including tax.""" - tracking: NotRequired[AccountsPayableTrackingTypedDict] - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Collection of categories against which this item is tracked.""" - unit_amount: NotRequired[Decimal] - r"""Price of each unit of goods or services.""" - unit_of_measurement: NotRequired[Nullable[str]] - r"""The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').""" - - -class BillLineItem(BaseModel): - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: OptionalNullable[str] = UNSET - r"""Friendly name of the goods or services received.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Numerical value of any discounts applied. - - Do not use to apply discounts in Oracle NetSuite—see Oracle NetSuite integration reference. - """ - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Percentage rate of any discount applied to the bill.""" - - is_direct_cost: Annotated[Optional[bool], pydantic.Field(alias="isDirectCost")] = ( - None - ) - r"""The bill is a direct cost if `True`.""" - - item_ref: Annotated[Optional[PropertieItemRef], pydantic.Field(alias="itemRef")] = ( - None - ) - r"""Reference to the item the line is linked to.""" - - line_number: Annotated[ - OptionalNullable[str], pydantic.Field(alias="lineNumber") - ] = UNSET - r"""The bill line's number.""" - - purchase_order_line_ref: Annotated[ - Optional[RecordLineReference], pydantic.Field(alias="purchaseOrderLineRef") - ] = None - - quantity: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Number of units of goods or services received.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""Amount of tax for the line.""" - - tax_rate_ref: Annotated[ - Optional[TaxRateRef], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""Total amount of the line, including tax.""" - - tracking: Optional[AccountsPayableTracking] = None - r"""Categories, and a project and customer, against which the item is tracked.""" - - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field(alias="trackingCategoryRefs"), - ] = UNSET - r"""Collection of categories against which this item is tracked.""" - - unit_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] = None - r"""Price of each unit of goods or services.""" - - unit_of_measurement: Annotated[ - OptionalNullable[str], pydantic.Field(alias="unitOfMeasurement") - ] = UNSET - r"""The measurement which defines a unit for this item (e.g. 'kilogram', 'litre').""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "description", - "discountAmount", - "discountPercentage", - "isDirectCost", - "itemRef", - "lineNumber", - "purchaseOrderLineRef", - "quantity", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "tracking", - "trackingCategoryRefs", - "unitAmount", - "unitOfMeasurement", - ] - ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "lineNumber", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - "unitOfMeasurement", - ] - ) - 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: - RecordLineReference.model_rebuild() -except NameError: - pass -try: - BillLineItem.model_rebuild() -except NameError: - pass +from codat_lending.models._compat.billlineitem import BillLineItemDataType diff --git a/lending/src/codat_lending/models/shared/billpaymentline.py b/lending/src/codat_lending/models/shared/billpaymentline.py index 6d3c1d93f..c7295d04c 100644 --- a/lending/src/codat_lending/models/shared/billpaymentline.py +++ b/lending/src/codat_lending/models/shared/billpaymentline.py @@ -1,112 +1,120 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .billpaymentlinelink import BillPaymentLineLink, BillPaymentLineLinkTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 - +from codat_lending.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_lending.models.shared.billpaymentlinelink import BillPaymentLineLink, BillPaymentLineLinkTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BillPaymentLine(BaseModel): -class BillPaymentLineTypedDict(TypedDict): - amount: Decimal - r"""Amount in the bill payment currency.""" - allocated_on_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: + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'links'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + BillPaymentLine + """ # noqa: E501 + amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount in the bill payment currency.") + links: OptionalNullable[List[BillPaymentLineLink]] = UNSET + allocated_on_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="allocatedOnDate") + __properties: ClassVar[List[str]] = ["amount", "links", "allocatedOnDate"] - ``` - 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 BillPaymentLine 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. - """ - links: NotRequired[Nullable[List[BillPaymentLineLinkTypedDict]]] + 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 BillPaymentLine(BaseModel): - amount: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Amount in the bill payment currency.""" + * `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([ + ]) - allocated_on_date: Annotated[ - Optional[str], pydantic.Field(alias="allocatedOnDate") - ] = 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 each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + 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 BillPaymentLine from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "links": [BillPaymentLineLink.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "allocatedOnDate": obj.get("allocatedOnDate") + }) + 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. - """ - links: OptionalNullable[List[BillPaymentLineLink]] = UNSET - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["allocatedOnDate", "links"]) - nullable_fields = set(["links"]) - 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: - BillPaymentLine.model_rebuild() -except NameError: - pass +class BillPaymentLineTypedDict(TypedDict): + """TypedDict variant of BillPaymentLine, for dict-literal request/response inputs.""" + amount: NotRequired[Decimal] + links: NotRequired[Optional[List[BillPaymentLineLinkTypedDict]]] + allocated_on_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/billpaymentlinelink.py b/lending/src/codat_lending/models/shared/billpaymentlinelink.py index 8f1e92fc7..852e25e3f 100644 --- a/lending/src/codat_lending/models/shared/billpaymentlinelink.py +++ b/lending/src/codat_lending/models/shared/billpaymentlinelink.py @@ -1,157 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .billpaymentlinelinktype import BillPaymentLineLinkType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.utils import serialize_decimal, validate_decimal -from decimal import Decimal -import pydantic -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing_extensions import Annotated, NotRequired, TypedDict - - -class BillPaymentLineLinkTypedDict(TypedDict): - type: BillPaymentLineLinkType - r"""Types of links to bill payment lines.""" - amount: NotRequired[Nullable[Decimal]] - r"""Amount by which the balance of the linked entity is altered, in the currency of the linked entity. - - - A negative link amount reduces the outstanding amount on the accounts payable account. - - A positive link amount increases the outstanding amount on the accounts payable account. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). +""" + Lending - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ## Examples with base currency of GBP + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + Do not edit the class manually. +""" # noqa: E501 - ## Examples with base currency of USD - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.billpaymentlinelinktype import BillPaymentLineLinkType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class BillPaymentLineLink(BaseModel): - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'amount', 'currencyRate', 'currency_rate', 'id'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - id: NotRequired[Nullable[str]] - r"""Unique identifier of the transaction represented by the link.""" - - -class BillPaymentLineLink(BaseModel): + BillPaymentLineLink + """ # noqa: E501 type: BillPaymentLineLinkType - r"""Types of links to bill payment lines.""" + id: OptionalNullable[str] = Field(default=UNSET, description="Unique identifier of the transaction represented by the link.") + amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount by which the balance of the linked entity is altered, in the currency of the linked entity. - A negative link amount reduces the outstanding amount on the accounts payable account. - A positive link amount increases the outstanding amount on the accounts payable account.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + __properties: ClassVar[List[str]] = ["type", "id", "amount", "currencyRate"] - amount: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Amount by which the balance of the linked entity is altered, in the currency of the linked entity. + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - - A negative link amount reduces the outstanding amount on the accounts payable account. - - A positive link amount increases the outstanding amount on the accounts payable account. - """ - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + 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()) - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BillPaymentLineLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - ## Examples with base currency of GBP + * `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([ + ]) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - ## Examples with base currency of USD + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BillPaymentLineLink from a dict""" + if obj is None: + return None - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "type": obj.get("type"), + "id": obj.get("id"), + "amount": obj.get("amount"), + "currencyRate": obj.get("currencyRate") + }) + return _obj - ### Integration-specific details - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: OptionalNullable[str] = UNSET - r"""Unique identifier of the transaction represented by the link.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "currencyRate", "id"]) - nullable_fields = set(["amount", "currencyRate", "id"]) - 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: - BillPaymentLineLink.model_rebuild() -except NameError: - pass + +class BillPaymentLineLinkTypedDict(TypedDict): + """TypedDict variant of BillPaymentLineLink, for dict-literal request/response inputs.""" + type: BillPaymentLineLinkType + id: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency_rate: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/billpaymentlinelinktype.py b/lending/src/codat_lending/models/shared/billpaymentlinelinktype.py index b898e3700..cc9ec16da 100644 --- a/lending/src/codat_lending/models/shared/billpaymentlinelinktype.py +++ b/lending/src/codat_lending/models/shared/billpaymentlinelinktype.py @@ -1,19 +1,46 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 BillPaymentLineLinkType(str, Enum): - r"""Types of links to bill payment lines.""" - - UNKNOWN = "Unknown" - UNLINKED = "Unlinked" - BILL = "Bill" - OTHER = "Other" - CREDIT_NOTE = "CreditNote" - BILL_PAYMENT = "BillPayment" - PAYMENT_ON_ACCOUNT = "PaymentOnAccount" - REFUND = "Refund" - MANUAL_JOURNAL = "ManualJournal" - DISCOUNT = "Discount" + """ + Types of links to bill payment lines. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + UNLINKED = 'Unlinked' + BILL = 'Bill' + OTHER = 'Other' + CREDIT_NOTE = 'CreditNote' + BILL_PAYMENT = 'BillPayment' + PAYMENT_ON_ACCOUNT = 'PaymentOnAccount' + REFUND = 'Refund' + MANUAL_JOURNAL = 'ManualJournal' + DISCOUNT = 'Discount' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BillPaymentLineLinkType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/billstatus.py b/lending/src/codat_lending/models/shared/billstatus.py index ed31a143f..5a7944c99 100644 --- a/lending/src/codat_lending/models/shared/billstatus.py +++ b/lending/src/codat_lending/models/shared/billstatus.py @@ -1,15 +1,42 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 BillStatus(str, Enum): - r"""Current state of the bill.""" - - UNKNOWN = "Unknown" - OPEN = "Open" - PARTIALLY_PAID = "PartiallyPaid" - PAID = "Paid" - VOID = "Void" - DRAFT = "Draft" + """ + Current state of the bill. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + OPEN = 'Open' + PARTIALLY_PAID = 'PartiallyPaid' + PAID = 'Paid' + VOID = 'Void' + DRAFT = 'Draft' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of BillStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/cashflowstatement.py b/lending/src/codat_lending/models/shared/cashflowstatement.py index 683ac1b11..2004d1b5b 100644 --- a/lending/src/codat_lending/models/shared/cashflowstatement.py +++ b/lending/src/codat_lending/models/shared/cashflowstatement.py @@ -1,132 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .reportline import ReportLine, ReportLineTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CashFlowStatementTypedDict(TypedDict): - cash_payments: NotRequired[ReportLineTypedDict] - cash_receipts: NotRequired[ReportLineTypedDict] - from_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - to_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 - ``` + 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: - - - 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. - """ - +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.reportline import ReportLine, ReportLineTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CashFlowStatement(BaseModel): - cash_payments: Annotated[ - Optional[ReportLine], pydantic.Field(alias="cashPayments") - ] = None - - cash_receipts: Annotated[ - Optional[ReportLine], pydantic.Field(alias="cashReceipts") - ] = None - - from_date: Annotated[Optional[str], pydantic.Field(alias="fromDate")] = 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. - """ - - to_date: Annotated[Optional[str], pydantic.Field(alias="toDate")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["cashPayments", "cashReceipts", "fromDate", "toDate"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CashFlowStatement + """ # noqa: E501 + from_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="fromDate") + to_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="toDate") + cash_receipts: Optional[ReportLine] = Field(default=None, description="ReportLines for cash receipts from the sale of goods.", alias="cashReceipts") + cash_payments: Optional[ReportLine] = Field(default=None, description="ReportLines for cash payments to suppliers for the purchase of goods or services.", alias="cashPayments") + __properties: ClassVar[List[str]] = ["fromDate", "toDate", "cashReceipts", "cashPayments"] + + 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 CashFlowStatement 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 cash_receipts + if self.cash_receipts: + _dict['cashReceipts'] = self.cash_receipts.to_dict() + # override the default output from pydantic by calling `to_dict()` of cash_payments + if self.cash_payments: + _dict['cashPayments'] = self.cash_payments.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CashFlowStatement from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fromDate": obj.get("fromDate"), + "toDate": obj.get("toDate"), + "cashReceipts": ReportLine.from_dict(obj["cashReceipts"]) if obj.get("cashReceipts") is not None else None, + "cashPayments": ReportLine.from_dict(obj["cashPayments"]) if obj.get("cashPayments") 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: - CashFlowStatement.model_rebuild() -except NameError: - pass +class CashFlowStatementTypedDict(TypedDict): + """TypedDict variant of CashFlowStatement, for dict-literal request/response inputs.""" + from_date: NotRequired[Optional[str]] + to_date: NotRequired[Optional[str]] + cash_receipts: NotRequired[Optional[ReportLineTypedDict]] + cash_payments: NotRequired[Optional[ReportLineTypedDict]] diff --git a/lending/src/codat_lending/models/shared/clientratelimitwebhook.py b/lending/src/codat_lending/models/shared/clientratelimitwebhook.py index 832f52cc7..99d462d24 100644 --- a/lending/src/codat_lending/models/shared/clientratelimitwebhook.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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/lending/src/codat_lending/models/shared/clientratelimitwebhookpayload.py b/lending/src/codat_lending/models/shared/clientratelimitwebhookpayload.py index a6d654b6e..7c1b50f42 100644 --- a/lending/src/codat_lending/models/shared/clientratelimitwebhookpayload.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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/lending/src/codat_lending/models/shared/codatfile.py b/lending/src/codat_lending/models/shared/codatfile.py index ceb044b80..0adbb4fae 100644 --- a/lending/src/codat_lending/models/shared/codatfile.py +++ b/lending/src/codat_lending/models/shared/codatfile.py @@ -1,50 +1,33 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 +"""Speakeasy-compat multipart file helper. Not an OAS schema — Speakeasy emits this +to wrap multipart/form-data file uploads (see AttachmentUpload).""" from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import FieldMetadata, MultipartFormMetadata -import io -import pydantic -from pydantic import model_serializer -from typing import IO, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - -class CodatFileTypedDict(TypedDict): - content: Union[bytes, IO[bytes], io.BufferedReader] - file_name: str - content_type: NotRequired[str] +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import IO, Any, Optional, Union +from typing_extensions import NotRequired, TypedDict class CodatFile(BaseModel): - content: Annotated[ - Union[bytes, IO[bytes], io.BufferedReader], - pydantic.Field(alias=""), - FieldMetadata(multipart=MultipartFormMetadata(content=True)), - ] - - file_name: Annotated[ - str, pydantic.Field(alias="fileName"), FieldMetadata(multipart=True) - ] - - content_type: Annotated[ - Optional[str], - pydantic.Field(alias="Content-Type"), - FieldMetadata(multipart=True), - ] = None @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["contentType"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + file_name: str = Field(alias="fileName") + content: Union[bytes, IO[bytes]] + content_type: Optional[str] = Field(default=None, alias="Content-Type") - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + model_config = ConfigDict( + populate_by_name=True, + arbitrary_types_allowed=True, + protected_namespaces=(), + ) - return m + +class CodatFileTypedDict(TypedDict): + file_name: str + content: Union[bytes, Any] + content_type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commerceaddress.py b/lending/src/codat_lending/models/shared/commerceaddress.py index 86854626e..33ff1aa59 100644 --- a/lending/src/codat_lending/models/shared/commerceaddress.py +++ b/lending/src/codat_lending/models/shared/commerceaddress.py @@ -1,73 +1,118 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .commerceaddresstype import CommerceAddressType -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceAddressTypedDict(TypedDict): - city: NotRequired[str] - r"""The third line of the address, or city""" - country: NotRequired[str] - r"""The country for the address""" - line1: NotRequired[str] - r"""The first line of the address""" - line2: NotRequired[str] - r"""The second line of the address""" - postal_code: NotRequired[str] - r"""The postal (or zip) code for the address""" - region: NotRequired[str] - r"""The fourth line of the address, or region""" - type: NotRequired[CommerceAddressType] - r"""The type of the address""" + 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 CommerceAddress(BaseModel): - city: Optional[str] = None - r"""The third line of the address, or city""" - country: Optional[str] = None - r"""The country for the address""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - line1: Optional[str] = None - r"""The first line of the address""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.commerceaddresstype import CommerceAddressType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - line2: Optional[str] = None - r"""The second line of the address""" +class CommerceAddress(BaseModel): - postal_code: Annotated[Optional[str], pydantic.Field(alias="postalCode")] = None - r"""The postal (or zip) code for the address""" + @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} + """ + CommerceAddress + """ # noqa: E501 + type: Optional[CommerceAddressType] = None + line1: Optional[str] = Field(default=None, description="The first line of the address") + line2: Optional[str] = Field(default=None, description="The second line of the address") + city: Optional[str] = Field(default=None, description="The third line of the address, or city") + region: Optional[str] = Field(default=None, description="The fourth line of the address, or region") + country: Optional[str] = Field(default=None, description="The country for the address") + postal_code: Optional[str] = Field(default=None, description="The postal (or zip) code for the address", alias="postalCode") + __properties: ClassVar[List[str]] = ["type", "line1", "line2", "city", "region", "country", "postalCode"] + + 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 CommerceAddress 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 - region: Optional[str] = None - r"""The fourth line of the address, or region""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceAddress from a dict""" + if obj is None: + return None - type: Optional[CommerceAddressType] = None - r"""The type of the address""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["city", "country", "line1", "line2", "postalCode", "region", "type"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "type": obj.get("type"), + "line1": obj.get("line1"), + "line2": obj.get("line2"), + "city": obj.get("city"), + "region": obj.get("region"), + "country": obj.get("country"), + "postalCode": obj.get("postalCode") + }) + 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: - CommerceAddress.model_rebuild() -except NameError: - pass +class CommerceAddressTypedDict(TypedDict): + """TypedDict variant of CommerceAddress, for dict-literal request/response inputs.""" + type: NotRequired[Optional[CommerceAddressType]] + line1: NotRequired[Optional[str]] + line2: NotRequired[Optional[str]] + city: NotRequired[Optional[str]] + region: NotRequired[Optional[str]] + country: NotRequired[Optional[str]] + postal_code: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commerceaddresstype.py b/lending/src/codat_lending/models/shared/commerceaddresstype.py index d85ebcbce..ae1015d66 100644 --- a/lending/src/codat_lending/models/shared/commerceaddresstype.py +++ b/lending/src/codat_lending/models/shared/commerceaddresstype.py @@ -1,14 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 CommerceAddressType(str, Enum): - r"""The type of the address""" + """ + The type of the address + """ + + """ + allowed enum values + """ + BILLING = 'Billing' + DELIVERY = 'Delivery' + ORDER = 'Order' + INVENTORY = 'Inventory' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CommerceAddressType from a JSON string""" + return cls(json.loads(json_str)) + - BILLING = "Billing" - DELIVERY = "Delivery" - ORDER = "Order" - INVENTORY = "Inventory" - UNKNOWN = "Unknown" diff --git a/lending/src/codat_lending/models/shared/commercecompanyinfo.py b/lending/src/codat_lending/models/shared/commercecompanyinfo.py index 848f72158..f0e4f072e 100644 --- a/lending/src/codat_lending/models/shared/commercecompanyinfo.py +++ b/lending/src/codat_lending/models/shared/commercecompanyinfo.py @@ -1,194 +1,167 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountbalance import AccountBalance, AccountBalanceTypedDict -from .commerceaddress import CommerceAddress, CommerceAddressTypedDict -from .phonenumber import PhoneNumber, PhoneNumberTypedDict -from .weblink import WebLink, WebLinkTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CommerceCompanyInfoTypedDict(TypedDict): - r"""In the Codat system, company profile includes standard commercial details about - a linked company, such as their address, phone number, and company registration. - - """ - - account_balances: NotRequired[List[AccountBalanceTypedDict]] - r"""The available and current cash balances for the company's accounts""" - addresses: NotRequired[List[CommerceAddressTypedDict]] - r"""Addresses associated with the company""" - base_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. - """ - commerce_platform_ref: NotRequired[str] - r"""Identifier or reference for the company in the commerce software""" - company_legal_name: NotRequired[str] - r"""The full legal name of the company""" - company_name: NotRequired[str] - r"""The name of the company""" - created_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - modified_date: NotRequired[str] - phone_numbers: NotRequired[List[PhoneNumberTypedDict]] - r"""Phone numbers associated with the company""" - registration_number: NotRequired[str] - r"""The registration number of the company""" - source_modified_date: NotRequired[str] - source_urls: NotRequired[Dict[str, str]] - r"""URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system""" - web_links: NotRequired[List[WebLinkTypedDict]] - r"""Weblinks associated with the company""" +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_lending.models.shared.accountbalance import AccountBalance, AccountBalanceTypedDict +from codat_lending.models.shared.commerceaddress import CommerceAddress, CommerceAddressTypedDict +from codat_lending.models.phone_number import PhoneNumber, PhoneNumberTypedDict +from codat_lending.models.shared.weblink import WebLink, WebLinkTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CommerceCompanyInfo(BaseModel): - r"""In the Codat system, company profile includes standard commercial details about - a linked company, such as their address, phone number, and company registration. - - """ - - account_balances: Annotated[ - Optional[List[AccountBalance]], pydantic.Field(alias="accountBalances") - ] = None - r"""The available and current cash balances for the company's accounts""" - - addresses: Optional[List[CommerceAddress]] = None - r"""Addresses associated with the company""" - - base_currency: Annotated[Optional[str], pydantic.Field(alias="baseCurrency")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + In the Codat system, company profile includes standard commercial details about a linked company, such as their address, phone number, and company registration. + """ # noqa: E501 + created_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="createdDate") + 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") + company_name: Optional[str] = Field(default=None, description="The name of the company", alias="companyName") + commerce_platform_ref: Optional[str] = Field(default=None, description="Identifier or reference for the company in the commerce software", alias="commercePlatformRef") + company_legal_name: Optional[str] = Field(default=None, description="The full legal name of the company", alias="companyLegalName") + addresses: Optional[List[CommerceAddress]] = Field(default=None, description="Addresses associated with the company") + phone_numbers: Optional[List[PhoneNumber]] = Field(default=None, description="Phone numbers associated with the company", alias="phoneNumbers") + web_links: Optional[List[WebLink]] = Field(default=None, description="Weblinks associated with the company", alias="webLinks") + registration_number: Optional[str] = Field(default=None, description="The registration number of the company", alias="registrationNumber") + base_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="baseCurrency") + account_balances: Optional[List[AccountBalance]] = Field(default=None, description="The available and current cash balances for the company's accounts", alias="accountBalances") + source_urls: Optional[Dict[str, str]] = Field(default=None, description="URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system", alias="sourceUrls") + __properties: ClassVar[List[str]] = ["createdDate", "modifiedDate", "sourceModifiedDate", "companyName", "commercePlatformRef", "companyLegalName", "addresses", "phoneNumbers", "webLinks", "registrationNumber", "baseCurrency", "accountBalances", "sourceUrls"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - commerce_platform_ref: Annotated[ - Optional[str], pydantic.Field(alias="commercePlatformRef") - ] = None - r"""Identifier or reference for the company in the commerce software""" - - company_legal_name: Annotated[ - Optional[str], pydantic.Field(alias="companyLegalName") - ] = None - r"""The full legal name of the company""" - - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""The name of the company""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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` + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - > 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_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()) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CommerceCompanyInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - phone_numbers: Annotated[ - Optional[List[PhoneNumber]], pydantic.Field(alias="phoneNumbers") - ] = None - r"""Phone numbers associated with the company""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - registration_number: Annotated[ - Optional[str], pydantic.Field(alias="registrationNumber") - ] = None - r"""The registration number of the company""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + * `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_urls: Annotated[ - Optional[Dict[str, str]], pydantic.Field(alias="sourceUrls") - ] = None - r"""URL addresses for the originating system. For example, potential use cases include 'deeplinking' to the originating system""" - - web_links: Annotated[Optional[List[WebLink]], pydantic.Field(alias="webLinks")] = ( - None - ) - r"""Weblinks associated with the company""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountBalances", - "addresses", - "baseCurrency", - "commercePlatformRef", - "companyLegalName", - "companyName", - "createdDate", - "modifiedDate", - "phoneNumbers", - "registrationNumber", - "sourceModifiedDate", - "sourceUrls", - "webLinks", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in phone_numbers (list) + _items = [] + if self.phone_numbers: + for _item_phone_numbers in self.phone_numbers: + if _item_phone_numbers: + _items.append(_item_phone_numbers.to_dict()) + _dict['phoneNumbers'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in web_links (list) + _items = [] + if self.web_links: + for _item_web_links in self.web_links: + if _item_web_links: + _items.append(_item_web_links.to_dict()) + _dict['webLinks'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in account_balances (list) + _items = [] + if self.account_balances: + for _item_account_balances in self.account_balances: + if _item_account_balances: + _items.append(_item_account_balances.to_dict()) + _dict['accountBalances'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceCompanyInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "companyName": obj.get("companyName"), + "commercePlatformRef": obj.get("commercePlatformRef"), + "companyLegalName": obj.get("companyLegalName"), + "addresses": [CommerceAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "phoneNumbers": [PhoneNumber.from_dict(_item) for _item in obj["phoneNumbers"]] if obj.get("phoneNumbers") is not None else None, + "webLinks": [WebLink.from_dict(_item) for _item in obj["webLinks"]] if obj.get("webLinks") is not None else None, + "registrationNumber": obj.get("registrationNumber"), + "baseCurrency": obj.get("baseCurrency"), + "accountBalances": [AccountBalance.from_dict(_item) for _item in obj["accountBalances"]] if obj.get("accountBalances") is not None else None, + "sourceUrls": obj.get("sourceUrls") + }) + 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: - CommerceCompanyInfo.model_rebuild() -except NameError: - pass +class CommerceCompanyInfoTypedDict(TypedDict): + """TypedDict variant of CommerceCompanyInfo, for dict-literal request/response inputs.""" + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + company_name: NotRequired[Optional[str]] + commerce_platform_ref: NotRequired[Optional[str]] + company_legal_name: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[CommerceAddressTypedDict]]] + phone_numbers: NotRequired[Optional[List[PhoneNumberTypedDict]]] + web_links: NotRequired[Optional[List[WebLinkTypedDict]]] + registration_number: NotRequired[Optional[str]] + base_currency: NotRequired[Optional[str]] + account_balances: NotRequired[Optional[List[AccountBalanceTypedDict]]] + source_urls: NotRequired[Optional[Dict[str, str]]] diff --git a/lending/src/codat_lending/models/shared/commercecustomer.py b/lending/src/codat_lending/models/shared/commercecustomer.py index f709b8ba3..86ff33bff 100644 --- a/lending/src/codat_lending/models/shared/commercecustomer.py +++ b/lending/src/codat_lending/models/shared/commercecustomer.py @@ -1,153 +1,139 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .commerceaddress import CommerceAddress, CommerceAddressTypedDict -from codat_lending.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 CommerceCustomerTypedDict(TypedDict): - r"""When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn.""" +""" + Lending - id: str - r"""A unique, persistent identifier for this record""" - addresses: NotRequired[List[CommerceAddressTypedDict]] - r"""Addresses of the customer""" - created_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: + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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. - """ - customer_name: NotRequired[str] - r"""Name of the customer""" - default_currency: NotRequired[str] - email_address: NotRequired[str] - r"""Email address of the customer""" - modified_date: NotRequired[str] - note: NotRequired[str] - r"""Any additional information about the customer""" - phone: NotRequired[Nullable[str]] - r"""A phone number.""" - source_modified_date: NotRequired[str] +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_lending.models.shared.commerceaddress import CommerceAddress, CommerceAddressTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class CommerceCustomer(BaseModel): - r"""When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn.""" - - id: str - r"""A unique, persistent identifier for this record""" - - addresses: Optional[List[CommerceAddress]] = None - r"""Addresses of the customer""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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 = {'phone'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + When a customer places an order with the connected commerce store their details are added to the Customers dataset. You can use the data from the Customers endpoints to calculate key metrics, such as customer churn. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + created_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="createdDate") + 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") + customer_name: Optional[str] = Field(default=None, description="Name of the customer", alias="customerName") + email_address: Optional[str] = Field(default=None, description="Email address of the customer", alias="emailAddress") + phone: OptionalNullable[str] = Field(default=UNSET, description="A phone number.") + default_currency: Optional[str] = Field(default=None, description="Default currency of any transactional data for the customer, for example, orders or payments ", alias="defaultCurrency") + addresses: Optional[List[CommerceAddress]] = Field(default=None, description="Addresses of the customer") + note: Optional[str] = Field(default=None, description="Any additional information about the customer") + __properties: ClassVar[List[str]] = ["id", "createdDate", "modifiedDate", "sourceModifiedDate", "customerName", "emailAddress", "phone", "defaultCurrency", "addresses", "note"] + + 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 CommerceCustomer 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 addresses (list) + _items = [] + if self.addresses: + for _item_addresses in self.addresses: + if _item_addresses: + _items.append(_item_addresses.to_dict()) + _dict['addresses'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceCustomer 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"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "customerName": obj.get("customerName"), + "emailAddress": obj.get("emailAddress"), + "phone": obj.get("phone"), + "defaultCurrency": obj.get("defaultCurrency"), + "addresses": [CommerceAddress.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None, + "note": obj.get("note") + }) + return _obj - customer_name: Annotated[Optional[str], pydantic.Field(alias="customerName")] = None - r"""Name of the customer""" - - default_currency: Annotated[ - Optional[str], pydantic.Field(alias="defaultCurrency") - ] = None - - email_address: Annotated[Optional[str], pydantic.Field(alias="emailAddress")] = None - r"""Email address of the customer""" - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - note: Optional[str] = None - r"""Any additional information about the customer""" - phone: OptionalNullable[str] = UNSET - r"""A phone number.""" - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "addresses", - "createdDate", - "customerName", - "defaultCurrency", - "emailAddress", - "modifiedDate", - "note", - "phone", - "sourceModifiedDate", - ] - ) - nullable_fields = set(["phone"]) - 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: - CommerceCustomer.model_rebuild() -except NameError: - pass +class CommerceCustomerTypedDict(TypedDict): + """TypedDict variant of CommerceCustomer, for dict-literal request/response inputs.""" + id: NotRequired[str] + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + customer_name: NotRequired[Optional[str]] + email_address: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + default_currency: NotRequired[Optional[str]] + addresses: NotRequired[Optional[List[CommerceAddressTypedDict]]] + note: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commercecustomerref.py b/lending/src/codat_lending/models/shared/commercecustomerref.py index 0f578b231..500398e54 100644 --- a/lending/src/codat_lending/models/shared/commercecustomerref.py +++ b/lending/src/codat_lending/models/shared/commercecustomerref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceCustomerRefTypedDict(TypedDict): - r"""Reference to the customer that placed the order.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique identitifer of the customer being referenced""" - name: NotRequired[str] - r"""Name of the customer being referenced.""" + Do not edit the class manually. +""" # noqa: E501 -class CommerceCustomerRef(BaseModel): - r"""Reference to the customer that placed the order.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique identitifer of the customer being referenced""" +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 - name: Optional[str] = None - r"""Name of the customer being referenced.""" +class CommerceCustomerRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Reference to the customer that placed the order. + """ # noqa: E501 + id: str = Field(description="The unique identitifer of the customer being referenced") + name: Optional[str] = Field(default=None, description="Name of the customer being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 CommerceCustomerRef 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 CommerceCustomerRef 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") + }) + return _obj + + + + + +class CommerceCustomerRefTypedDict(TypedDict): + """TypedDict variant of CommerceCustomerRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commercecustomers.py b/lending/src/codat_lending/models/shared/commercecustomers.py index 87e18e2a0..89801b98c 100644 --- a/lending/src/codat_lending/models/shared/commercecustomers.py +++ b/lending/src/codat_lending/models/shared/commercecustomers.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercecustomer import CommerceCustomer, CommerceCustomerTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercecustomer import CommerceCustomer, CommerceCustomerTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceCustomers(BaseModel): -class CommerceCustomersTypedDict(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[CommerceCustomerTypedDict]]] + @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} + """ + CommerceCustomers + """ # 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[CommerceCustomer]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceCustomers(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 CommerceCustomers from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceCustomer]]] = 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 CommerceCustomers 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": [CommerceCustomer.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceCustomers.model_rebuild() -except NameError: - pass + + + + +class CommerceCustomersTypedDict(TypedDict): + """TypedDict variant of CommerceCustomers, 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[CommerceCustomerTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commercedispute.py b/lending/src/codat_lending/models/shared/commercedispute.py index 195dbce28..38e7cafee 100644 --- a/lending/src/codat_lending/models/shared/commercedispute.py +++ b/lending/src/codat_lending/models/shared/commercedispute.py @@ -1,205 +1,140 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .disputestatus import DisputeStatus -from .transactionsourceref import TransactionSourceRef, TransactionSourceRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Any, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CommerceDisputeTypedDict(TypedDict): - r"""A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example: - - They didn't receive an order. - - The product they received was different to the commerce store's description. - - They've been the victim of online fraud. - - You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks. - """ - - 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"""A unique, persistent identifier for this record""" - created_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 +""" + Lending - 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. - """ - disputed_transactions: NotRequired[List[TransactionSourceRefTypedDict]] - r"""Link to the source event(s) which triggered this transaction.""" - due_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 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - modified_date: NotRequired[str] - reason: NotRequired[str] - r"""Reason for the dispute""" - source_modified_date: NotRequired[str] - status: NotRequired[DisputeStatus] - r"""Current status of the dispute""" - total_amount: NotRequired[Any] - r"""Total transaction amount that is under dispute.""" +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_lending.models.shared.disputestatus import DisputeStatus +from codat_lending.models.shared.transactionsourceref import TransactionSourceRef, TransactionSourceRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CommerceDispute(BaseModel): - r"""A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example: - - They didn't receive an order. - - The product they received was different to the commerce store's description. - - They've been the victim of online fraud. - - You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks. - """ - - 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"""A unique, persistent identifier for this record""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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. - """ - - disputed_transactions: Annotated[ - Optional[List[TransactionSourceRef]], - pydantic.Field(alias="disputedTransactions"), - ] = None - r"""Link to the source event(s) which triggered this transaction.""" - - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - reason: Optional[str] = None - r"""Reason for the dispute""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - + A customer may file a payment dispute with their bank or other card issuer when they're unsatisfied with their purchase or believe they have been charged incorrectly. For example: - They didn't receive an order. - The product they received was different to the commerce store's description. - They've been the victim of online fraud. You can use data from the Disputes endpoints to calculate key metrics, such as the number of chargebacks. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + created_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="createdDate") + 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") + disputed_transactions: Optional[List[TransactionSourceRef]] = Field(default=None, description="Link to the source event(s) which triggered this transaction.", alias="disputedTransactions") + total_amount: Optional[Any] = Field(default=None, alias="totalAmount") + 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.") status: Optional[DisputeStatus] = None - r"""Current status of the dispute""" - - total_amount: Annotated[Optional[Any], pydantic.Field(alias="totalAmount")] = None - r"""Total transaction amount that is under dispute.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "createdDate", - "disputedTransactions", - "dueDate", - "modifiedDate", - "reason", - "sourceModifiedDate", - "status", - "totalAmount", - ] + reason: Optional[str] = Field(default=None, description="Reason for the dispute") + due_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="dueDate") + __properties: ClassVar[List[str]] = ["id", "createdDate", "modifiedDate", "sourceModifiedDate", "disputedTransactions", "totalAmount", "currency", "status", "reason", "dueDate"] + + 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 CommerceDispute 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in disputed_transactions (list) + _items = [] + if self.disputed_transactions: + for _item_disputed_transactions in self.disputed_transactions: + if _item_disputed_transactions: + _items.append(_item_disputed_transactions.to_dict()) + _dict['disputedTransactions'] = _items + # set to None if total_amount (nullable) is None + # and model_fields_set contains the field + if self.total_amount is None and "total_amount" in self.model_fields_set: + _dict['totalAmount'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceDispute 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"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "disputedTransactions": [TransactionSourceRef.from_dict(_item) for _item in obj["disputedTransactions"]] if obj.get("disputedTransactions") is not None else None, + "totalAmount": obj.get("totalAmount"), + "currency": obj.get("currency"), + "status": obj.get("status"), + "reason": obj.get("reason"), + "dueDate": obj.get("dueDate") + }) + 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: - CommerceDispute.model_rebuild() -except NameError: - pass +class CommerceDisputeTypedDict(TypedDict): + """TypedDict variant of CommerceDispute, for dict-literal request/response inputs.""" + id: NotRequired[str] + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + disputed_transactions: NotRequired[Optional[List[TransactionSourceRefTypedDict]]] + total_amount: NotRequired[Optional[Any]] + currency: NotRequired[str] + status: NotRequired[Optional[DisputeStatus]] + reason: NotRequired[Optional[str]] + due_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commercedisputes.py b/lending/src/codat_lending/models/shared/commercedisputes.py index ad2ed71c8..4141c34ba 100644 --- a/lending/src/codat_lending/models/shared/commercedisputes.py +++ b/lending/src/codat_lending/models/shared/commercedisputes.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercedispute import CommerceDispute, CommerceDisputeTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercedispute import CommerceDispute, CommerceDisputeTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceDisputes(BaseModel): -class CommerceDisputesTypedDict(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[CommerceDisputeTypedDict]]] + @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} + """ + CommerceDisputes + """ # 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[CommerceDispute]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceDisputes(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 CommerceDisputes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceDispute]]] = 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 CommerceDisputes 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": [CommerceDispute.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceDisputes.model_rebuild() -except NameError: - pass + + + + +class CommerceDisputesTypedDict(TypedDict): + """TypedDict variant of CommerceDisputes, 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[CommerceDisputeTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commercelocation.py b/lending/src/codat_lending/models/shared/commercelocation.py index 44162d001..1b2db46d9 100644 --- a/lending/src/codat_lending/models/shared/commercelocation.py +++ b/lending/src/codat_lending/models/shared/commercelocation.py @@ -1,67 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .commerceaddress import CommerceAddress, CommerceAddressTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CommerceLocationTypedDict(TypedDict): - r"""The Location datatype holds information on the geographic location at which stocks of products may be held, as referenced in the Products data type. - - A Location also holds information on geographic locations where orders were placed, as referenced in the Orders data type. - """ - - id: str - r"""A unique, persistent identifier for this record""" - address: NotRequired[CommerceAddressTypedDict] - modified_date: NotRequired[str] - name: NotRequired[str] - r"""Name of this location""" - source_modified_date: NotRequired[str] +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceLocation(BaseModel): - r"""The Location datatype holds information on the geographic location at which stocks of products may be held, as referenced in the Products data type. - - A Location also holds information on geographic locations where orders were placed, as referenced in the Orders data type. - """ + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""A unique, persistent identifier for this record""" + Do not edit the class manually. +""" # noqa: E501 - address: Optional[CommerceAddress] = None - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - name: Optional[str] = None - r"""Name of this location""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.commerceaddress import CommerceAddress, CommerceAddressTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None +class CommerceLocation(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["address", "modifiedDate", "name", "sourceModifiedDate"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The Location datatype holds information on the geographic location at which stocks of products may be held, as referenced in the Products data type. A Location also holds information on geographic locations where orders were placed, as referenced in the Orders data type. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + 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") + name: Optional[str] = Field(default=None, description="Name of this location") + address: Optional[CommerceAddress] = Field(default=None, description="Address associated with the location") + __properties: ClassVar[List[str]] = ["id", "modifiedDate", "sourceModifiedDate", "name", "address"] + + 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 CommerceLocation 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 address + if self.address: + _dict['address'] = self.address.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceLocation 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"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "name": obj.get("name"), + "address": CommerceAddress.from_dict(obj["address"]) if obj.get("address") 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: - CommerceLocation.model_rebuild() -except NameError: - pass +class CommerceLocationTypedDict(TypedDict): + """TypedDict variant of CommerceLocation, for dict-literal request/response inputs.""" + id: NotRequired[str] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + address: NotRequired[Optional[CommerceAddressTypedDict]] diff --git a/lending/src/codat_lending/models/shared/commercelocations.py b/lending/src/codat_lending/models/shared/commercelocations.py index 2b1490864..d2c844736 100644 --- a/lending/src/codat_lending/models/shared/commercelocations.py +++ b/lending/src/codat_lending/models/shared/commercelocations.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercelocation import CommerceLocation, CommerceLocationTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercelocation import CommerceLocation, CommerceLocationTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceLocations(BaseModel): -class CommerceLocationsTypedDict(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[CommerceLocationTypedDict]]] + @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} + """ + CommerceLocations + """ # 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[CommerceLocation]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceLocations(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 CommerceLocations from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceLocation]]] = 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 CommerceLocations 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": [CommerceLocation.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceLocations.model_rebuild() -except NameError: - pass + + + + +class CommerceLocationsTypedDict(TypedDict): + """TypedDict variant of CommerceLocations, 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[CommerceLocationTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commerceorder.py b/lending/src/codat_lending/models/shared/commerceorder.py index 6617957de..4da49cd13 100644 --- a/lending/src/codat_lending/models/shared/commerceorder.py +++ b/lending/src/codat_lending/models/shared/commerceorder.py @@ -1,292 +1,192 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .commercecustomerref import CommerceCustomerRef, CommerceCustomerRefTypedDict -from .locationref import LocationRef, LocationRefTypedDict -from .orderlineitem import OrderLineItem, OrderLineItemTypedDict -from .paymentref import PaymentRef, PaymentRefTypedDict -from .servicecharge import ServiceCharge, ServiceChargeTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import BaseModel, Nullable, UNSET_SENTINEL -from codat_lending.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 CommerceOrderTypedDict(TypedDict): - r"""Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR).""" - - id: str - r"""A unique, persistent identifier for this record""" - closed_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. - """ - country: NotRequired[str] - r"""The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part. - - Depending on the platform the value of this property will either be an ISO 3166 code (2-alpha or 3-alpha) or free-form text returned as a string name in our model. - - For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/lending-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint. - """ - created_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - currency: NotRequired[str] - customer_ref: NotRequired[CommerceCustomerRefTypedDict] - r"""Reference to the customer that placed the order.""" - location_ref: NotRequired[LocationRefTypedDict] - r"""Reference to the geographic location where the order was placed.""" - modified_date: NotRequired[str] - order_line_items: NotRequired[List[OrderLineItemTypedDict]] - order_number: NotRequired[str] - r"""Friendly reference for the order in the commerce or point of sale platform.""" - payments: NotRequired[List[Nullable[PaymentRefTypedDict]]] - service_charges: NotRequired[List[ServiceChargeTypedDict]] - source_modified_date: NotRequired[str] - 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. - """ - total_amount: NotRequired[Decimal] - r"""Total amount of the order, including discounts, refunds, and tax, but excluding gratuities.""" - total_discount: NotRequired[Decimal] - r"""Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order).""" - total_gratuity: NotRequired[Decimal] - r"""Extra amount added to the order.""" - total_refund: NotRequired[Decimal] - r"""Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative.""" - total_tax_amount: NotRequired[Decimal] - r"""Total amount of tax applied to the order.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.commercecustomerref import CommerceCustomerRef, CommerceCustomerRefTypedDict +from codat_lending.models.shared.locationref import LocationRef, LocationRefTypedDict +from codat_lending.models.shared.orderlineitem import OrderLineItem, OrderLineItemTypedDict +from codat_lending.models.shared.paymentref import PaymentRef, PaymentRefTypedDict +from codat_lending.models.shared.servicecharge import ServiceCharge, ServiceChargeTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import Nullable class CommerceOrder(BaseModel): - r"""Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR).""" - - id: str - r"""A unique, persistent identifier for this record""" - - closed_date: Annotated[Optional[str], pydantic.Field(alias="closedDate")] = 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. - """ - country: Optional[str] = None - r"""The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part. - - Depending on the platform the value of this property will either be an ISO 3166 code (2-alpha or 3-alpha) or free-form text returned as a string name in our model. - - For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/lending-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint. - """ - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ - - currency: Optional[str] = None - - customer_ref: Annotated[ - Optional[CommerceCustomerRef], pydantic.Field(alias="customerRef") - ] = None - r"""Reference to the customer that placed the order.""" - - location_ref: Annotated[ - Optional[LocationRef], pydantic.Field(alias="locationRef") - ] = None - r"""Reference to the geographic location where the order was placed.""" - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - order_line_items: Annotated[ - Optional[List[OrderLineItem]], pydantic.Field(alias="orderLineItems") - ] = None - - order_number: Annotated[Optional[str], pydantic.Field(alias="orderNumber")] = None - r"""Friendly reference for the order in the commerce or point of sale platform.""" - + Orders contain the transaction details for all products sold by the company, and include details of any payments, service charges, or refunds related to each order. You can use data from the Orders endpoints to calculate key metrics, such as gross sales values and monthly recurring revenue (MRR). + """ # noqa: E501 + created_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="createdDate") + id: str = Field(description="A unique, persistent identifier for this record") + order_number: Optional[str] = Field(default=None, description="Friendly reference for the order in the commerce or point of sale platform.", alias="orderNumber") + country: Optional[str] = Field(default=None, description="The Codat country property is returned as it was provided in the underlying platform by the company without any formatting on our part. Depending on the platform the value of this property will either be an ISO 3166 code (2-alpha or 3-alpha) or free-form text returned as a string name in our model. For POST operations against platforms that demand a specific format for the country code, we have documented accepted values in the [options](https://docs.codat.io/lending-api#/operations/get-companies-companyId-connections-connectionId-push) endpoint.") + currency: Optional[str] = Field(default=None, description="Currency in which the order was placed.") + closed_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="closedDate") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of the order, including discounts, refunds, and tax, but excluding gratuities.", alias="totalAmount") + total_refund: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative.", alias="totalRefund") + total_tax_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of tax applied to the order.", alias="totalTaxAmount") + total_discount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order).", alias="totalDiscount") + total_gratuity: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Extra amount added to the order.", alias="totalGratuity") + order_line_items: Optional[List[OrderLineItem]] = Field(default=None, alias="orderLineItems") payments: Optional[List[Nullable[PaymentRef]]] = None - - service_charges: Annotated[ - Optional[List[ServiceCharge]], pydantic.Field(alias="serviceCharges") - ] = None - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - supplemental_data: Annotated[ - Optional[SupplementalData], 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. - """ - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount of the order, including discounts, refunds, and tax, but excluding gratuities.""" - - total_discount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalDiscount"), - ] = None - r"""Total amount of any discounts applied to the order, excluding tax. This is typically positive (for discounts which decrease the amount of the order), but can also be negative (for discounts which increase the amount of the order).""" - - total_gratuity: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalGratuity"), - ] = None - r"""Extra amount added to the order.""" - - total_refund: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalRefund"), - ] = None - r"""Total amount of any refunds issued on the order, including discounts and tax, but excluding gratuities. This is always negative.""" - - total_tax_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalTaxAmount"), - ] = None - r"""Total amount of tax applied to the order.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "closedDate", - "country", - "createdDate", - "currency", - "customerRef", - "locationRef", - "modifiedDate", - "orderLineItems", - "orderNumber", - "payments", - "serviceCharges", - "sourceModifiedDate", - "supplementalData", - "totalAmount", - "totalDiscount", - "totalGratuity", - "totalRefund", - "totalTaxAmount", - ] + service_charges: Optional[List[ServiceCharge]] = Field(default=None, alias="serviceCharges") + location_ref: Optional[LocationRef] = Field(default=None, alias="locationRef") + customer_ref: Optional[CommerceCustomerRef] = Field(default=None, alias="customerRef") + 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]] = ["createdDate", "id", "orderNumber", "country", "currency", "closedDate", "totalAmount", "totalRefund", "totalTaxAmount", "totalDiscount", "totalGratuity", "orderLineItems", "payments", "serviceCharges", "locationRef", "customerRef", "supplementalData", "modifiedDate", "sourceModifiedDate"] + + 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 CommerceOrder 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in order_line_items (list) + _items = [] + if self.order_line_items: + for _item_order_line_items in self.order_line_items: + if _item_order_line_items: + _items.append(_item_order_line_items.to_dict()) + _dict['orderLineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payments (list) + _items = [] + if self.payments: + for _item_payments in self.payments: + if _item_payments: + _items.append(_item_payments.to_dict()) + _dict['payments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in service_charges (list) + _items = [] + if self.service_charges: + for _item_service_charges in self.service_charges: + if _item_service_charges: + _items.append(_item_service_charges.to_dict()) + _dict['serviceCharges'] = _items + # override the default output from pydantic by calling `to_dict()` of location_ref + if self.location_ref: + _dict['locationRef'] = self.location_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.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 CommerceOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "createdDate": obj.get("createdDate"), + "id": obj.get("id"), + "orderNumber": obj.get("orderNumber"), + "country": obj.get("country"), + "currency": obj.get("currency"), + "closedDate": obj.get("closedDate"), + "totalAmount": obj.get("totalAmount"), + "totalRefund": obj.get("totalRefund"), + "totalTaxAmount": obj.get("totalTaxAmount"), + "totalDiscount": obj.get("totalDiscount"), + "totalGratuity": obj.get("totalGratuity"), + "orderLineItems": [OrderLineItem.from_dict(_item) for _item in obj["orderLineItems"]] if obj.get("orderLineItems") is not None else None, + "payments": [PaymentRef.from_dict(_item) for _item in obj["payments"]] if obj.get("payments") is not None else None, + "serviceCharges": [ServiceCharge.from_dict(_item) for _item in obj["serviceCharges"]] if obj.get("serviceCharges") is not None else None, + "locationRef": LocationRef.from_dict(obj["locationRef"]) if obj.get("locationRef") is not None else None, + "customerRef": CommerceCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") 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 - 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: - CommerceOrder.model_rebuild() -except NameError: - pass +class CommerceOrderTypedDict(TypedDict): + """TypedDict variant of CommerceOrder, for dict-literal request/response inputs.""" + created_date: NotRequired[Optional[str]] + id: NotRequired[str] + order_number: NotRequired[Optional[str]] + country: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] + closed_date: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] + total_refund: NotRequired[Optional[Decimal]] + total_tax_amount: NotRequired[Optional[Decimal]] + total_discount: NotRequired[Optional[Decimal]] + total_gratuity: NotRequired[Optional[Decimal]] + order_line_items: NotRequired[Optional[List[OrderLineItemTypedDict]]] + payments: NotRequired[Optional[List[Nullable[PaymentRefTypedDict]]]] + service_charges: NotRequired[Optional[List[ServiceChargeTypedDict]]] + location_ref: NotRequired[Optional[LocationRefTypedDict]] + customer_ref: NotRequired[Optional[CommerceCustomerRefTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commerceorders.py b/lending/src/codat_lending/models/shared/commerceorders.py index b401bdaaf..4b6749fe3 100644 --- a/lending/src/codat_lending/models/shared/commerceorders.py +++ b/lending/src/codat_lending/models/shared/commerceorders.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commerceorder import CommerceOrder, CommerceOrderTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commerceorder import CommerceOrder, CommerceOrderTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceOrders(BaseModel): -class CommerceOrdersTypedDict(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[CommerceOrderTypedDict]]] + @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} + """ + CommerceOrders + """ # 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[CommerceOrder]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceOrders(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 CommerceOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceOrder]]] = 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 CommerceOrders 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": [CommerceOrder.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceOrders.model_rebuild() -except NameError: - pass + + + + +class CommerceOrdersTypedDict(TypedDict): + """TypedDict variant of CommerceOrders, 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[CommerceOrderTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commercepayment.py b/lending/src/codat_lending/models/shared/commercepayment.py index afe16366a..4741df7c6 100644 --- a/lending/src/codat_lending/models/shared/commercepayment.py +++ b/lending/src/codat_lending/models/shared/commercepayment.py @@ -1,228 +1,140 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict -from .paymentstatus import PaymentStatus -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 CommercePaymentTypedDict(TypedDict): - r"""Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. - - Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`. - - You can use data from the Payments endpoints to calculate key metrics, such as gross sales and monthly recurring revenue (MRR). - """ - - id: str - r"""A unique, persistent identifier for this record""" - amount: NotRequired[Decimal] - r"""Payment Amount (including gratuity)""" - created_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. - """ - 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_. +""" + Lending - ## 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. - """ - due_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 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - modified_date: NotRequired[str] - payment_method_ref: NotRequired[PaymentMethodRefTypedDict] - r"""The payment method the record is linked to in the accounting or commerce software.""" - payment_provider: NotRequired[str] - r"""Service provider of the payment, if applicable.""" - source_modified_date: NotRequired[str] - status: NotRequired[PaymentStatus] - r"""Status of the payment.""" - 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. - """ +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.paymentmethodref import PaymentMethodRef, PaymentMethodRefTypedDict +from codat_lending.models.shared.paymentstatus import PaymentStatus +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CommercePayment(BaseModel): - r"""Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. - - Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`. - - You can use data from the Payments endpoints to calculate key metrics, such as gross sales and monthly recurring revenue (MRR). - """ - - id: str - r"""A unique, persistent identifier for this record""" - - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Payment Amount (including gratuity)""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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. - """ - - 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. - """ - - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - payment_method_ref: Annotated[ - Optional[PaymentMethodRef], pydantic.Field(alias="paymentMethodRef") - ] = None - r"""The payment method the record is linked to in the accounting or commerce software.""" - - payment_provider: Annotated[ - Optional[str], pydantic.Field(alias="paymentProvider") - ] = None - r"""Service provider of the payment, if applicable.""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - + Payments contain details of all payments made by customers to a company, including: amounts, currency used, payment method, payment provider, and payment status. Refunds are recorded as separate, negative payments. Note that a refund can only occur in relation to a payment that has been completed (i.e. has a status of `Paid`). When a customer cancels an order _before_ a payment has been completed, the payment shows as `Cancelled`. You can use data from the Payments endpoints to calculate key metrics, such as gross sales and monthly recurring revenue (MRR). + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + created_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="createdDate") + 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") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Payment Amount (including gratuity)") + 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.") + payment_method_ref: Optional[PaymentMethodRef] = Field(default=None, alias="paymentMethodRef") status: Optional[PaymentStatus] = None - r"""Status of the payment.""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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( - [ - "amount", - "createdDate", - "currency", - "dueDate", - "modifiedDate", - "paymentMethodRef", - "paymentProvider", - "sourceModifiedDate", - "status", - "supplementalData", - ] + payment_provider: Optional[str] = Field(default=None, description="Service provider of the payment, if applicable.", alias="paymentProvider") + due_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="dueDate") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["id", "createdDate", "modifiedDate", "sourceModifiedDate", "amount", "currency", "paymentMethodRef", "status", "paymentProvider", "dueDate", "supplementalData"] + + 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 CommercePayment 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of payment_method_ref + if self.payment_method_ref: + _dict['paymentMethodRef'] = self.payment_method_ref.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 CommercePayment 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"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "paymentMethodRef": PaymentMethodRef.from_dict(obj["paymentMethodRef"]) if obj.get("paymentMethodRef") is not None else None, + "status": obj.get("status"), + "paymentProvider": obj.get("paymentProvider"), + "dueDate": obj.get("dueDate"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") 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: - CommercePayment.model_rebuild() -except NameError: - pass +class CommercePaymentTypedDict(TypedDict): + """TypedDict variant of CommercePayment, for dict-literal request/response inputs.""" + id: NotRequired[str] + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + payment_method_ref: NotRequired[Optional[PaymentMethodRefTypedDict]] + status: NotRequired[Optional[PaymentStatus]] + payment_provider: NotRequired[Optional[str]] + due_date: NotRequired[Optional[str]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/commercepaymentmethod.py b/lending/src/codat_lending/models/shared/commercepaymentmethod.py index ea2883be6..9321d9dbd 100644 --- a/lending/src/codat_lending/models/shared/commercepaymentmethod.py +++ b/lending/src/codat_lending/models/shared/commercepaymentmethod.py @@ -1,71 +1,122 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +# coding: utf-8 +""" + Lending -class CommercePaymentMethodStatus(str, Enum): - r"""Status of the Payment Method.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" + 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 CommercePaymentMethodTypedDict(TypedDict): - r"""A Payment Method represents the payment method(s) used to make payments.""" - id: str - r"""A unique, persistent identifier for this record""" - modified_date: NotRequired[str] - name: NotRequired[str] - r"""The name of the PaymentMethod""" - source_modified_date: NotRequired[str] - status: NotRequired[CommercePaymentMethodStatus] - r"""Status of the Payment Method.""" +from __future__ import annotations +from codat_lending.models.commerce_payment_method_status import CommercePaymentMethodStatus +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 CommercePaymentMethod(BaseModel): - r"""A Payment Method represents the payment method(s) used to make payments.""" - - id: str - r"""A unique, persistent identifier for this record""" - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - name: Optional[str] = None - r"""The name of the PaymentMethod""" - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - status: Optional[CommercePaymentMethodStatus] = None - r"""Status of the Payment Method.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["modifiedDate", "name", "sourceModifiedDate", "status"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + A Payment Method represents the payment method(s) used to make payments. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + 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") + name: Optional[str] = Field(default=None, description="The name of the PaymentMethod") + status: Optional[CommercePaymentMethodStatus] = Field(default=None, description="Status of the Payment Method.") + __properties: ClassVar[List[str]] = ["id", "modifiedDate", "sourceModifiedDate", "name", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Unknown', 'Active', 'Archived']): + raise ValueError("must be one of enum values ('Unknown', 'Active', 'Archived')") + 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 CommercePaymentMethod 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 CommercePaymentMethod 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"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "name": obj.get("name"), + "status": obj.get("status") + }) + 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: - CommercePaymentMethod.model_rebuild() -except NameError: - pass +class CommercePaymentMethodTypedDict(TypedDict): + """TypedDict variant of CommercePaymentMethod, for dict-literal request/response inputs.""" + id: NotRequired[str] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + status: NotRequired[Optional[CommercePaymentMethodStatus]] diff --git a/lending/src/codat_lending/models/shared/commercepaymentmethods.py b/lending/src/codat_lending/models/shared/commercepaymentmethods.py index 69c4eb15f..e663e6956 100644 --- a/lending/src/codat_lending/models/shared/commercepaymentmethods.py +++ b/lending/src/codat_lending/models/shared/commercepaymentmethods.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercepaymentmethod import CommercePaymentMethod, CommercePaymentMethodTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercepaymentmethod import CommercePaymentMethod, CommercePaymentMethodTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommercePaymentMethods(BaseModel): -class CommercePaymentMethodsTypedDict(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[CommercePaymentMethodTypedDict]]] + @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} + """ + CommercePaymentMethods + """ # 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[CommercePaymentMethod]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommercePaymentMethods(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 CommercePaymentMethods from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommercePaymentMethod]]] = 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 CommercePaymentMethods 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": [CommercePaymentMethod.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommercePaymentMethods.model_rebuild() -except NameError: - pass + + + + +class CommercePaymentMethodsTypedDict(TypedDict): + """TypedDict variant of CommercePaymentMethods, 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[CommercePaymentMethodTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commercepayments.py b/lending/src/codat_lending/models/shared/commercepayments.py index 5d845c2a1..977f9a4b7 100644 --- a/lending/src/codat_lending/models/shared/commercepayments.py +++ b/lending/src/codat_lending/models/shared/commercepayments.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercepayment import CommercePayment, CommercePaymentTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercepayment import CommercePayment, CommercePaymentTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommercePayments(BaseModel): -class CommercePaymentsTypedDict(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[CommercePaymentTypedDict]]] + @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} + """ + CommercePayments + """ # 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[CommercePayment]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommercePayments(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 CommercePayments from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommercePayment]]] = 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 CommercePayments 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": [CommercePayment.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommercePayments.model_rebuild() -except NameError: - pass + + + + +class CommercePaymentsTypedDict(TypedDict): + """TypedDict variant of CommercePayments, 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[CommercePaymentTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commerceproduct.py b/lending/src/codat_lending/models/shared/commerceproduct.py index 92a60b9be..77320025a 100644 --- a/lending/src/codat_lending/models/shared/commerceproduct.py +++ b/lending/src/codat_lending/models/shared/commerceproduct.py @@ -1,97 +1,130 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .productvariant import ProductVariant, ProductVariantTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import BaseModel, Nullable, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +# coding: utf-8 +""" + Lending -class CommerceProductTypedDict(TypedDict): - r"""A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale.""" - - id: str - r"""A unique, persistent identifier for this record""" - categorization: NotRequired[str] - r"""Retail category that the product is assigned to e.g. `Hardware`.""" - description: NotRequired[str] - r"""Description of the product recorded in the commerce or point of sale platform.""" - is_gift_card: NotRequired[bool] - r"""Whether the product represents a gift card or voucher that - can be redeemed in the commerce or POS platform. + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - """ - name: NotRequired[str] - r"""Name of the product in the commerce or POS system""" - supplemental_data: NotRequired[SupplementalDataTypedDict] - r"""Supplemental data is additional data you can include in our standard data types. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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. - """ - variants: NotRequired[List[Nullable[ProductVariantTypedDict]]] + 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_lending.models.shared.productvariant import ProductVariant, ProductVariantTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import Nullable class CommerceProduct(BaseModel): - r"""A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale.""" - id: str - r"""A unique, persistent identifier for this record""" - - categorization: Optional[str] = None - r"""Retail category that the product is assigned to e.g. `Hardware`.""" - - description: Optional[str] = None - r"""Description of the product recorded in the commerce or point of sale platform.""" - - is_gift_card: Annotated[Optional[bool], pydantic.Field(alias="isGiftCard")] = None - r"""Whether the product represents a gift card or voucher that - can be redeemed in the commerce or POS platform. - - """ - - name: Optional[str] = None - r"""Name of the product in the commerce or POS system""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} """ - + A Product is an item in the company's inventory, and includes information about the price and quantity of all products, and variants thereof, available for sale. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + name: Optional[str] = Field(default=None, description="Name of the product in the commerce or POS system") + description: Optional[str] = Field(default=None, description="Description of the product recorded in the commerce or point of sale platform.") + categorization: Optional[str] = Field(default=None, description="Retail category that the product is assigned to e.g. `Hardware`.") + is_gift_card: Optional[bool] = Field(default=None, description="Whether the product represents a gift card or voucher that can be redeemed in the commerce or POS platform. ", alias="isGiftCard") variants: Optional[List[Nullable[ProductVariant]]] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "categorization", - "description", - "isGiftCard", - "name", - "supplementalData", - "variants", - ] + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["id", "name", "description", "categorization", "isGiftCard", "variants", "supplementalData"] + + 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 CommerceProduct 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in variants (list) + _items = [] + if self.variants: + for _item_variants in self.variants: + if _item_variants: + _items.append(_item_variants.to_dict()) + _dict['variants'] = _items + # 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 CommerceProduct 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"), + "categorization": obj.get("categorization"), + "isGiftCard": obj.get("isGiftCard"), + "variants": [ProductVariant.from_dict(_item) for _item in obj["variants"]] if obj.get("variants") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") 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: - CommerceProduct.model_rebuild() -except NameError: - pass +class CommerceProductTypedDict(TypedDict): + """TypedDict variant of CommerceProduct, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + categorization: NotRequired[Optional[str]] + is_gift_card: NotRequired[Optional[bool]] + variants: NotRequired[Optional[List[Nullable[ProductVariantTypedDict]]]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/commerceproductcategories.py b/lending/src/codat_lending/models/shared/commerceproductcategories.py index cb172a87e..b374e23b9 100644 --- a/lending/src/codat_lending/models/shared/commerceproductcategories.py +++ b/lending/src/codat_lending/models/shared/commerceproductcategories.py @@ -1,61 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commerceproductcategory import ( - CommerceProductCategory, - CommerceProductCategoryTypedDict, -) -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commerceproductcategory import CommerceProductCategory, CommerceProductCategoryTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceProductCategories(BaseModel): -class CommerceProductCategoriesTypedDict(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[CommerceProductCategoryTypedDict]]] + @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} + """ + CommerceProductCategories + """ # 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[CommerceProductCategory]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceProductCategories(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 CommerceProductCategories from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceProductCategory]]] = 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 CommerceProductCategories 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": [CommerceProductCategory.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceProductCategories.model_rebuild() -except NameError: - pass + + + + +class CommerceProductCategoriesTypedDict(TypedDict): + """TypedDict variant of CommerceProductCategories, 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[CommerceProductCategoryTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/commerceproductcategory.py b/lending/src/codat_lending/models/shared/commerceproductcategory.py index b7f96dd4e..411028f50 100644 --- a/lending/src/codat_lending/models/shared/commerceproductcategory.py +++ b/lending/src/codat_lending/models/shared/commerceproductcategory.py @@ -1,79 +1,122 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .commercerecordref import CommerceRecordRef, CommerceRecordRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +# coding: utf-8 +""" + Lending -class CommerceProductCategoryTypedDict(TypedDict): - r"""Product categories are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ancestor_refs: NotRequired[List[CommerceRecordRefTypedDict]] - r"""A collection of parent product categories implicitly ordered with the immediate parent last in the list.""" - has_children: NotRequired[bool] - r"""A boolean indicating whether there are other product categories beneath this one in the hierarchy.""" - id: NotRequired[str] - r"""The unique identifier of the product category""" - modified_date: NotRequired[str] - name: NotRequired[str] - r"""The name of the product category""" - source_modified_date: NotRequired[str] + 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 CommerceProductCategory(BaseModel): - r"""Product categories are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile.""" - ancestor_refs: Annotated[ - Optional[List[CommerceRecordRef]], pydantic.Field(alias="ancestorRefs") - ] = None - r"""A collection of parent product categories implicitly ordered with the immediate parent last in the list.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - has_children: Annotated[Optional[bool], pydantic.Field(alias="hasChildren")] = None - r"""A boolean indicating whether there are other product categories beneath this one in the hierarchy.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.commercerecordref import CommerceRecordRef, CommerceRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - id: Optional[str] = None - r"""The unique identifier of the product category""" +class CommerceProductCategory(BaseModel): - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = 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} + """ + Product categories are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile. + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="The unique identifier of the product category") + name: Optional[str] = Field(default=None, description="The name of the product category") + ancestor_refs: Optional[List[CommerceRecordRef]] = Field(default=None, description="A collection of parent product categories implicitly ordered with the immediate parent last in the list.", alias="ancestorRefs") + has_children: Optional[bool] = Field(default=None, description="A boolean indicating whether there are other product categories beneath this one in the hierarchy.", alias="hasChildren") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "name", "ancestorRefs", "hasChildren"] + + 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 CommerceProductCategory 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 ancestor_refs (list) + _items = [] + if self.ancestor_refs: + for _item_ancestor_refs in self.ancestor_refs: + if _item_ancestor_refs: + _items.append(_item_ancestor_refs.to_dict()) + _dict['ancestorRefs'] = _items + return _dict - name: Optional[str] = None - r"""The name of the product category""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceProductCategory from a dict""" + if obj is None: + return None - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "ancestorRefs", - "hasChildren", - "id", - "modifiedDate", - "name", - "sourceModifiedDate", - ] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "name": obj.get("name"), + "ancestorRefs": [CommerceRecordRef.from_dict(_item) for _item in obj["ancestorRefs"]] if obj.get("ancestorRefs") is not None else None, + "hasChildren": obj.get("hasChildren") + }) + 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: - CommerceProductCategory.model_rebuild() -except NameError: - pass +class CommerceProductCategoryTypedDict(TypedDict): + """TypedDict variant of CommerceProductCategory, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + ancestor_refs: NotRequired[Optional[List[CommerceRecordRefTypedDict]]] + has_children: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/shared/commerceproducts.py b/lending/src/codat_lending/models/shared/commerceproducts.py index 748abd2ea..f50e35294 100644 --- a/lending/src/codat_lending/models/shared/commerceproducts.py +++ b/lending/src/codat_lending/models/shared/commerceproducts.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commerceproduct import CommerceProduct, CommerceProductTypedDict -from .links import Links, LinksTypedDict -from codat_lending.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_lending.models.shared.commerceproduct import CommerceProduct, CommerceProductTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +class CommerceProducts(BaseModel): -class CommerceProductsTypedDict(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[CommerceProductTypedDict]] + @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} + """ + CommerceProducts + """ # 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[CommerceProduct]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceProducts(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 CommerceProducts from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[CommerceProduct]] = 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 CommerceProducts 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": [CommerceProduct.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceProducts.model_rebuild() -except NameError: - pass + + + + +class CommerceProductsTypedDict(TypedDict): + """TypedDict variant of CommerceProducts, 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[CommerceProductTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/commercerecordref.py b/lending/src/codat_lending/models/shared/commercerecordref.py index 80a3bee03..696c4e894 100644 --- a/lending/src/codat_lending/models/shared/commercerecordref.py +++ b/lending/src/codat_lending/models/shared/commercerecordref.py @@ -1,20 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel -from typing_extensions import TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceRecordRefTypedDict(TypedDict): - id: str - r"""The unique identitifer of the record being referenced""" - type: str - r"""The type of record being referenced.""" + 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 CommerceRecordRef(BaseModel): - id: str - r"""The unique identitifer of the record being referenced""" - type: str - r"""The type of record being referenced.""" + @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} + """ + + """ # noqa: E501 + id: str = Field(description="The unique identitifer of the record being referenced") + type: str = Field(description="The type of record being referenced.") + __properties: ClassVar[List[str]] = ["id", "type"] + + 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 CommerceRecordRef 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 CommerceRecordRef 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"), + "type": obj.get("type") + }) + return _obj + + + + + +class CommerceRecordRefTypedDict(TypedDict): + """TypedDict variant of CommerceRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + type: NotRequired[str] diff --git a/lending/src/codat_lending/models/shared/commercereport.py b/lending/src/codat_lending/models/shared/commercereport.py index 764679065..38177d3a6 100644 --- a/lending/src/codat_lending/models/shared/commercereport.py +++ b/lending/src/codat_lending/models/shared/commercereport.py @@ -1,152 +1,143 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .commercereportcomponent import ( - CommerceReportComponent, - CommerceReportComponentTypedDict, -) -from .commercereportdimension import ( - CommerceReportDimension, - CommerceReportDimensionTypedDict, -) -from .commercereporterror import CommerceReportError, CommerceReportErrorTypedDict -from .commercereportmeasure import CommerceReportMeasure, CommerceReportMeasureTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CommerceReportTypedDict(TypedDict): - r"""## Structure - - Assess reports follow a consistent structure. Reports contain four sections of information: - - ### 1. Report definition - - Information such as: - - 1. The report info (e.g. enhanced_profit_and_loss). - 2. The display name of the report (e.g. Enhanced Profit and Loss). - - ### 2. Dimension info - - Information about the dimension contained in the reports such as: - - 1. The type of dimension (e.g. datetime, recordRef). - 2. The display name of the dimension (e.g. Period, Category type, Category sub type). - 3. The details about each item within the dimension (e.g. displayName:\"Jan 2022\", start:\"...\", end:\"...\", id:\"...\", name:\"...\"). - - ### 3. Measure info - - Information about the measures contained in the report such as: +""" + Lending - 1. The display name of the measure (e.g. value of account, percentage change). - 2. The type of the measure (e.g. currency, percentage). - 3. The unit of the measure (e.g. %, GBP). + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ### 4. The data for the report + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*. + Do not edit the class manually. +""" # noqa: E501 - ## Displaying the report - - Reports can be rendered as follows (ordering is implicit rather than explicit): - - ![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png) - - # Data model - - ## Dimensions - """ - - dimensions: NotRequired[List[CommerceReportDimensionTypedDict]] - errors: NotRequired[List[CommerceReportErrorTypedDict]] - measures: NotRequired[List[CommerceReportMeasureTypedDict]] - report_data: NotRequired[List[CommerceReportComponentTypedDict]] - report_info: NotRequired[Dict[str, str]] - +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_lending.models.shared.commercereportcomponent import CommerceReportComponent, CommerceReportComponentTypedDict +from codat_lending.models.shared.commercereportdimension import CommerceReportDimension, CommerceReportDimensionTypedDict +from codat_lending.models.shared.commercereporterror import CommerceReportError, CommerceReportErrorTypedDict +from codat_lending.models.shared.commercereportmeasure import CommerceReportMeasure, CommerceReportMeasureTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CommerceReport(BaseModel): - r"""## Structure - - Assess reports follow a consistent structure. Reports contain four sections of information: - - ### 1. Report definition - - Information such as: - - 1. The report info (e.g. enhanced_profit_and_loss). - 2. The display name of the report (e.g. Enhanced Profit and Loss). - - ### 2. Dimension info - Information about the dimension contained in the reports such as: - - 1. The type of dimension (e.g. datetime, recordRef). - 2. The display name of the dimension (e.g. Period, Category type, Category sub type). - 3. The details about each item within the dimension (e.g. displayName:\"Jan 2022\", start:\"...\", end:\"...\", id:\"...\", name:\"...\"). - - ### 3. Measure info - - Information about the measures contained in the report such as: - - 1. The display name of the measure (e.g. value of account, percentage change). - 2. The type of the measure (e.g. currency, percentage). - 3. The unit of the measure (e.g. %, GBP). - - ### 4. The data for the report - - When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*. - - - ## Displaying the report - - Reports can be rendered as follows (ordering is implicit rather than explicit): - - ![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png) - - # Data model - - ## Dimensions + @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} """ - + ## Structure Assess reports follow a consistent structure. Reports contain four sections of information: ### 1. Report definition Information such as: 1. The report info (e.g. enhanced_profit_and_loss). 2. The display name of the report (e.g. Enhanced Profit and Loss). ### 2. Dimension info Information about the dimension contained in the reports such as: 1. The type of dimension (e.g. datetime, recordRef). 2. The display name of the dimension (e.g. Period, Category type, Category sub type). 3. The details about each item within the dimension (e.g. displayName:\"Jan 2022\", start:\"...\", end:\"...\", id:\"...\", name:\"...\"). ### 3. Measure info Information about the measures contained in the report such as: 1. The display name of the measure (e.g. value of account, percentage change). 2. The type of the measure (e.g. currency, percentage). 3. The unit of the measure (e.g. %, GBP). ### 4. The data for the report When the *includeDisplayName* parameter is set to *true*, it shows the *dimensionDisplayName* and *itemDisplayName* to make the data human-readable. The default setting for *includeDisplayName* is *false*. ## Displaying the report Reports can be rendered as follows (ordering is implicit rather than explicit): ![A table showing an example of how a report can be rendered](https://files.readme.io/1fa20ca-Report1.png) # Data model ## Dimensions + """ # noqa: E501 + report_info: Optional[Dict[str, str]] = Field(default=None, alias="reportInfo") dimensions: Optional[List[CommerceReportDimension]] = None - - errors: Optional[List[CommerceReportError]] = None - measures: Optional[List[CommerceReportMeasure]] = None - - report_data: Annotated[ - Optional[List[CommerceReportComponent]], pydantic.Field(alias="reportData") - ] = None - - report_info: Annotated[ - Optional[Dict[str, str]], pydantic.Field(alias="reportInfo") - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["dimensions", "errors", "measures", "reportData", "reportInfo"] + report_data: Optional[List[CommerceReportComponent]] = Field(default=None, alias="reportData") + errors: Optional[List[CommerceReportError]] = None + __properties: ClassVar[List[str]] = ["reportInfo", "dimensions", "measures", "reportData", "errors"] + + 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 CommerceReport 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in dimensions (list) + _items = [] + if self.dimensions: + for _item_dimensions in self.dimensions: + if _item_dimensions: + _items.append(_item_dimensions.to_dict()) + _dict['dimensions'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in measures (list) + _items = [] + if self.measures: + for _item_measures in self.measures: + if _item_measures: + _items.append(_item_measures.to_dict()) + _dict['measures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in report_data (list) + _items = [] + if self.report_data: + for _item_report_data in self.report_data: + if _item_report_data: + _items.append(_item_report_data.to_dict()) + _dict['reportData'] = _items + # 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 + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceReport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reportInfo": obj.get("reportInfo"), + "dimensions": [CommerceReportDimension.from_dict(_item) for _item in obj["dimensions"]] if obj.get("dimensions") is not None else None, + "measures": [CommerceReportMeasure.from_dict(_item) for _item in obj["measures"]] if obj.get("measures") is not None else None, + "reportData": [CommerceReportComponent.from_dict(_item) for _item in obj["reportData"]] if obj.get("reportData") is not None else None, + "errors": [CommerceReportError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") 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: - CommerceReport.model_rebuild() -except NameError: - pass +class CommerceReportTypedDict(TypedDict): + """TypedDict variant of CommerceReport, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[Dict[str, str]]] + dimensions: NotRequired[Optional[List[CommerceReportDimensionTypedDict]]] + measures: NotRequired[Optional[List[CommerceReportMeasureTypedDict]]] + report_data: NotRequired[Optional[List[CommerceReportComponentTypedDict]]] + errors: NotRequired[Optional[List[CommerceReportErrorTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/commercereportcomponent.py b/lending/src/codat_lending/models/shared/commercereportcomponent.py index 0684fe4a7..8ff8a96d0 100644 --- a/lending/src/codat_lending/models/shared/commercereportcomponent.py +++ b/lending/src/codat_lending/models/shared/commercereportcomponent.py @@ -1,78 +1,131 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .reportcomponentmeasure import ( - ReportComponentMeasure, - ReportComponentMeasureTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CommerceReportComponentTypedDict(TypedDict): - components: NotRequired[List[CommerceReportComponentTypedDict]] - dimension: NotRequired[int] - r"""The component's dimension.""" - dimension_display_name: NotRequired[str] - r"""The component's display name.""" - item: NotRequired[int] - r"""The component's item number.""" - item_display_name: NotRequired[str] - r"""The component's item display name.""" - measures: NotRequired[List[ReportComponentMeasureTypedDict]] +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceReportComponent(BaseModel): - components: Optional[List[CommerceReportComponent]] = None + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - dimension: Optional[int] = None - r"""The component's dimension.""" + Do not edit the class manually. +""" # noqa: E501 - dimension_display_name: Annotated[ - Optional[str], pydantic.Field(alias="dimensionDisplayName") - ] = None - r"""The component's display name.""" - item: Optional[int] = None - r"""The component's item number.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - item_display_name: Annotated[ - Optional[str], pydantic.Field(alias="itemDisplayName") - ] = None - r"""The component's item display name.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.reportcomponentmeasure import ReportComponentMeasure, ReportComponentMeasureTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - measures: Optional[List[ReportComponentMeasure]] = None +class CommerceReportComponent(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "components", - "dimension", - "dimensionDisplayName", - "item", - "itemDisplayName", - "measures", - ] - ) + 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)) + return {k: v for k, v in serialized.items() if v is not None} + """ + CommerceReportComponent + """ # noqa: E501 + dimension: Optional[int] = Field(default=None, description="The component's dimension.") + dimension_display_name: Optional[str] = Field(default=None, description="The component's display name.", alias="dimensionDisplayName") + item: Optional[int] = Field(default=None, description="The component's item number.") + item_display_name: Optional[str] = Field(default=None, description="The component's item display name.", alias="itemDisplayName") + measures: Optional[List[ReportComponentMeasure]] = None + components: Optional[List[CommerceReportComponent]] = None + __properties: ClassVar[List[str]] = ["dimension", "dimensionDisplayName", "item", "itemDisplayName", "measures", "components"] + + 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 CommerceReportComponent 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 measures (list) + _items = [] + if self.measures: + for _item_measures in self.measures: + if _item_measures: + _items.append(_item_measures.to_dict()) + _dict['measures'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in components (list) + _items = [] + if self.components: + for _item_components in self.components: + if _item_components: + _items.append(_item_components.to_dict()) + _dict['components'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceReportComponent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dimension": obj.get("dimension"), + "dimensionDisplayName": obj.get("dimensionDisplayName"), + "item": obj.get("item"), + "itemDisplayName": obj.get("itemDisplayName"), + "measures": [ReportComponentMeasure.from_dict(_item) for _item in obj["measures"]] if obj.get("measures") is not None else None, + "components": [CommerceReportComponent.from_dict(_item) for _item in obj["components"]] if obj.get("components") is not None else None + }) + return _obj + +# TODO: Rewrite to not use raise_errors +CommerceReportComponent.model_rebuild(raise_errors=False) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - CommerceReportComponent.model_rebuild() -except NameError: - pass +class CommerceReportComponentTypedDict(TypedDict): + """TypedDict variant of CommerceReportComponent, for dict-literal request/response inputs.""" + dimension: NotRequired[Optional[int]] + dimension_display_name: NotRequired[Optional[str]] + item: NotRequired[Optional[int]] + item_display_name: NotRequired[Optional[str]] + measures: NotRequired[Optional[List[ReportComponentMeasureTypedDict]]] + components: NotRequired[Optional[List[CommerceReportComponentTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/commercereportdimension.py b/lending/src/codat_lending/models/shared/commercereportdimension.py index 1c078fa42..28e7dc5cf 100644 --- a/lending/src/codat_lending/models/shared/commercereportdimension.py +++ b/lending/src/codat_lending/models/shared/commercereportdimension.py @@ -1,79 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -class CommerceReportDimensionItemsTypedDict(TypedDict): - index: NotRequired[int] - r"""The dimension's items index.""" + Do not edit the class manually. +""" # noqa: E501 -class CommerceReportDimensionItems(BaseModel): - index: Optional[int] = None - r"""The dimension's items index.""" +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_lending.models.commerce_report_dimension_items import CommerceReportDimensionItems, CommerceReportDimensionItemsTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class CommerceReportDimension(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["index"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CommerceReportDimension + """ # noqa: E501 + index: Optional[int] = Field(default=None, description="The dimension's index.") + display_name: Optional[str] = Field(default=None, description="The dimension's display name.", alias="displayName") + type: Optional[str] = Field(default=None, description="The dimension's type.") + items: Optional[List[CommerceReportDimensionItems]] = None + __properties: ClassVar[List[str]] = ["index", "displayName", "type", "items"] - 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 CommerceReportDimensionTypedDict(TypedDict): - display_name: NotRequired[str] - r"""The dimension's display name.""" - index: NotRequired[int] - r"""The dimension's index.""" - items: NotRequired[List[CommerceReportDimensionItemsTypedDict]] - type: NotRequired[str] - r"""The dimension's type.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CommerceReportDimension 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 CommerceReportDimension(BaseModel): - display_name: Annotated[Optional[str], pydantic.Field(alias="displayName")] = None - r"""The dimension's display name.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - index: Optional[int] = None - r"""The dimension's index.""" + * `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([ + ]) - items: Optional[List[CommerceReportDimensionItems]] = 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 each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + return _dict - type: Optional[str] = None - r"""The dimension's type.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CommerceReportDimension from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["displayName", "index", "items", "type"]) - serialized = handler(self) - m = {} + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "displayName": obj.get("displayName"), + "type": obj.get("type"), + "items": [CommerceReportDimensionItems.from_dict(_item) for _item in obj["items"]] if obj.get("items") 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: - CommerceReportDimension.model_rebuild() -except NameError: - pass +class CommerceReportDimensionTypedDict(TypedDict): + """TypedDict variant of CommerceReportDimension, for dict-literal request/response inputs.""" + index: NotRequired[Optional[int]] + display_name: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + items: NotRequired[Optional[List[CommerceReportDimensionItemsTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/commercereporterror.py b/lending/src/codat_lending/models/shared/commercereporterror.py index 55de9a6b2..e847ab8a2 100644 --- a/lending/src/codat_lending/models/shared/commercereporterror.py +++ b/lending/src/codat_lending/models/shared/commercereporterror.py @@ -1,43 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceReportErrorTypedDict(TypedDict): - details: NotRequired[Dict[str, List[str]]] - r"""Additional details on the error.""" - message: NotRequired[str] - r"""Message returned by error.""" - type: NotRequired[str] - r"""The type of error.""" + 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 CommerceReportError(BaseModel): - details: Optional[Dict[str, List[str]]] = None - r"""Additional details on the error.""" - message: Optional[str] = None - r"""Message returned by error.""" +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 - type: Optional[str] = None - r"""The type of error.""" +class CommerceReportError(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["details", "message", "type"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CommerceReportError + """ # noqa: E501 + message: Optional[str] = Field(default=None, description="Message returned by error.") + type: Optional[str] = Field(default=None, description="The type of error.") + details: Optional[Dict[str, List[str]]] = Field(default=None, description="Additional details on the error.") + __properties: ClassVar[List[str]] = ["message", "type", "details"] + + 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 CommerceReportError 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 CommerceReportError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message"), + "type": obj.get("type"), + "details": obj.get("details") + }) + return _obj + + + + + +class CommerceReportErrorTypedDict(TypedDict): + """TypedDict variant of CommerceReportError, for dict-literal request/response inputs.""" + message: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + details: NotRequired[Optional[Dict[str, List[str]]]] diff --git a/lending/src/codat_lending/models/shared/commercereportmeasure.py b/lending/src/codat_lending/models/shared/commercereportmeasure.py index d36f75696..942702353 100644 --- a/lending/src/codat_lending/models/shared/commercereportmeasure.py +++ b/lending/src/codat_lending/models/shared/commercereportmeasure.py @@ -1,55 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CommerceReportMeasureTypedDict(TypedDict): - display_name: NotRequired[str] - r"""The measure's display name.""" - index: NotRequired[int] - r"""The measure's index.""" - type: NotRequired[str] - r"""The measure's type.""" - units: NotRequired[str] - r"""The measure's units e.g. percentage (%).""" + 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 CommerceReportMeasure(BaseModel): - display_name: Annotated[Optional[str], pydantic.Field(alias="displayName")] = None - r"""The measure's display name.""" - index: Optional[int] = None - r"""The measure's index.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - type: Optional[str] = None - r"""The measure's type.""" +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 - units: Optional[str] = None - r"""The measure's units e.g. percentage (%).""" +class CommerceReportMeasure(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["displayName", "index", "type", "units"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + CommerceReportMeasure + """ # noqa: E501 + display_name: Optional[str] = Field(default=None, description="The measure's display name.", alias="displayName") + units: Optional[str] = Field(default=None, description="The measure's units e.g. percentage (%).") + index: Optional[int] = Field(default=None, description="The measure's index.") + type: Optional[str] = Field(default=None, description="The measure's type.") + __properties: ClassVar[List[str]] = ["displayName", "units", "index", "type"] + + 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 CommerceReportMeasure 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([ + ]) -try: - CommerceReportMeasure.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 CommerceReportMeasure from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "displayName": obj.get("displayName"), + "units": obj.get("units"), + "index": obj.get("index"), + "type": obj.get("type") + }) + return _obj + + + + + +class CommerceReportMeasureTypedDict(TypedDict): + """TypedDict variant of CommerceReportMeasure, for dict-literal request/response inputs.""" + display_name: NotRequired[Optional[str]] + units: NotRequired[Optional[str]] + index: NotRequired[Optional[int]] + type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commercetransaction.py b/lending/src/codat_lending/models/shared/commercetransaction.py index a4cc1ce3d..183a65947 100644 --- a/lending/src/codat_lending/models/shared/commercetransaction.py +++ b/lending/src/codat_lending/models/shared/commercetransaction.py @@ -1,255 +1,140 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from .transactionsourceref import TransactionSourceRef, TransactionSourceRefTypedDict -from .transactiontype import TransactionType -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 CommerceTransactionTypedDict(TypedDict): - r"""Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. - - You can use data from the Transactions endpoints to calculate key metrics, such as: - - Transaction volumes - - Average transaction volume - - Average transaction value - - Returns - - Payouts - """ - - id: str - r"""A unique, persistent identifier for this record""" - created_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - 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] - source_created_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 - ``` + 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. - """ - source_modified_date: NotRequired[str] - sub_type: NotRequired[str] - r"""Non-standardised transaction type data from the commerce software""" - 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. - """ - total_amount: NotRequired[Decimal] - r"""The total transaction amount""" - transaction_source_ref: NotRequired[TransactionSourceRefTypedDict] - r"""Link to the source event which triggered this transaction""" - type: NotRequired[TransactionType] - r"""The type of the platform transaction: - - `Unknown` - - `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account. - - `Payment` — Credit and debit card payments. - - `PaymentFee` — Payment provider's fee on each card payment. - - `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller. - - `Payout` — Transfer of funds from the seller's merchant account to their bank account. - - `Refund` — Refunds to a customer's credit or debit card. - - `Transfer` — Secure transfer of funds to the seller's bank account. - """ - +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from codat_lending.models.shared.transactionsourceref import TransactionSourceRef, TransactionSourceRefTypedDict +from codat_lending.models.shared.transactiontype import TransactionType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class CommerceTransaction(BaseModel): - r"""Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. - - You can use data from the Transactions endpoints to calculate key metrics, such as: - - Transaction volumes - - Average transaction volume - - Average transaction value - - Returns - - Payouts - """ - - id: str - r"""A unique, persistent identifier for this record""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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. - """ - - 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. - """ - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - source_created_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceCreatedDate") - ] = 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. - """ - - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - - sub_type: Annotated[Optional[str], pydantic.Field(alias="subType")] = None - r"""Non-standardised transaction type data from the commerce software""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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_drop_none(self, handler): + serialized = handler(self) + return {k: v for k, v in serialized.items() if v is not None} """ - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""The total transaction amount""" - - transaction_source_ref: Annotated[ - Optional[TransactionSourceRef], pydantic.Field(alias="transactionSourceRef") - ] = None - r"""Link to the source event which triggered this transaction""" - + Details of all financial transactions recorded in the commerce or point of sale system are added to the Transactions data type. For example, payments, service charges, and fees. You can use data from the Transactions endpoints to calculate key metrics, such as: - Transaction volumes - Average transaction volume - Average transaction value - Returns - Payouts + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total transaction amount", alias="totalAmount") + 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.") type: Optional[TransactionType] = None - r"""The type of the platform transaction: - - `Unknown` - - `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account. - - `Payment` — Credit and debit card payments. - - `PaymentFee` — Payment provider's fee on each card payment. - - `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller. - - `Payout` — Transfer of funds from the seller's merchant account to their bank account. - - `Refund` — Refunds to a customer's credit or debit card. - - `Transfer` — Secure transfer of funds to the seller's bank account. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "createdDate", - "currency", - "modifiedDate", - "sourceCreatedDate", - "sourceModifiedDate", - "subType", - "supplementalData", - "totalAmount", - "transactionSourceRef", - "type", - ] + sub_type: Optional[str] = Field(default=None, description="Non-standardised transaction type data from the commerce software", alias="subType") + transaction_source_ref: Optional[TransactionSourceRef] = Field(default=None, description="Link to the source event which triggered this transaction", alias="transactionSourceRef") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + created_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="createdDate") + source_created_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="sourceCreatedDate") + 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]] = ["id", "totalAmount", "currency", "type", "subType", "transactionSourceRef", "supplementalData", "createdDate", "sourceCreatedDate", "modifiedDate", "sourceModifiedDate"] + + 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 CommerceTransaction 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of transaction_source_ref + if self.transaction_source_ref: + _dict['transactionSourceRef'] = self.transaction_source_ref.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 CommerceTransaction 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"), + "totalAmount": obj.get("totalAmount"), + "currency": obj.get("currency"), + "type": obj.get("type"), + "subType": obj.get("subType"), + "transactionSourceRef": TransactionSourceRef.from_dict(obj["transactionSourceRef"]) if obj.get("transactionSourceRef") is not None else None, + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") is not None else None, + "createdDate": obj.get("createdDate"), + "sourceCreatedDate": obj.get("sourceCreatedDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate") + }) + 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: - CommerceTransaction.model_rebuild() -except NameError: - pass +class CommerceTransactionTypedDict(TypedDict): + """TypedDict variant of CommerceTransaction, for dict-literal request/response inputs.""" + id: NotRequired[str] + total_amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + type: NotRequired[Optional[TransactionType]] + sub_type: NotRequired[Optional[str]] + transaction_source_ref: NotRequired[Optional[TransactionSourceRefTypedDict]] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] + created_date: NotRequired[Optional[str]] + source_created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/commercetransactions.py b/lending/src/codat_lending/models/shared/commercetransactions.py index 3eb9a9c6b..15d86f6f7 100644 --- a/lending/src/codat_lending/models/shared/commercetransactions.py +++ b/lending/src/codat_lending/models/shared/commercetransactions.py @@ -1,58 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .commercetransaction import CommerceTransaction, CommerceTransactionTypedDict -from .links import Links, LinksTypedDict -from codat_lending.types import BaseModel, Nullable, 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_lending.models.shared.commercetransaction import CommerceTransaction, CommerceTransactionTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +from codat_lending.types import Nullable +class CommerceTransactions(BaseModel): -class CommerceTransactionsTypedDict(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[CommerceTransactionTypedDict]]] + @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} + """ + CommerceTransactions + """ # 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[CommerceTransaction]]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class CommerceTransactions(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 CommerceTransactions from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[Nullable[CommerceTransaction]]] = 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 CommerceTransactions 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": [CommerceTransaction.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - CommerceTransactions.model_rebuild() -except NameError: - pass + + + + +class CommerceTransactionsTypedDict(TypedDict): + """TypedDict variant of CommerceTransactions, 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[CommerceTransactionTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/companies.py b/lending/src/codat_lending/models/shared/companies.py index 3b990a3cf..2a9933c44 100644 --- a/lending/src/codat_lending/models/shared/companies.py +++ b/lending/src/codat_lending/models/shared/companies.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.company import Company, CompanyTypedDict +from codat_lending.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 + 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[Company]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + 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 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 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({ + "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": [Company.from_dict(_item) for _item in obj["results"]] if obj.get("results") 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.""" + page_number: NotRequired[int] + page_size: NotRequired[int] + total_results: NotRequired[int] + links: NotRequired[LinksTypedDict] + results: NotRequired[Optional[List[CompanyTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/company.py b/lending/src/codat_lending/models/shared/company.py index d119a02a6..706f9a376 100644 --- a/lending/src/codat_lending/models/shared/company.py +++ b/lending/src/codat_lending/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_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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/lending-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_lending.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict +from codat_lending.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_lending.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/lending-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/lending-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/lending/src/codat_lending/models/shared/companyreference.py b/lending/src/codat_lending/models/shared/companyreference.py index 8bd0ea2bb..43f5671ba 100644 --- a/lending/src/codat_lending/models/shared/companyreference.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.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/lending/src/codat_lending/models/shared/companyrequestbody.py b/lending/src/codat_lending/models/shared/companyrequestbody.py index cb8461d38..679c661c8 100644 --- a/lending/src/codat_lending/models/shared/companyrequestbody.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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/lending/src/codat_lending/models/shared/companyupdaterequest.py b/lending/src/codat_lending/models/shared/companyupdaterequest.py index 30f2718d3..bac23874b 100644 --- a/lending/src/codat_lending/models/shared/companyupdaterequest.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Dict, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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/lending/src/codat_lending/models/shared/connection.py b/lending/src/codat_lending/models/shared/connection.py index fb0590056..22f01486f 100644 --- a/lending/src/codat_lending/models/shared/connection.py +++ b/lending/src/codat_lending/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_lending.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/lending-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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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_lending.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_lending.models.shared.dataconnectionerror import DataConnectionError, DataConnectionErrorTypedDict +from codat_lending.models.shared.dataconnectionstatus import DataConnectionStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class Connection(BaseModel): - r"""A connection represents a [company's](https://docs.codat.io/lending-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/lending-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/lending/src/codat_lending/models/shared/connections.py b/lending/src/codat_lending/models/shared/connections.py index a8e9522a1..cd3518e23 100644 --- a/lending/src/codat_lending/models/shared/connections.py +++ b/lending/src/codat_lending/models/shared/connections.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.connection import Connection, ConnectionTypedDict +from codat_lending.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/lending/src/codat_lending/models/shared/contact.py b/lending/src/codat_lending/models/shared/contact.py index a3bfaed62..e57531120 100644 --- a/lending/src/codat_lending/models/shared/contact.py +++ b/lending/src/codat_lending/models/shared/contact.py @@ -1,119 +1,132 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingaddress import AccountingAddress, AccountingAddressTypedDict -from .customerstatus import CustomerStatus -from .phonenumber import PhoneNumber, PhoneNumberTypedDict -from codat_lending.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 ContactTypedDict(TypedDict): - status: CustomerStatus - r"""Status of customer.""" - address: NotRequired[AccountingAddressTypedDict] - email: NotRequired[Nullable[str]] - r"""Email of a contact for a customer.""" - 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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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` +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_lending.models.shared.accountingaddress import AccountingAddress, AccountingAddressTypedDict +from codat_lending.models.shared.customerstatus import CustomerStatus +from codat_lending.models.phone_number import PhoneNumber, PhoneNumberTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class Contact(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 = {'email', 'name', 'phone'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - name: NotRequired[Nullable[str]] - r"""Name of a contact for a customer.""" - phone: NotRequired[Nullable[List[PhoneNumberTypedDict]]] - r"""An array of Phone numbers.""" - - -class Contact(BaseModel): + Contact + """ # noqa: E501 + name: OptionalNullable[str] = Field(default=UNSET, description="Name of a contact for a customer.") + email: OptionalNullable[str] = Field(default=UNSET, description="Email of a contact for a customer.") + phone: OptionalNullable[List[PhoneNumber]] = Field(default=UNSET, description="An array of Phone numbers.") + address: Optional[AccountingAddress] = Field(default=None, description="An object of Address information.") status: CustomerStatus - r"""Status of customer.""" + 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]] = ["name", "email", "phone", "address", "status", "modifiedDate"] + + 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 Contact 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 phone (list) + _items = [] + if self.phone: + for _item_phone in self.phone: + if _item_phone: + _items.append(_item_phone.to_dict()) + _dict['phone'] = _items + # override the default output from pydantic by calling `to_dict()` of address + if self.address: + _dict['address'] = self.address.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Contact 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"), + "email": obj.get("email"), + "phone": [PhoneNumber.from_dict(_item) for _item in obj["phone"]] if obj.get("phone") is not None else None, + "address": AccountingAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "status": obj.get("status"), + "modifiedDate": obj.get("modifiedDate") + }) + return _obj - address: Optional[AccountingAddress] = None - email: OptionalNullable[str] = UNSET - r"""Email of a contact for a customer.""" - 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. - """ - - name: OptionalNullable[str] = UNSET - r"""Name of a contact for a customer.""" - - phone: OptionalNullable[List[PhoneNumber]] = UNSET - r"""An array of Phone numbers.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["address", "email", "modifiedDate", "name", "phone"]) - nullable_fields = set(["email", "name", "phone"]) - 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: - Contact.model_rebuild() -except NameError: - pass +class ContactTypedDict(TypedDict): + """TypedDict variant of Contact, for dict-literal request/response inputs.""" + name: NotRequired[Optional[str]] + email: NotRequired[Optional[str]] + phone: NotRequired[Optional[List[PhoneNumberTypedDict]]] + address: NotRequired[Optional[AccountingAddressTypedDict]] + status: CustomerStatus + modified_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/contactref.py b/lending/src/codat_lending/models/shared/contactref.py index a48b8a7c0..1b6342968 100644 --- a/lending/src/codat_lending/models/shared/contactref.py +++ b/lending/src/codat_lending/models/shared/contactref.py @@ -1,69 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.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 ContactRefDataType(str, Enum): - r"""Allowed name of the 'dataType'.""" - - CUSTOMERS = "customers" - SUPPLIERS = "suppliers" - - -class ContactRefTypedDict(TypedDict): - id: str - r"""Unique identifier for a customer or supplier.""" - data_type: NotRequired[Nullable[ContactRefDataType]] - r"""Allowed name of the 'dataType'.""" - -class ContactRef(BaseModel): - id: str - r"""Unique identifier for a customer or supplier.""" - - data_type: Annotated[ - OptionalNullable[ContactRefDataType], pydantic.Field(alias="dataType") - ] = UNSET - r"""Allowed name of the 'dataType'.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType"]) - nullable_fields = set(["dataType"]) - 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: - ContactRef.model_rebuild() -except NameError: - pass +from codat_lending.models._compat.contactref import ContactRefDataType diff --git a/lending/src/codat_lending/models/shared/createbankaccounttransaction.py b/lending/src/codat_lending/models/shared/createbankaccounttransaction.py index 46292fde2..407d6826f 100644 --- a/lending/src/codat_lending/models/shared/createbankaccounttransaction.py +++ b/lending/src/codat_lending/models/shared/createbankaccounttransaction.py @@ -1,110 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 CreateBankAccountTransactionTypedDict(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`.""" - 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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - description: NotRequired[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.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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 CreateBankAccountTransaction(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`.""" - - 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: - - ``` - 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. - """ - - description: Optional[str] = None - 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.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "balance", "date", "description", "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} + """ + CreateBankAccountTransaction + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier for the bank account transaction, unique for the company 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.") + 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="date") + description: Optional[str] = Field(default=None, description="Description of 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`.") + __properties: ClassVar[List[str]] = ["id", "amount", "date", "description", "balance"] + + 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 CreateBankAccountTransaction 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 CreateBankAccountTransaction 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"), + "amount": obj.get("amount"), + "date": obj.get("date"), + "description": obj.get("description"), + "balance": obj.get("balance") + }) + 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: - CreateBankAccountTransaction.model_rebuild() -except NameError: - pass +class CreateBankAccountTransactionTypedDict(TypedDict): + """TypedDict variant of CreateBankAccountTransaction, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + balance: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/creditnotelineitem.py b/lending/src/codat_lending/models/shared/creditnotelineitem.py index 4cd22cb0c..336473a75 100644 --- a/lending/src/codat_lending/models/shared/creditnotelineitem.py +++ b/lending/src/codat_lending/models/shared/creditnotelineitem.py @@ -1,237 +1,169 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .accountsreceivabletracking import ( - AccountsReceivableTracking, - AccountsReceivableTrackingTypedDict, -) -from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict -from .taxrateref import TaxRateRef, TaxRateRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class CreditNoteLineItemTypedDict(TypedDict): - quantity: Decimal - r"""Number of units of the goods or service for which credit has been issued.""" - unit_amount: Decimal - r"""Unit price of the goods or service.""" - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: NotRequired[Nullable[str]] - r"""Friendly name of each line item. For example, the goods or service for which credit has been issued.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Value of any discounts applied.""" - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Percentage rate of any discount applied to the line item.""" - is_direct_income: NotRequired[bool] - r"""The credit note is a direct income if `True`.""" - item_ref: NotRequired[PropertieItemRefTypedDict] - r"""Reference to the item the line is linked to.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""Amount of credit associated with the line item, including discounts but excluding tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""Amount of tax associated with the line item.""" - tax_rate_ref: NotRequired[TaxRateRefTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""Total amount of the line item, including discounts and tax.""" - tracking: NotRequired[AccountsReceivableTrackingTypedDict] - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Reference to the tracking categories to which the line item is linked.""" + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTracking, AccountsReceivableTrackingTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class CreditNoteLineItem(BaseModel): - quantity: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Number of units of the goods or service for which credit has been issued.""" - - unit_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] - r"""Unit price of the goods or service.""" - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - description: OptionalNullable[str] = UNSET - r"""Friendly name of each line item. For example, the goods or service for which credit has been issued.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Value of any discounts applied.""" - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Percentage rate of any discount applied to the line item.""" - - is_direct_income: Annotated[ - Optional[bool], pydantic.Field(alias="isDirectIncome") - ] = None - r"""The credit note is a direct income if `True`.""" - - item_ref: Annotated[Optional[PropertieItemRef], pydantic.Field(alias="itemRef")] = ( - None - ) - r"""Reference to the item the line is linked to.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Amount of credit associated with the line item, including discounts but excluding tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""Amount of tax associated with the line item.""" - - tax_rate_ref: Annotated[ - Optional[TaxRateRef], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + CreditNoteLineItem + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Friendly name of each line item. For example, the goods or service for which credit has been issued.") + unit_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Unit price of the goods or service.", alias="unitAmount") + quantity: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Number of units of the goods or service for which credit has been issued.") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Value of any discounts applied.", alias="discountAmount") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of credit associated with the line item, including discounts but excluding tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of tax associated with the line item.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the line item, including discounts and tax.", alias="totalAmount") + account_ref: Optional[AccountRef] = Field(default=None, description="Reference to the account to which the line item is linked.", alias="accountRef") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Percentage rate of any discount applied to the line item.", alias="discountPercentage") + tax_rate_ref: Optional[TaxRateRef] = Field(default=None, description="Reference to the tax rate to which the line item is linked.", alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, description="Reference to the item the line is linked to.", alias="itemRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Reference to the tracking categories to which the line item is linked.", alias="trackingCategoryRefs") + tracking: Optional[AccountsReceivableTracking] = None + is_direct_income: Optional[bool] = Field(default=None, description="The credit note is a direct income if `True`.", alias="isDirectIncome") + __properties: ClassVar[List[str]] = ["description", "unitAmount", "quantity", "discountAmount", "subTotal", "taxAmount", "totalAmount", "accountRef", "discountPercentage", "taxRateRef", "itemRef", "trackingCategoryRefs", "tracking", "isDirectIncome"] - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""Total amount of the line item, including discounts and tax.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - tracking: Optional[AccountsReceivableTracking] = None - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="trackingCategoryRefs", - ), - ] = UNSET - r"""Reference to the tracking categories to which the line item is linked.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "description", - "discountAmount", - "discountPercentage", - "isDirectIncome", - "itemRef", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "tracking", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - ] + 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 CreditNoteLineItem 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, ) - 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: - CreditNoteLineItem.model_rebuild() -except NameError: - pass + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreditNoteLineItem 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"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "discountAmount": obj.get("discountAmount"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "discountPercentage": obj.get("discountPercentage"), + "taxRateRef": TaxRateRef.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "tracking": AccountsReceivableTracking.from_dict(obj["tracking"]) if obj.get("tracking") is not None else None, + "isDirectIncome": obj.get("isDirectIncome") + }) + return _obj + + + + + +class CreditNoteLineItemTypedDict(TypedDict): + """TypedDict variant of CreditNoteLineItem, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Decimal] + quantity: NotRequired[Decimal] + discount_amount: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + discount_percentage: NotRequired[Optional[Decimal]] + tax_rate_ref: NotRequired[Optional[TaxRateRefTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + tracking: NotRequired[Optional[AccountsReceivableTrackingTypedDict]] + is_direct_income: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/shared/creditnotestatus.py b/lending/src/codat_lending/models/shared/creditnotestatus.py index f26419293..dc2921c6a 100644 --- a/lending/src/codat_lending/models/shared/creditnotestatus.py +++ b/lending/src/codat_lending/models/shared/creditnotestatus.py @@ -1,15 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 CreditNoteStatus(str, Enum): - r"""Current state of the credit note.""" - - UNKNOWN = "Unknown" - DRAFT = "Draft" - SUBMITTED = "Submitted" - PAID = "Paid" - VOID = "Void" - PARTIALLY_PAID = "PartiallyPaid" + """ + Current state of the credit note. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + DRAFT = 'Draft' + SUBMITTED = 'Submitted' + PAID = 'Paid' + VOID = 'Void' + PARTIALLY_PAID = 'PartiallyPaid' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CreditNoteStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/customerstatus.py b/lending/src/codat_lending/models/shared/customerstatus.py index 1e060f7bd..f4fa3444c 100644 --- a/lending/src/codat_lending/models/shared/customerstatus.py +++ b/lending/src/codat_lending/models/shared/customerstatus.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 CustomerStatus(str, Enum): - r"""Status of customer.""" + """ + Status of customer. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of CustomerStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" diff --git a/lending/src/codat_lending/models/shared/dataconnectionerror.py b/lending/src/codat_lending/models/shared/dataconnectionerror.py index 3e41ad39b..c98002900 100644 --- a/lending/src/codat_lending/models/shared/dataconnectionerror.py +++ b/lending/src/codat_lending/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_lending.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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.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_lending.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/lending/src/codat_lending/models/shared/dataconnectionstatus.py b/lending/src/codat_lending/models/shared/dataconnectionstatus.py index a97f7be30..5d057ac37 100644 --- a/lending/src/codat_lending/models/shared/dataconnectionstatus.py +++ b/lending/src/codat_lending/models/shared/dataconnectionstatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/dataintegrityamounts.py b/lending/src/codat_lending/models/shared/dataintegrityamounts.py index 9d22c87d5..02f03a2ec 100644 --- a/lending/src/codat_lending/models/shared/dataintegrityamounts.py +++ b/lending/src/codat_lending/models/shared/dataintegrityamounts.py @@ -1,73 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import serialize_decimal, validate_decimal from decimal import Decimal -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 +from codat_lending.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 DataIntegrityAmountsTypedDict(TypedDict): - r"""Only returned for transactions. For accounts, there is nothing returned.""" +class DataIntegrityAmounts(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} + """ + Only returned for transactions. For accounts, there is nothing returned. + """ # noqa: E501 + min: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Lowest value of transaction set.") + max: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Highest value of transaction set.") + 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.") + __properties: ClassVar[List[str]] = ["min", "max", "currency"] - 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_. + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - ## 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. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(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. - """ - max: NotRequired[Decimal] - r"""Highest value of transaction set.""" - min: NotRequired[Decimal] - r"""Lowest value of transaction set.""" + 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 DataIntegrityAmounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) -class DataIntegrityAmounts(BaseModel): - r"""Only returned for transactions. For accounts, there is nothing returned.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - 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_. + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - ## Unknown currencies + * `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([ + ]) - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityAmounts from a dict""" + if obj is None: + return None - max: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Highest value of transaction set.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - min: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Lowest value of transaction set.""" + _obj = cls.model_validate({ + "min": obj.get("min"), + "max": obj.get("max"), + "currency": obj.get("currency") + }) + return _obj - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["currency", "max", "min"]) - 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 DataIntegrityAmountsTypedDict(TypedDict): + """TypedDict variant of DataIntegrityAmounts, for dict-literal request/response inputs.""" + min: NotRequired[Optional[Decimal]] + max: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/dataintegritybyamount.py b/lending/src/codat_lending/models/shared/dataintegritybyamount.py index d233532ec..1004ee3dd 100644 --- a/lending/src/codat_lending/models/shared/dataintegritybyamount.py +++ b/lending/src/codat_lending/models/shared/dataintegritybyamount.py @@ -1,99 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityByAmountTypedDict(TypedDict): - 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_. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Unknown currencies + Do not edit the class manually. +""" # noqa: E501 - 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. - """ - match_percentage: NotRequired[Decimal] - r"""The percentage of the absolute value of transactions of the type specified in the route which have a match.""" - matched: NotRequired[Decimal] - r"""The sum of the absolute value of transactions of the type specified in the route which have a match.""" - total: NotRequired[Decimal] - r"""The total of unmatched and matched.""" - unmatched: NotRequired[Decimal] - r"""The sum of the absolute value of transactions of the type specified in the route which don't have a match.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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 DataIntegrityByAmount(BaseModel): - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + DataIntegrityByAmount + """ # noqa: E501 + match_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The percentage of the absolute value of transactions of the type specified in the route which have a match.", alias="matchPercentage") + unmatched: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The sum of the absolute value of transactions of the type specified in the route which don't have a match.") + matched: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The sum of the absolute value of transactions of the type specified in the route which have a match.") + total: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total of unmatched and matched.") + 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.") + __properties: ClassVar[List[str]] = ["matchPercentage", "unmatched", "matched", "total", "currency"] + + 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 DataIntegrityByAmount 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 - match_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="matchPercentage"), - ] = None - r"""The percentage of the absolute value of transactions of the type specified in the route which have a match.""" - - matched: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The sum of the absolute value of transactions of the type specified in the route which have a match.""" - - total: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The total of unmatched and matched.""" - - unmatched: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The sum of the absolute value of transactions of the type specified in the route which don't have a match.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityByAmount from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["currency", "matchPercentage", "matched", "total", "unmatched"] - ) - 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({ + "matchPercentage": obj.get("matchPercentage"), + "unmatched": obj.get("unmatched"), + "matched": obj.get("matched"), + "total": obj.get("total"), + "currency": obj.get("currency") + }) + return _obj - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - DataIntegrityByAmount.model_rebuild() -except NameError: - pass + +class DataIntegrityByAmountTypedDict(TypedDict): + """TypedDict variant of DataIntegrityByAmount, for dict-literal request/response inputs.""" + match_percentage: NotRequired[Optional[Decimal]] + unmatched: NotRequired[Optional[Decimal]] + matched: NotRequired[Optional[Decimal]] + total: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/dataintegritybycount.py b/lending/src/codat_lending/models/shared/dataintegritybycount.py index b2f761ec2..1d3230fcb 100644 --- a/lending/src/codat_lending/models/shared/dataintegritybycount.py +++ b/lending/src/codat_lending/models/shared/dataintegritybycount.py @@ -1,78 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityByCountTypedDict(TypedDict): - match_percentage: NotRequired[Decimal] - r"""The percentage of records of the type specified in the route which have a match.""" - matched: NotRequired[Decimal] - r"""The number of records of the type specified in the route which do have a match.""" - total: NotRequired[Decimal] - r"""The total of unmatched and matched.""" - unmatched: NotRequired[Decimal] - r"""The number of records of the type specified in the route which don't have a match.""" + 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_lending.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 DataIntegrityByCount(BaseModel): - match_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="matchPercentage"), - ] = None - r"""The percentage of records of the type specified in the route which have a match.""" - - matched: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The number of records of the type specified in the route which do have a match.""" - - total: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The total of unmatched and matched.""" - - unmatched: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The number of records of the type specified in the route which don't have a match.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["matchPercentage", "matched", "total", "unmatched"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataIntegrityByCount + """ # noqa: E501 + match_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The percentage of records of the type specified in the route which have a match.", alias="matchPercentage") + unmatched: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The number of records of the type specified in the route which don't have a match.") + matched: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The number of records of the type specified in the route which do have a match.") + total: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total of unmatched and matched.") + __properties: ClassVar[List[str]] = ["matchPercentage", "unmatched", "matched", "total"] + + 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 DataIntegrityByCount 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: - DataIntegrityByCount.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 DataIntegrityByCount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "matchPercentage": obj.get("matchPercentage"), + "unmatched": obj.get("unmatched"), + "matched": obj.get("matched"), + "total": obj.get("total") + }) + return _obj + + + + + +class DataIntegrityByCountTypedDict(TypedDict): + """TypedDict variant of DataIntegrityByCount, for dict-literal request/response inputs.""" + match_percentage: NotRequired[Optional[Decimal]] + unmatched: NotRequired[Optional[Decimal]] + matched: NotRequired[Optional[Decimal]] + total: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/dataintegrityconnectionid.py b/lending/src/codat_lending/models/shared/dataintegrityconnectionid.py index ac24dbbeb..eb3fb2c0b 100644 --- a/lending/src/codat_lending/models/shared/dataintegrityconnectionid.py +++ b/lending/src/codat_lending/models/shared/dataintegrityconnectionid.py @@ -1,38 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -class DataIntegrityConnectionIDTypedDict(TypedDict): - source: NotRequired[List[str]] - r"""An array of strings. The connection IDs for the type specified in the url.""" - target: NotRequired[List[str]] - r"""An array of strings. The connection IDs for the type being matched to.""" + Do not edit the class manually. +""" # noqa: E501 -class DataIntegrityConnectionID(BaseModel): - source: Optional[List[str]] = None - r"""An array of strings. The connection IDs for the type specified in the url.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - target: Optional[List[str]] = None - r"""An array of strings. The connection IDs for the type being matched to.""" +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 DataIntegrityConnectionId(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["source", "target"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataIntegrityConnectionId + """ # noqa: E501 + source: Optional[List[str]] = Field(default=None, description="An array of strings. The connection IDs for the type specified in the url.") + target: Optional[List[str]] = Field(default=None, description="An array of strings. The connection IDs for the type being matched to.") + __properties: ClassVar[List[str]] = ["source", "target"] + + 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 DataIntegrityConnectionId 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 DataIntegrityConnectionId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "source": obj.get("source"), + "target": obj.get("target") + }) + 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 DataIntegrityConnectionIdTypedDict(TypedDict): + """TypedDict variant of DataIntegrityConnectionId, for dict-literal request/response inputs.""" + source: NotRequired[Optional[List[str]]] + target: NotRequired[Optional[List[str]]] diff --git a/lending/src/codat_lending/models/shared/dataintegritydatatype.py b/lending/src/codat_lending/models/shared/dataintegritydatatype.py index f62aaac21..6df990358 100644 --- a/lending/src/codat_lending/models/shared/dataintegritydatatype.py +++ b/lending/src/codat_lending/models/shared/dataintegritydatatype.py @@ -1,11 +1,11 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations + from enum import Enum class DataIntegrityDataType(str, Enum): - BANKING_ACCOUNTS = "banking-accounts" - BANKING_TRANSACTIONS = "banking-transactions" - BANK_ACCOUNTS = "bankAccounts" - ACCOUNT_TRANSACTIONS = "accountTransactions" + """Shared OAS parameter enum (lifted from components/parameters/dataIntegrityDataType).""" + BANKING_ACCOUNTS = 'banking-accounts' + BANKING_TRANSACTIONS = 'banking-transactions' + BANK_ACCOUNTS = 'bankAccounts' + ACCOUNT_TRANSACTIONS = 'accountTransactions' diff --git a/lending/src/codat_lending/models/shared/dataintegritydates.py b/lending/src/codat_lending/models/shared/dataintegritydates.py index b4191575d..088fc8c32 100644 --- a/lending/src/codat_lending/models/shared/dataintegritydates.py +++ b/lending/src/codat_lending/models/shared/dataintegritydates.py @@ -1,217 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class DataIntegrityDatesTypedDict(TypedDict): - r"""Only returned for transactions. For accounts, there is nothing returned.""" - - max_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. - """ - max_overlapping_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: +""" + Lending - - 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` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - > 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. - """ - min_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. - """ - min_overlapping_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: - - - 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. - """ - +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 DataIntegrityDates(BaseModel): - r"""Only returned for transactions. For accounts, there is nothing returned.""" - - max_date: Annotated[Optional[str], pydantic.Field(alias="maxDate")] = 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. - """ - - max_overlapping_date: Annotated[ - Optional[str], pydantic.Field(alias="maxOverlappingDate") - ] = 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. - """ - - min_date: Annotated[Optional[str], pydantic.Field(alias="minDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + Only returned for transactions. For accounts, there is nothing returned. + """ # noqa: E501 + min_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="minDate") + max_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="maxDate") + min_overlapping_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="minOverlappingDate") + max_overlapping_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="maxOverlappingDate") + __properties: ClassVar[List[str]] = ["minDate", "maxDate", "minOverlappingDate", "maxOverlappingDate"] + + 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 DataIntegrityDates 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 - min_overlapping_date: Annotated[ - Optional[str], pydantic.Field(alias="minOverlappingDate") - ] = 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` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityDates from a dict""" + if obj is None: + return None - > 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. - """ + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["maxDate", "maxOverlappingDate", "minDate", "minOverlappingDate"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "minDate": obj.get("minDate"), + "maxDate": obj.get("maxDate"), + "minOverlappingDate": obj.get("minOverlappingDate"), + "maxOverlappingDate": obj.get("maxOverlappingDate") + }) + 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: - DataIntegrityDates.model_rebuild() -except NameError: - pass +class DataIntegrityDatesTypedDict(TypedDict): + """TypedDict variant of DataIntegrityDates, for dict-literal request/response inputs.""" + min_date: NotRequired[Optional[str]] + max_date: NotRequired[Optional[str]] + min_overlapping_date: NotRequired[Optional[str]] + max_overlapping_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/dataintegritydetail.py b/lending/src/codat_lending/models/shared/dataintegritydetail.py index 7d06d3b24..846a40a4b 100644 --- a/lending/src/codat_lending/models/shared/dataintegritydetail.py +++ b/lending/src/codat_lending/models/shared/dataintegritydetail.py @@ -1,145 +1,132 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .dataintegritymatch import DataIntegrityMatch, DataIntegrityMatchTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 DataIntegrityDetailTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""The transaction value.""" - connection_id: NotRequired[str] - r"""ID GUID representing the connection of the accounting or banking platform.""" - 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. - """ - 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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - description: NotRequired[str] - r"""The transaction description.""" - id: NotRequired[str] - r"""ID GUID of the transaction.""" - matches: NotRequired[List[DataIntegrityMatchTypedDict]] - type: NotRequired[str] - r"""The data type of the record.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.dataintegritymatch import DataIntegrityMatch, DataIntegrityMatchTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class DataIntegrityDetail(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The transaction value.""" - - connection_id: Annotated[Optional[str], pydantic.Field(alias="connectionId")] = None - r"""ID GUID representing the connection of the accounting or banking platform.""" - - 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. - """ - - 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: - - ``` - 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) + return {k: v for k, v in serialized.items() if v is not None} """ - - description: Optional[str] = None - r"""The transaction description.""" - - id: Optional[str] = None - r"""ID GUID of the transaction.""" - + DataIntegrityDetail + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="ID GUID of the transaction.") + type: Optional[str] = Field(default=None, description="The data type of the record.") + connection_id: Optional[str] = Field(default=None, description="ID GUID representing the connection of the accounting or banking platform.", alias="connectionId") + 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="date") + description: Optional[str] = Field(default=None, description="The transaction description.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The transaction value.") + 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.") matches: Optional[List[DataIntegrityMatch]] = None + __properties: ClassVar[List[str]] = ["id", "type", "connectionId", "date", "description", "amount", "currency", "matches"] + + 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 DataIntegrityDetail 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. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "connection_id", + ]) + + _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 matches (list) + _items = [] + if self.matches: + for _item_matches in self.matches: + if _item_matches: + _items.append(_item_matches.to_dict()) + _dict['matches'] = _items + return _dict - type: Optional[str] = None - r"""The data type of the record.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityDetail from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amount", - "connectionId", - "currency", - "date", - "description", - "id", - "matches", - "type", - ] - ) - 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({ + "id": obj.get("id"), + "type": obj.get("type"), + "connectionId": obj.get("connectionId"), + "date": obj.get("date"), + "description": obj.get("description"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "matches": [DataIntegrityMatch.from_dict(_item) for _item in obj["matches"]] if obj.get("matches") 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: - DataIntegrityDetail.model_rebuild() -except NameError: - pass + +class DataIntegrityDetailTypedDict(TypedDict): + """TypedDict variant of DataIntegrityDetail, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + connection_id: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + matches: NotRequired[Optional[List[DataIntegrityMatchTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/dataintegritydetails.py b/lending/src/codat_lending/models/shared/dataintegritydetails.py index 17dd4a6de..1ee9690ac 100644 --- a/lending/src/codat_lending/models/shared/dataintegritydetails.py +++ b/lending/src/codat_lending/models/shared/dataintegritydetails.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .dataintegritydetail import DataIntegrityDetail, DataIntegrityDetailTypedDict -from .links import Links, LinksTypedDict -from codat_lending.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_lending.models.shared.dataintegritydetail import DataIntegrityDetail, DataIntegrityDetailTypedDict +from codat_lending.models.shared.links import Links, LinksTypedDict +from typing import Optional, Set +from typing_extensions import Self +class DataIntegrityDetails(BaseModel): -class DataIntegrityDetailsTypedDict(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[DataIntegrityDetailTypedDict]] + @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} + """ + DataIntegrityDetails + """ # 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[DataIntegrityDetail]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class DataIntegrityDetails(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 DataIntegrityDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[DataIntegrityDetail]] = 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 DataIntegrityDetails 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": [DataIntegrityDetail.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - DataIntegrityDetails.model_rebuild() -except NameError: - pass + + + + +class DataIntegrityDetailsTypedDict(TypedDict): + """TypedDict variant of DataIntegrityDetails, 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[DataIntegrityDetailTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/dataintegritymatch.py b/lending/src/codat_lending/models/shared/dataintegritymatch.py index 8176ea757..8c43f3079 100644 --- a/lending/src/codat_lending/models/shared/dataintegritymatch.py +++ b/lending/src/codat_lending/models/shared/dataintegritymatch.py @@ -1,86 +1,117 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityMatchTypedDict(TypedDict): - amount: NotRequired[str] - r"""The transaction value.""" - connection_id: NotRequired[str] - r"""ID GUID representing the connection of the accounting or banking platform.""" - 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_. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Unknown currencies + Do not edit the class manually. +""" # noqa: E501 - 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. - """ - date_: NotRequired[str] - r"""The date of the transaction.""" - description: NotRequired[str] - r"""The transaction description.""" - id: NotRequired[str] - r"""ID GUID of the transaction.""" - type: NotRequired[str] - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" +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 DataIntegrityMatch(BaseModel): - amount: Optional[str] = None - r"""The transaction value.""" - - connection_id: Annotated[Optional[str], pydantic.Field(alias="connectionId")] = None - r"""ID GUID representing the connection of the accounting or banking platform.""" - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + DataIntegrityMatch + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="ID GUID of the transaction.") + type: Optional[str] = Field(default=None, description="The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.") + connection_id: Optional[str] = Field(default=None, description="ID GUID representing the connection of the accounting or banking platform.", alias="connectionId") + date_: Optional[str] = Field(default=None, description="The date of the transaction.", alias="date") + description: Optional[str] = Field(default=None, description="The transaction description.") + amount: Optional[str] = Field(default=None, description="The transaction value.") + 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.") + __properties: ClassVar[List[str]] = ["id", "type", "connectionId", "date", "description", "amount", "currency"] + + 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 DataIntegrityMatch 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 - date_: Annotated[Optional[str], pydantic.Field(alias="date")] = None - r"""The date of the transaction.""" - - description: Optional[str] = None - r"""The transaction description.""" - - id: Optional[str] = None - r"""ID GUID of the transaction.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityMatch from a dict""" + if obj is None: + return None - type: Optional[str] = None - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["amount", "connectionId", "currency", "date", "description", "id", "type"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "connectionId": obj.get("connectionId"), + "date": obj.get("date"), + "description": obj.get("description"), + "amount": obj.get("amount"), + "currency": obj.get("currency") + }) + 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: - DataIntegrityMatch.model_rebuild() -except NameError: - pass +class DataIntegrityMatchTypedDict(TypedDict): + """TypedDict variant of DataIntegrityMatch, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] + connection_id: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + description: NotRequired[Optional[str]] + amount: NotRequired[Optional[str]] + currency: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/dataintegritystatus.py b/lending/src/codat_lending/models/shared/dataintegritystatus.py index ff8ae6514..761d01b37 100644 --- a/lending/src/codat_lending/models/shared/dataintegritystatus.py +++ b/lending/src/codat_lending/models/shared/dataintegritystatus.py @@ -1,72 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .dataintegrityamounts import DataIntegrityAmounts, DataIntegrityAmountsTypedDict -from .dataintegrityconnectionid import ( - DataIntegrityConnectionID, - DataIntegrityConnectionIDTypedDict, -) -from .dataintegritydates import DataIntegrityDates, DataIntegrityDatesTypedDict -from .dataintegritystatusinfo import ( - DataIntegrityStatusInfo, - DataIntegrityStatusInfoTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityStatusTypedDict(TypedDict): - amounts: NotRequired[DataIntegrityAmountsTypedDict] - r"""Only returned for transactions. For accounts, there is nothing returned.""" - connection_ids: NotRequired[DataIntegrityConnectionIDTypedDict] - dates: NotRequired[DataIntegrityDatesTypedDict] - r"""Only returned for transactions. For accounts, there is nothing returned.""" - status_info: NotRequired[DataIntegrityStatusInfoTypedDict] - type: NotRequired[str] - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" + 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_lending.models.shared.dataintegrityamounts import DataIntegrityAmounts, DataIntegrityAmountsTypedDict +from codat_lending.models.shared.dataintegrityconnectionid import DataIntegrityConnectionId, DataIntegrityConnectionIdTypedDict +from codat_lending.models.shared.dataintegritydates import DataIntegrityDates, DataIntegrityDatesTypedDict +from codat_lending.models.shared.dataintegritystatusinfo import DataIntegrityStatusInfo, DataIntegrityStatusInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class DataIntegrityStatus(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} + """ + DataIntegrityStatus + """ # noqa: E501 + type: Optional[str] = Field(default=None, description="The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.") + status_info: Optional[DataIntegrityStatusInfo] = Field(default=None, alias="statusInfo") + connection_ids: Optional[DataIntegrityConnectionId] = Field(default=None, alias="connectionIds") amounts: Optional[DataIntegrityAmounts] = None - r"""Only returned for transactions. For accounts, there is nothing returned.""" + dates: Optional[DataIntegrityDates] = None + __properties: ClassVar[List[str]] = ["type", "statusInfo", "connectionIds", "amounts", "dates"] - connection_ids: Annotated[ - Optional[DataIntegrityConnectionID], pydantic.Field(alias="connectionIds") - ] = None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - dates: Optional[DataIntegrityDates] = None - r"""Only returned for transactions. For accounts, there is nothing returned.""" - status_info: Annotated[ - Optional[DataIntegrityStatusInfo], pydantic.Field(alias="statusInfo") - ] = None + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - type: Optional[str] = None - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" + 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()) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["amounts", "connectionIds", "dates", "statusInfo", "type"] + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DataIntegrityStatus 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, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of status_info + if self.status_info: + _dict['statusInfo'] = self.status_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of connection_ids + if self.connection_ids: + _dict['connectionIds'] = self.connection_ids.to_dict() + # override the default output from pydantic by calling `to_dict()` of amounts + if self.amounts: + _dict['amounts'] = self.amounts.to_dict() + # override the default output from pydantic by calling `to_dict()` of dates + if self.dates: + _dict['dates'] = self.dates.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityStatus 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({ + "type": obj.get("type"), + "statusInfo": DataIntegrityStatusInfo.from_dict(obj["statusInfo"]) if obj.get("statusInfo") is not None else None, + "connectionIds": DataIntegrityConnectionId.from_dict(obj["connectionIds"]) if obj.get("connectionIds") is not None else None, + "amounts": DataIntegrityAmounts.from_dict(obj["amounts"]) if obj.get("amounts") is not None else None, + "dates": DataIntegrityDates.from_dict(obj["dates"]) if obj.get("dates") 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: - DataIntegrityStatus.model_rebuild() -except NameError: - pass + +class DataIntegrityStatusTypedDict(TypedDict): + """TypedDict variant of DataIntegrityStatus, for dict-literal request/response inputs.""" + type: NotRequired[Optional[str]] + status_info: NotRequired[Optional[DataIntegrityStatusInfoTypedDict]] + connection_ids: NotRequired[Optional[DataIntegrityConnectionIdTypedDict]] + amounts: NotRequired[Optional[DataIntegrityAmountsTypedDict]] + dates: NotRequired[Optional[DataIntegrityDatesTypedDict]] diff --git a/lending/src/codat_lending/models/shared/dataintegritystatuses.py b/lending/src/codat_lending/models/shared/dataintegritystatuses.py index ebc02e5b8..fb1dc59ed 100644 --- a/lending/src/codat_lending/models/shared/dataintegritystatuses.py +++ b/lending/src/codat_lending/models/shared/dataintegritystatuses.py @@ -1,32 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .dataintegritystatus import DataIntegrityStatus, DataIntegrityStatusTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityStatusesTypedDict(TypedDict): - metadata: NotRequired[List[DataIntegrityStatusTypedDict]] + 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 codat_lending.models.shared.dataintegritystatus import DataIntegrityStatus, DataIntegrityStatusTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class DataIntegrityStatuses(BaseModel): - metadata: Optional[List[DataIntegrityStatus]] = None @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["metadata"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataIntegrityStatuses + """ # noqa: E501 + metadata: Optional[List[DataIntegrityStatus]] = None + __properties: ClassVar[List[str]] = ["metadata"] + + 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 DataIntegrityStatuses 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in metadata (list) + _items = [] + if self.metadata: + for _item_metadata in self.metadata: + if _item_metadata: + _items.append(_item_metadata.to_dict()) + _dict['metadata'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityStatuses from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": [DataIntegrityStatus.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None + }) + return _obj + + + + + +class DataIntegrityStatusesTypedDict(TypedDict): + """TypedDict variant of DataIntegrityStatuses, for dict-literal request/response inputs.""" + metadata: NotRequired[Optional[List[DataIntegrityStatusTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/dataintegritystatusinfo.py b/lending/src/codat_lending/models/shared/dataintegritystatusinfo.py index e6dc26a1e..012aac20f 100644 --- a/lending/src/codat_lending/models/shared/dataintegritystatusinfo.py +++ b/lending/src/codat_lending/models/shared/dataintegritystatusinfo.py @@ -1,93 +1,106 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .integritystatus import IntegrityStatus -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegrityStatusInfoTypedDict(TypedDict): - current_status: NotRequired[IntegrityStatus] - r"""The current status of the most recently run matching algorithm.""" - last_matched: 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_lending.models.shared.integritystatus import IntegrityStatus +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 DataIntegrityStatusInfo(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} """ - status_message: NotRequired[str] - r"""Detailed explanation supporting the status value.""" + DataIntegrityStatusInfo + """ # noqa: E501 + last_matched: 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="lastMatched") + current_status: Optional[IntegrityStatus] = Field(default=None, alias="currentStatus") + status_message: Optional[str] = Field(default=None, description="Detailed explanation supporting the status value.", alias="statusMessage") + __properties: ClassVar[List[str]] = ["lastMatched", "currentStatus", "statusMessage"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class DataIntegrityStatusInfo(BaseModel): - current_status: Annotated[ - Optional[IntegrityStatus], pydantic.Field(alias="currentStatus") - ] = None - r"""The current status of the most recently run matching algorithm.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - last_matched: Annotated[Optional[str], pydantic.Field(alias="lastMatched")] = 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 DataIntegrityStatusInfo 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. + """ + excluded_fields: Set[str] = set([ + ]) - - 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, + ) + return _dict - > 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. - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegrityStatusInfo from a dict""" + if obj is None: + return None - status_message: Annotated[Optional[str], pydantic.Field(alias="statusMessage")] = ( - None - ) - r"""Detailed explanation supporting the status value.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["currentStatus", "lastMatched", "statusMessage"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "lastMatched": obj.get("lastMatched"), + "currentStatus": obj.get("currentStatus"), + "statusMessage": obj.get("statusMessage") + }) + 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: - DataIntegrityStatusInfo.model_rebuild() -except NameError: - pass +class DataIntegrityStatusInfoTypedDict(TypedDict): + """TypedDict variant of DataIntegrityStatusInfo, for dict-literal request/response inputs.""" + last_matched: NotRequired[Optional[str]] + current_status: NotRequired[Optional[IntegrityStatus]] + status_message: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/dataintegritysummaries.py b/lending/src/codat_lending/models/shared/dataintegritysummaries.py index 427bafd4c..cc93fb9d7 100644 --- a/lending/src/codat_lending/models/shared/dataintegritysummaries.py +++ b/lending/src/codat_lending/models/shared/dataintegritysummaries.py @@ -1,32 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .dataintegritysummary import DataIntegritySummary, DataIntegritySummaryTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegritySummariesTypedDict(TypedDict): - summaries: NotRequired[List[DataIntegritySummaryTypedDict]] + 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 codat_lending.models.shared.dataintegritysummary import DataIntegritySummary, DataIntegritySummaryTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class DataIntegritySummaries(BaseModel): - summaries: Optional[List[DataIntegritySummary]] = None @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["summaries"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataIntegritySummaries + """ # noqa: E501 + summaries: Optional[List[DataIntegritySummary]] = None + __properties: ClassVar[List[str]] = ["summaries"] + + 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 DataIntegritySummaries 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in summaries (list) + _items = [] + if self.summaries: + for _item_summaries in self.summaries: + if _item_summaries: + _items.append(_item_summaries.to_dict()) + _dict['summaries'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegritySummaries from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "summaries": [DataIntegritySummary.from_dict(_item) for _item in obj["summaries"]] if obj.get("summaries") is not None else None + }) + return _obj + + + + + +class DataIntegritySummariesTypedDict(TypedDict): + """TypedDict variant of DataIntegritySummaries, for dict-literal request/response inputs.""" + summaries: NotRequired[Optional[List[DataIntegritySummaryTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/dataintegritysummary.py b/lending/src/codat_lending/models/shared/dataintegritysummary.py index 33cc0a1b9..402a2b3e0 100644 --- a/lending/src/codat_lending/models/shared/dataintegritysummary.py +++ b/lending/src/codat_lending/models/shared/dataintegritysummary.py @@ -1,52 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .dataintegritybyamount import DataIntegrityByAmount, DataIntegrityByAmountTypedDict -from .dataintegritybycount import DataIntegrityByCount, DataIntegrityByCountTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataIntegritySummaryTypedDict(TypedDict): - by_amount: NotRequired[DataIntegrityByAmountTypedDict] - by_count: NotRequired[DataIntegrityByCountTypedDict] - type: NotRequired[str] - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" + 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 DataIntegritySummary(BaseModel): - by_amount: Annotated[ - Optional[DataIntegrityByAmount], pydantic.Field(alias="byAmount") - ] = None - by_count: Annotated[ - Optional[DataIntegrityByCount], pydantic.Field(alias="byCount") - ] = None +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_lending.models.shared.dataintegritybyamount import DataIntegrityByAmount, DataIntegrityByAmountTypedDict +from codat_lending.models.shared.dataintegritybycount import DataIntegrityByCount, DataIntegrityByCountTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - type: Optional[str] = None - r"""The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.""" +class DataIntegritySummary(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["byAmount", "byCount", "type"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataIntegritySummary + """ # noqa: E501 + type: Optional[str] = Field(default=None, description="The data type which the data type in the URL has been matched against. For example, if you've matched accountTransactions and banking-transactions, and you call this endpoint with accountTransactions in the URL, this property would be banking-transactions.") + by_amount: Optional[DataIntegrityByAmount] = Field(default=None, alias="byAmount") + by_count: Optional[DataIntegrityByCount] = Field(default=None, alias="byCount") + __properties: ClassVar[List[str]] = ["type", "byAmount", "byCount"] + + 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 DataIntegritySummary 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([ + ]) -try: - DataIntegritySummary.model_rebuild() -except NameError: - pass + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of by_amount + if self.by_amount: + _dict['byAmount'] = self.by_amount.to_dict() + # override the default output from pydantic by calling `to_dict()` of by_count + if self.by_count: + _dict['byCount'] = self.by_count.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataIntegritySummary 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"), + "byAmount": DataIntegrityByAmount.from_dict(obj["byAmount"]) if obj.get("byAmount") is not None else None, + "byCount": DataIntegrityByCount.from_dict(obj["byCount"]) if obj.get("byCount") is not None else None + }) + return _obj + + + + + +class DataIntegritySummaryTypedDict(TypedDict): + """TypedDict variant of DataIntegritySummary, for dict-literal request/response inputs.""" + type: NotRequired[Optional[str]] + by_amount: NotRequired[Optional[DataIntegrityByAmountTypedDict]] + by_count: NotRequired[Optional[DataIntegrityByCountTypedDict]] diff --git a/lending/src/codat_lending/models/shared/datasource.py b/lending/src/codat_lending/models/shared/datasource.py index ae7e6362b..20ff21a7a 100644 --- a/lending/src/codat_lending/models/shared/datasource.py +++ b/lending/src/codat_lending/models/shared/datasource.py @@ -1,34 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accounts import Accounts, AccountsTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DataSourceTypedDict(TypedDict): - accounts: NotRequired[List[AccountsTypedDict]] - r"""An array containing bank account data for each connected banking data source that have the following data types enabled: `banking-accounts`, `banking-transactions`.""" + 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_lending.models.shared.accounts import Accounts, AccountsTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class DataSource(BaseModel): - accounts: Optional[List[Accounts]] = None - r"""An array containing bank account data for each connected banking data source that have the following data types enabled: `banking-accounts`, `banking-transactions`.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accounts"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + DataSource + """ # noqa: E501 + accounts: Optional[List[Accounts]] = Field(default=None, description="An array containing bank account data for each connected banking data source that have the following data types enabled: `banking-accounts`, `banking-transactions`.") + __properties: ClassVar[List[str]] = ["accounts"] + + 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 DataSource 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in accounts (list) + _items = [] + if self.accounts: + for _item_accounts in self.accounts: + if _item_accounts: + _items.append(_item_accounts.to_dict()) + _dict['accounts'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataSource from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accounts": [Accounts.from_dict(_item) for _item in obj["accounts"]] if obj.get("accounts") is not None else None + }) + return _obj + + + + + +class DataSourceTypedDict(TypedDict): + """TypedDict variant of DataSource, for dict-literal request/response inputs.""" + accounts: NotRequired[Optional[List[AccountsTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/datastatus.py b/lending/src/codat_lending/models/shared/datastatus.py index f0b58ed1c..d08b526bc 100644 --- a/lending/src/codat_lending/models/shared/datastatus.py +++ b/lending/src/codat_lending/models/shared/datastatus.py @@ -1,160 +1,128 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .status import Status -from codat_lending.types import BaseModel, 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 DataTypes(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" - - -class DataStatusTypedDict(TypedDict): - r"""Describes the state of data in the Codat cache for a company and data type""" - - current_status: Status - r"""The current status of the dataset.""" - data_type: DataTypes - r"""Available data types""" - last_successful_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - latest_successful_sync_id: NotRequired[str] - r"""Unique identifier for the most recent successful sync of data type.""" - latest_sync_id: NotRequired[str] - r"""Unique identifier for most recent sync of data type.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from codat_lending.models.current_status import CurrentStatus +from codat_lending.models.data_types import DataTypes +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_lending.models.shared.status import Status class DataStatus(BaseModel): - r"""Describes the state of data in the Codat cache for a company and data type""" - current_status: Annotated[Status, pydantic.Field(alias="currentStatus")] - r"""The current status of the dataset.""" + @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} + """ + Describes the state of data in the Codat cache for a company and data type + """ # noqa: E501 + data_type: DataTypes = Field(description="Available data types", alias="dataType") + last_successful_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="lastSuccessfulSync") + current_status: Status = Field(description="The current status of the dataset.", alias="currentStatus") + latest_sync_id: Optional[str] = Field(default=None, description="Unique identifier for most recent sync of data type.", alias="latestSyncId") + latest_successful_sync_id: Optional[str] = Field(default=None, description="Unique identifier for the most recent successful sync of data type.", alias="latestSuccessfulSyncId") + __properties: ClassVar[List[str]] = ["dataType", "lastSuccessfulSync", "currentStatus", "latestSyncId", "latestSuccessfulSyncId"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + return value + + @field_validator('current_status') + def current_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=(), + ) - data_type: Annotated[DataTypes, pydantic.Field(alias="dataType")] - r"""Available data types""" - last_successful_sync: Annotated[ - Optional[str], pydantic.Field(alias="lastSuccessfulSync") - ] = 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 DataStatus 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 - latest_successful_sync_id: Annotated[ - Optional[str], pydantic.Field(alias="latestSuccessfulSyncId") - ] = None - r"""Unique identifier for the most recent successful sync of data type.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DataStatus from a dict""" + if obj is None: + return None - latest_sync_id: Annotated[Optional[str], pydantic.Field(alias="latestSyncId")] = ( - None - ) - r"""Unique identifier for most recent sync of data type.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["lastSuccessfulSync", "latestSuccessfulSyncId", "latestSyncId"] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "dataType": obj.get("dataType"), + "lastSuccessfulSync": obj.get("lastSuccessfulSync"), + "currentStatus": obj.get("currentStatus"), + "latestSyncId": obj.get("latestSyncId"), + "latestSuccessfulSyncId": obj.get("latestSuccessfulSyncId") + }) + 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: - DataStatus.model_rebuild() -except NameError: - pass +class DataStatusTypedDict(TypedDict): + """TypedDict variant of DataStatus, for dict-literal request/response inputs.""" + data_type: NotRequired[DataTypes] + last_successful_sync: NotRequired[Optional[str]] + current_status: NotRequired[Status] + latest_sync_id: NotRequired[Optional[str]] + latest_successful_sync_id: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/datatype.py b/lending/src/codat_lending/models/shared/datatype.py index e0aff6fb8..0d8f5b076 100644 --- a/lending/src/codat_lending/models/shared/datatype.py +++ b/lending/src/codat_lending/models/shared/datatype.py @@ -1,52 +1,94 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/directcostlineitem.py b/lending/src/codat_lending/models/shared/directcostlineitem.py index 69fd8f5cd..b0c1c6278 100644 --- a/lending/src/codat_lending/models/shared/directcostlineitem.py +++ b/lending/src/codat_lending/models/shared/directcostlineitem.py @@ -1,234 +1,166 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict -from .taxrateref import TaxRateRef, TaxRateRefTypedDict -from .tracking import Tracking, TrackingTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class DirectCostLineItemTypedDict(TypedDict): - quantity: Decimal - r"""Number of units of goods or services received. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Note: If the platform does not provide this information, the quantity will be mapped as 1. - """ - unit_amount: Decimal - r"""Price of each unit of goods or services. - Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. - """ - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: NotRequired[Nullable[str]] - r"""Friendly name of the goods or services.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Discount amount for the line before tax.""" - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Discount percentage for the line before tax.""" - item_ref: NotRequired[PropertieItemRefTypedDict] - r"""Reference to the item the line is linked to.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""Amount of tax for the line.""" - tax_rate_ref: NotRequired[TaxRateRefTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""Total amount of the line, including tax.""" - tracking: NotRequired[TrackingTypedDict] - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Collection of categories against which this direct cost is tracked.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict +from codat_lending.models.shared.tracking import Tracking, TrackingTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class DirectCostLineItem(BaseModel): - quantity: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Number of units of goods or services received. - - Note: If the platform does not provide this information, the quantity will be mapped as 1. - """ - unit_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] - r"""Price of each unit of goods or services. - Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + DirectCostLineItem + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Friendly name of the goods or services.") + unit_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Price of each unit of goods or services. Note: If the platform does not provide this information, the unit amount will be mapped to the total amount.", alias="unitAmount") + quantity: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Number of units of goods or services received. Note: If the platform does not provide this information, the quantity will be mapped as 1.") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Discount amount for the line before tax.", alias="discountAmount") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Discount percentage for the line before tax.", alias="discountPercentage") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of the line, inclusive of discounts but exclusive of tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of tax for the line.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the line, including tax.", alias="totalAmount") + account_ref: Optional[AccountRef] = Field(default=None, description="Reference to the account to which the line item is linked.", alias="accountRef") + tax_rate_ref: Optional[TaxRateRef] = Field(default=None, description="Reference to the tax rate to which the the line item is linked.", alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, description="Reference to the product, service type, or inventory item to which the direct cost is linked.", alias="itemRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Collection of categories against which this direct cost is tracked.", alias="trackingCategoryRefs") + tracking: Optional[Tracking] = None + __properties: ClassVar[List[str]] = ["description", "unitAmount", "quantity", "discountAmount", "discountPercentage", "subTotal", "taxAmount", "totalAmount", "accountRef", "taxRateRef", "itemRef", "trackingCategoryRefs", "tracking"] - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - description: OptionalNullable[str] = UNSET - r"""Friendly name of the goods or services.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Discount amount for the line before tax.""" - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Discount percentage for the line before tax.""" - - item_ref: Annotated[Optional[PropertieItemRef], pydantic.Field(alias="itemRef")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Reference to the item the line is linked to.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""Amount of tax for the line.""" - - tax_rate_ref: Annotated[ - Optional[TaxRateRef], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""Total amount of the line, including tax.""" - tracking: Optional[Tracking] = None + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible.", - alias="trackingCategoryRefs", - ), - ] = UNSET - r"""Collection of categories against which this direct cost is tracked.""" + 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()) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "description", - "discountAmount", - "discountPercentage", - "itemRef", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "tracking", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - ] + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DirectCostLineItem 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, ) - 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: - DirectCostLineItem.model_rebuild() -except NameError: - pass + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DirectCostLineItem 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"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "discountAmount": obj.get("discountAmount"), + "discountPercentage": obj.get("discountPercentage"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "taxRateRef": TaxRateRef.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "tracking": Tracking.from_dict(obj["tracking"]) if obj.get("tracking") is not None else None + }) + return _obj + + + + + +class DirectCostLineItemTypedDict(TypedDict): + """TypedDict variant of DirectCostLineItem, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Decimal] + quantity: NotRequired[Decimal] + discount_amount: NotRequired[Optional[Decimal]] + discount_percentage: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + tax_rate_ref: NotRequired[Optional[TaxRateRefTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + tracking: NotRequired[Optional[TrackingTypedDict]] diff --git a/lending/src/codat_lending/models/shared/directcostprototype.py b/lending/src/codat_lending/models/shared/directcostprototype.py index 17eb4c975..4375f30bb 100644 --- a/lending/src/codat_lending/models/shared/directcostprototype.py +++ b/lending/src/codat_lending/models/shared/directcostprototype.py @@ -1,277 +1,163 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingpaymentallocation import ( - AccountingPaymentAllocation, - AccountingPaymentAllocationTypedDict, -) -from .contactref import ContactRef, ContactRefTypedDict -from .directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict -from .supplementaldata import SupplementalData, SupplementalDataTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 DirectCostPrototypeTypedDict(TypedDict): - 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. - """ - issue_date: 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. - """ - line_items: List[DirectCostLineItemTypedDict] - r"""An array of line items.""" - payment_allocations: List[AccountingPaymentAllocationTypedDict] - r"""An array of payment allocations.""" - sub_total: Decimal - r"""The total amount of the direct costs, excluding any taxes.""" - tax_amount: Decimal - r"""The total amount of tax on the direct costs.""" - total_amount: Decimal - r"""The amount of the direct costs, inclusive of tax.""" - contact_ref: NotRequired[ContactRefTypedDict] - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. +""" + Lending - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - note: NotRequired[Nullable[str]] - r"""A note attached to the direct cost.""" - reference: NotRequired[Nullable[str]] - r"""User-friendly reference for the direct cost.""" - 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingpaymentallocation import AccountingPaymentAllocation, AccountingPaymentAllocationTypedDict +from codat_lending.models.contact_ref import ContactRef, ContactRefTypedDict +from codat_lending.models.shared.directcostlineitem import DirectCostLineItem, DirectCostLineItemTypedDict +from codat_lending.models.shared.supplementaldata import SupplementalData, SupplementalDataTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class DirectCostPrototype(BaseModel): - 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. - """ - - issue_date: Annotated[str, pydantic.Field(alias="issueDate")] - 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 = {'currencyRate', 'currency_rate', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - line_items: Annotated[List[DirectCostLineItem], pydantic.Field(alias="lineItems")] - r"""An array of line items.""" - - payment_allocations: Annotated[ - List[AccountingPaymentAllocation], pydantic.Field(alias="paymentAllocations") - ] - r"""An array of payment allocations.""" - - sub_total: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] - r"""The total amount of the direct costs, excluding any taxes.""" - - tax_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] - r"""The total amount of tax on the direct costs.""" - - total_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] - r"""The amount of the direct costs, inclusive of tax.""" - - contact_ref: Annotated[Optional[ContactRef], pydantic.Field(alias="contactRef")] = ( - None + DirectCostPrototype + """ # noqa: E501 + reference: OptionalNullable[str] = Field(default=UNSET, description="User-friendly reference for the direct cost.") + note: OptionalNullable[str] = Field(default=UNSET, description="A note attached to the direct cost.") + contact_ref: Optional[ContactRef] = Field(default=None, description="A customer or supplier associated with the direct cost.", alias="contactRef") + issue_date: 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="issueDate") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + line_items: List[DirectCostLineItem] = Field(description="An array of line items.", alias="lineItems") + payment_allocations: List[AccountingPaymentAllocation] = Field(description="An array of payment allocations.", alias="paymentAllocations") + sub_total: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of the direct costs, excluding any taxes.", alias="subTotal") + tax_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The total amount of tax on the direct costs.", alias="taxAmount") + total_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The amount of the direct costs, inclusive of tax.", alias="totalAmount") + supplemental_data: Optional[SupplementalData] = Field(default=None, alias="supplementalData") + __properties: ClassVar[List[str]] = ["reference", "note", "contactRef", "issueDate", "currency", "currencyRate", "lineItems", "paymentAllocations", "subTotal", "taxAmount", "totalAmount", "supplementalData"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ## Examples with base currency of GBP + 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()) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DirectCostPrototype from a JSON string""" + return cls.from_dict(json.loads(json_str)) - ## Examples with base currency of USD + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - note: OptionalNullable[str] = UNSET - r"""A note attached to the direct cost.""" + * `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([ + ]) - reference: OptionalNullable[str] = UNSET - r"""User-friendly reference for the direct cost.""" - - supplemental_data: Annotated[ - Optional[SupplementalData], 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( - ["contactRef", "currencyRate", "note", "reference", "supplementalData"] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["currencyRate", "note", "reference"]) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of contact_ref + if self.contact_ref: + _dict['contactRef'] = self.contact_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in line_items (list) + _items = [] + if self.line_items: + for _item_line_items in self.line_items: + if _item_line_items: + _items.append(_item_line_items.to_dict()) + _dict['lineItems'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in payment_allocations (list) + _items = [] + if self.payment_allocations: + for _item_payment_allocations in self.payment_allocations: + if _item_payment_allocations: + _items.append(_item_payment_allocations.to_dict()) + _dict['paymentAllocations'] = _items + # 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 DirectCostPrototype from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reference": obj.get("reference"), + "note": obj.get("note"), + "contactRef": ContactRef.from_dict(obj["contactRef"]) if obj.get("contactRef") is not None else None, + "issueDate": obj.get("issueDate"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "lineItems": [DirectCostLineItem.from_dict(_item) for _item in obj["lineItems"]] if obj.get("lineItems") is not None else None, + "paymentAllocations": [AccountingPaymentAllocation.from_dict(_item) for _item in obj["paymentAllocations"]] if obj.get("paymentAllocations") is not None else None, + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "supplementalData": SupplementalData.from_dict(obj["supplementalData"]) if obj.get("supplementalData") 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 -try: - DirectCostPrototype.model_rebuild() -except NameError: - pass +class DirectCostPrototypeTypedDict(TypedDict): + """TypedDict variant of DirectCostPrototype, for dict-literal request/response inputs.""" + reference: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + contact_ref: NotRequired[Optional[ContactRefTypedDict]] + issue_date: NotRequired[str] + currency: NotRequired[str] + currency_rate: NotRequired[Optional[Decimal]] + line_items: NotRequired[List[DirectCostLineItemTypedDict]] + payment_allocations: NotRequired[List[AccountingPaymentAllocationTypedDict]] + sub_total: NotRequired[Decimal] + tax_amount: NotRequired[Decimal] + total_amount: NotRequired[Decimal] + supplemental_data: NotRequired[Optional[SupplementalDataTypedDict]] diff --git a/lending/src/codat_lending/models/shared/directincomelineitem.py b/lending/src/codat_lending/models/shared/directincomelineitem.py index 55f161e78..d8936eb63 100644 --- a/lending/src/codat_lending/models/shared/directincomelineitem.py +++ b/lending/src/codat_lending/models/shared/directincomelineitem.py @@ -1,230 +1,159 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .accountref import AccountRef, AccountRefTypedDict -from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict -from .taxrateref import TaxRateRef, TaxRateRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class DirectIncomeLineItem(BaseModel): + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + DirectIncomeLineItem + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="A user-friendly name of the goods or services.") + unit_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The price of each unit of goods or services. Note: If the platform does not provide this information, the unit amount will be mapped to the total amount.", alias="unitAmount") + quantity: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="The number of units of goods or services received. Note: If the platform does not provide this information, the quantity will be mapped as 1.") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Discount amount for the line before tax.", alias="discountAmount") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Discount percentage for the line before tax.", alias="discountPercentage") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The amount of the line, inclusive of discounts, but exclusive of tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The amount of tax for the line. Note: If the platform does not provide this information, the quantity will be mapped as 0.00.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The total amount of the line, including tax.", alias="totalAmount") + account_ref: Optional[AccountRef] = Field(default=None, description="Reference to the account to which the line item is linked.", alias="accountRef") + tax_rate_ref: Optional[TaxRateRef] = Field(default=None, description="Reference to the tax rate to which the line item is linked.", alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, description="Reference to the product, service type, or inventory item to which the direct cost is linked.", alias="itemRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="An array of categories against which this direct cost is tracked.", alias="trackingCategoryRefs") + __properties: ClassVar[List[str]] = ["description", "unitAmount", "quantity", "discountAmount", "discountPercentage", "subTotal", "taxAmount", "totalAmount", "accountRef", "taxRateRef", "itemRef", "trackingCategoryRefs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class DirectIncomeLineItemTypedDict(TypedDict): - quantity: Decimal - r"""The number of units of goods or services received. - Note: If the platform does not provide this information, the quantity will be mapped as 1. - """ - unit_amount: Decimal - r"""The price of each unit of goods or services. - Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. - """ - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: NotRequired[Nullable[str]] - r"""A user-friendly name of the goods or services.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Discount amount for the line before tax.""" - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Discount percentage for the line before tax.""" - item_ref: NotRequired[PropertieItemRefTypedDict] - r"""Reference to the item the line is linked to.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""The amount of the line, inclusive of discounts, but exclusive of tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""The amount of tax for the line. - Note: If the platform does not provide this information, the quantity will be mapped as 0.00. - """ - tax_rate_ref: NotRequired[TaxRateRefTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Found on: + 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()) - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""The total amount of the line, including tax.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""An array of categories against which this direct cost is tracked.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DirectIncomeLineItem 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 DirectIncomeLineItem(BaseModel): - quantity: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""The number of units of goods or services received. - - Note: If the platform does not provide this information, the quantity will be mapped as 1. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - unit_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] - r"""The price of each unit of goods or services. - Note: If the platform does not provide this information, the unit amount will be mapped to the total amount. - """ + * `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([ + ]) - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - description: OptionalNullable[str] = UNSET - r"""A user-friendly name of the goods or services.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Discount amount for the line before tax.""" - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Discount percentage for the line before tax.""" - - item_ref: Annotated[Optional[PropertieItemRef], pydantic.Field(alias="itemRef")] = ( - None - ) - r"""Reference to the item the line is linked to.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""The amount of the line, inclusive of discounts, but exclusive of tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""The amount of tax for the line. - Note: If the platform does not provide this information, the quantity will be mapped as 0.00. - """ + _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_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DirectIncomeLineItem 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"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "discountAmount": obj.get("discountAmount"), + "discountPercentage": obj.get("discountPercentage"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "taxRateRef": TaxRateRef.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None + }) + return _obj - tax_rate_ref: Annotated[ - Optional[TaxRateRef], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - Found on: - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""The total amount of the line, including tax.""" - - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field(alias="trackingCategoryRefs"), - ] = UNSET - r"""An array of categories against which this direct cost is tracked.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "description", - "discountAmount", - "discountPercentage", - "itemRef", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - ] - ) - 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: - DirectIncomeLineItem.model_rebuild() -except NameError: - pass +class DirectIncomeLineItemTypedDict(TypedDict): + """TypedDict variant of DirectIncomeLineItem, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Decimal] + quantity: NotRequired[Decimal] + discount_amount: NotRequired[Optional[Decimal]] + discount_percentage: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + tax_rate_ref: NotRequired[Optional[TaxRateRefTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/disputestatus.py b/lending/src/codat_lending/models/shared/disputestatus.py index 30201cb72..bb80187ef 100644 --- a/lending/src/codat_lending/models/shared/disputestatus.py +++ b/lending/src/codat_lending/models/shared/disputestatus.py @@ -1,20 +1,47 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 DisputeStatus(str, Enum): - r"""Current status of the dispute""" - - WON = "Won" - LOST = "Lost" - ACCEPTED = "Accepted" - PROCESSING = "Processing" - CHARGE_REFUNDED = "ChargeRefunded" - EVIDENCE_REQUIRED = "EvidenceRequired" - INQUIRY_EVIDENCE_REQUIRED = "InquiryEvidenceRequired" - INQUIRY_PROCESSING = "InquiryProcessing" - INQUIRY_CLOSED = "InquiryClosed" - WAITING_THIRD_PARTY = "WaitingThirdParty" - UNKNOWN = "Unknown" + """ + Current status of the dispute + """ + + """ + allowed enum values + """ + WON = 'Won' + LOST = 'Lost' + ACCEPTED = 'Accepted' + PROCESSING = 'Processing' + CHARGE_REFUNDED = 'ChargeRefunded' + EVIDENCE_REQUIRED = 'EvidenceRequired' + INQUIRY_EVIDENCE_REQUIRED = 'InquiryEvidenceRequired' + INQUIRY_PROCESSING = 'InquiryProcessing' + INQUIRY_CLOSED = 'InquiryClosed' + WAITING_THIRD_PARTY = 'WaitingThirdParty' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of DisputeStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/enduploadsessionrequest.py b/lending/src/codat_lending/models/shared/enduploadsessionrequest.py index 9f0172026..b836b3e04 100644 --- a/lending/src/codat_lending/models/shared/enduploadsessionrequest.py +++ b/lending/src/codat_lending/models/shared/enduploadsessionrequest.py @@ -1,41 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from enum import Enum -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class EndUploadSessionRequestStatus(str, Enum): - r"""An indicator to cancel the dataset processing or trigger ingestion and enrichment of data.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - CANCEL = "Cancel" - PROCESS = "Process" + Do not edit the class manually. +""" # noqa: E501 -class EndUploadSessionRequestTypedDict(TypedDict): - status: NotRequired[EndUploadSessionRequestStatus] - r"""An indicator to cancel the dataset processing or trigger ingestion and enrichment of data.""" +from __future__ import annotations +from codat_lending.models.end_upload_session_request_status import EndUploadSessionRequestStatus +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 EndUploadSessionRequest(BaseModel): - status: Optional[EndUploadSessionRequestStatus] = None - r"""An indicator to cancel the dataset processing or trigger ingestion and enrichment of data.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["status"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + EndUploadSessionRequest + """ # noqa: E501 + status: Optional[EndUploadSessionRequestStatus] = Field(default=None, description="An indicator to cancel the dataset processing or trigger ingestion and enrichment of data.") + __properties: ClassVar[List[str]] = ["status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Cancel', 'Process']): + raise ValueError("must be one of enum values ('Cancel', 'Process')") + 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 EndUploadSessionRequest 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 EndUploadSessionRequest 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") + }) + return _obj + + + + + +class EndUploadSessionRequestTypedDict(TypedDict): + """TypedDict variant of EndUploadSessionRequest, for dict-literal request/response inputs.""" + status: NotRequired[Optional[EndUploadSessionRequestStatus]] diff --git a/lending/src/codat_lending/models/shared/enhancedcashflowitem.py b/lending/src/codat_lending/models/shared/enhancedcashflowitem.py index 5d79e5ace..3bd7888f2 100644 --- a/lending/src/codat_lending/models/shared/enhancedcashflowitem.py +++ b/lending/src/codat_lending/models/shared/enhancedcashflowitem.py @@ -1,258 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .sourceref import SourceRef, SourceRefTypedDict -from .transactioncategory import TransactionCategory, TransactionCategoryTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 CashFlowTransactionTypedDict(TypedDict): - account_ref: NotRequired[AccountRefTypedDict] - r"""An account reference containing the account id and name.""" - amount: NotRequired[Decimal] - r"""The bank transaction amount.""" - counterparty_names: NotRequired[List[str]] - r"""An array of counterparty names involved in the transaction.""" - 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. - """ - 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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - description: NotRequired[str] - r"""The description of the bank transaction.""" - id: NotRequired[str] - r"""The unique identifier of the bank transaction.""" - is_recurring: NotRequired[Nullable[bool]] - r"""Indicates if the transaction is classified as recurring by Codat's categorization engine.""" - 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 - ``` + 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_lending.models.cash_flow_transaction import CashFlowTransaction, CashFlowTransactionTypedDict +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 EnhancedCashFlowItem(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} """ - platform_name: NotRequired[str] - r"""Returns the payment processor responsible for the transaction.""" - source_ref: NotRequired[SourceRefTypedDict] - r"""A source reference containing the `sourceType` object \"Banking\".""" - transaction_category: NotRequired[TransactionCategoryTypedDict] - - -class CashFlowTransaction(BaseModel): - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None + EnhancedCashFlowItem + """ # noqa: E501 + transactions: Optional[List[CashFlowTransaction]] = Field(default=None, description="An array of transaction data.") + __properties: ClassVar[List[str]] = ["transactions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""An account reference containing the account id and name.""" - - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The bank transaction amount.""" - - counterparty_names: Annotated[ - Optional[List[str]], pydantic.Field(alias="counterpartyNames") - ] = None - r"""An array of counterparty names involved in the transaction.""" - - 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. - """ - - 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: - ``` - 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 EnhancedCashFlowItem 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. - """ - - description: Optional[str] = None - r"""The description of the bank transaction.""" - - id: Optional[str] = None - r"""The unique identifier of the bank transaction.""" - - is_recurring: Annotated[ - OptionalNullable[bool], pydantic.Field(alias="isRecurring") - ] = UNSET - r"""Indicates if the transaction is classified as recurring by Codat's categorization engine.""" - - 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. - """ - - platform_name: Annotated[Optional[str], pydantic.Field(alias="platformName")] = None - r"""Returns the payment processor responsible for the transaction.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - source_ref: Annotated[Optional[SourceRef], pydantic.Field(alias="sourceRef")] = None - r"""A source reference containing the `sourceType` object \"Banking\".""" + * `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([ + ]) - transaction_category: Annotated[ - Optional[TransactionCategory], pydantic.Field(alias="transactionCategory") - ] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "amount", - "counterpartyNames", - "currency", - "date", - "description", - "id", - "isRecurring", - "modifiedDate", - "platformName", - "sourceRef", - "transactionCategory", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - nullable_fields = set(["isRecurring"]) - serialized = handler(self) - m = {} + # 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 - 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 - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedCashFlowItem from a dict""" + if obj is None: + return None - if val != UNSET_SENTINEL: - if ( - val is not None - or k not in optional_fields - or is_nullable_and_explicitly_set - ): - m[k] = val + if not isinstance(obj, dict): + return cls.model_validate(obj) - return m + _obj = cls.model_validate({ + "transactions": [CashFlowTransaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None + }) + return _obj -class EnhancedCashFlowItemTypedDict(TypedDict): - transactions: NotRequired[List[CashFlowTransactionTypedDict]] - r"""An array of transaction data.""" -class EnhancedCashFlowItem(BaseModel): - transactions: Optional[List[CashFlowTransaction]] = None - r"""An array of transaction data.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["transactions"]) - 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: - CashFlowTransaction.model_rebuild() -except NameError: - pass +class EnhancedCashFlowItemTypedDict(TypedDict): + """TypedDict variant of EnhancedCashFlowItem, for dict-literal request/response inputs.""" + transactions: NotRequired[Optional[List[CashFlowTransactionTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/enhancedcashflowtransactions.py b/lending/src/codat_lending/models/shared/enhancedcashflowtransactions.py index 2b4ef2627..cff6b885d 100644 --- a/lending/src/codat_lending/models/shared/enhancedcashflowtransactions.py +++ b/lending/src/codat_lending/models/shared/enhancedcashflowtransactions.py @@ -1,69 +1,125 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .datasource import DataSource, DataSourceTypedDict -from .enhancedcashflowitem import EnhancedCashFlowItem, EnhancedCashFlowItemTypedDict -from .reportinfo import ReportInfo, ReportInfoTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class EnhancedCashFlowTransactionsTypedDict(TypedDict): - r"""> **Categorization engine** - > - > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. - """ + Do not edit the class manually. +""" # noqa: E501 - data_sources: NotRequired[List[DataSourceTypedDict]] - report_info: NotRequired[ReportInfoTypedDict] - r"""Report additional information, which is specific to Lending reports.""" - report_items: NotRequired[List[EnhancedCashFlowItemTypedDict]] +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_lending.models.shared.datasource import DataSource, DataSourceTypedDict +from codat_lending.models.shared.enhancedcashflowitem import EnhancedCashFlowItem, EnhancedCashFlowItemTypedDict +from codat_lending.models.shared.reportinfo import ReportInfo, ReportInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class EnhancedCashFlowTransactions(BaseModel): - r"""> **Categorization engine** - > - > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. - The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. + @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} """ - - data_sources: Annotated[ - Optional[List[DataSource]], pydantic.Field(alias="dataSources") - ] = None - - report_info: Annotated[Optional[ReportInfo], pydantic.Field(alias="reportInfo")] = ( - None + > **Categorization engine** > > The categorization engine uses machine learning and has been fully trained against Plaid and TrueLayer banking data sources. It is not fully trained against the Basiq banking data source. The Enhanced Cash Flow Transactions endpoint provides a fully categorized list of banking transactions for a company. Accounts and transaction data are obtained from the company's banking data sources. + """ # noqa: E501 + report_info: Optional[ReportInfo] = Field(default=None, alias="reportInfo") + data_sources: Optional[List[DataSource]] = Field(default=None, alias="dataSources") + report_items: Optional[List[EnhancedCashFlowItem]] = Field(default=None, alias="reportItems") + __properties: ClassVar[List[str]] = ["reportInfo", "dataSources", "reportItems"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Report additional information, which is specific to Lending reports.""" - report_items: Annotated[ - Optional[List[EnhancedCashFlowItem]], pydantic.Field(alias="reportItems") - ] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataSources", "reportInfo", "reportItems"]) - serialized = handler(self) - 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()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EnhancedCashFlowTransactions 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 report_info + if self.report_info: + _dict['reportInfo'] = self.report_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data_sources (list) + _items = [] + if self.data_sources: + for _item_data_sources in self.data_sources: + if _item_data_sources: + _items.append(_item_data_sources.to_dict()) + _dict['dataSources'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in report_items (list) + _items = [] + if self.report_items: + for _item_report_items in self.report_items: + if _item_report_items: + _items.append(_item_report_items.to_dict()) + _dict['reportItems'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedCashFlowTransactions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reportInfo": ReportInfo.from_dict(obj["reportInfo"]) if obj.get("reportInfo") is not None else None, + "dataSources": [DataSource.from_dict(_item) for _item in obj["dataSources"]] if obj.get("dataSources") is not None else None, + "reportItems": [EnhancedCashFlowItem.from_dict(_item) for _item in obj["reportItems"]] if obj.get("reportItems") 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: - EnhancedCashFlowTransactions.model_rebuild() -except NameError: - pass +class EnhancedCashFlowTransactionsTypedDict(TypedDict): + """TypedDict variant of EnhancedCashFlowTransactions, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[ReportInfoTypedDict]] + data_sources: NotRequired[Optional[List[DataSourceTypedDict]]] + report_items: NotRequired[Optional[List[EnhancedCashFlowItemTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/enhancedfinancialreport.py b/lending/src/codat_lending/models/shared/enhancedfinancialreport.py index a3cb6d4e2..ef320ed0e 100644 --- a/lending/src/codat_lending/models/shared/enhancedfinancialreport.py +++ b/lending/src/codat_lending/models/shared/enhancedfinancialreport.py @@ -1,150 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .enhancedreportaccountcategory import ( - EnhancedReportAccountCategory, - EnhancedReportAccountCategoryTypedDict, -) -from .enhancedreportinfo import EnhancedReportInfo, EnhancedReportInfoTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 ReportItemTypedDict(TypedDict): - account_category: NotRequired[EnhancedReportAccountCategoryTypedDict] - account_id: NotRequired[str] - r"""The unique account ID.""" - account_name: NotRequired[str] - r"""Name of the account.""" - balance: NotRequired[Decimal] - r"""Balance of the account as reported on the profit and loss or Balance sheet.""" - date_: NotRequired[str] - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ - - -class ReportItem(BaseModel): - account_category: Annotated[ - Optional[EnhancedReportAccountCategory], pydantic.Field(alias="accountCategory") - ] = None - - account_id: Annotated[Optional[str], pydantic.Field(alias="accountId")] = None - r"""The unique account ID.""" - - account_name: Annotated[Optional[str], pydantic.Field(alias="accountName")] = None - r"""Name of the account.""" +""" + Lending - balance: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Balance of the account as reported on the profit and loss or Balance sheet.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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: + 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: - - - 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 pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.enhancedreportinfo import EnhancedReportInfo, EnhancedReportInfoTypedDict +from codat_lending.models.report_item import ReportItem, ReportItemTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ +class EnhancedFinancialReport(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["accountCategory", "accountId", "accountName", "balance", "date"] - ) + 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)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class EnhancedFinancialReportTypedDict(TypedDict): - report_info: NotRequired[EnhancedReportInfoTypedDict] - report_items: NotRequired[List[ReportItemTypedDict]] - r"""An array of report items.""" - + return {k: v for k, v in serialized.items() if v is not None} + """ + EnhancedFinancialReport + """ # noqa: E501 + report_info: Optional[EnhancedReportInfo] = Field(default=None, alias="reportInfo") + report_items: Optional[List[ReportItem]] = Field(default=None, description="An array of report items.", alias="reportItems") + __properties: ClassVar[List[str]] = ["reportInfo", "reportItems"] + + 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 EnhancedFinancialReport 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 report_info + if self.report_info: + _dict['reportInfo'] = self.report_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in report_items (list) + _items = [] + if self.report_items: + for _item_report_items in self.report_items: + if _item_report_items: + _items.append(_item_report_items.to_dict()) + _dict['reportItems'] = _items + return _dict -class EnhancedFinancialReport(BaseModel): - report_info: Annotated[ - Optional[EnhancedReportInfo], pydantic.Field(alias="reportInfo") - ] = None + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedFinancialReport from a dict""" + if obj is None: + return None - report_items: Annotated[ - Optional[List[ReportItem]], pydantic.Field(alias="reportItems") - ] = None - r"""An array of report items.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["reportInfo", "reportItems"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "reportInfo": EnhancedReportInfo.from_dict(obj["reportInfo"]) if obj.get("reportInfo") is not None else None, + "reportItems": [ReportItem.from_dict(_item) for _item in obj["reportItems"]] if obj.get("reportItems") 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: - ReportItem.model_rebuild() -except NameError: - pass -try: - EnhancedFinancialReport.model_rebuild() -except NameError: - pass +class EnhancedFinancialReportTypedDict(TypedDict): + """TypedDict variant of EnhancedFinancialReport, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[EnhancedReportInfoTypedDict]] + report_items: NotRequired[Optional[List[ReportItemTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/enhancedinvoicereportitem.py b/lending/src/codat_lending/models/shared/enhancedinvoicereportitem.py index f474bb1b5..e63aafa9e 100644 --- a/lending/src/codat_lending/models/shared/enhancedinvoicereportitem.py +++ b/lending/src/codat_lending/models/shared/enhancedinvoicereportitem.py @@ -1,277 +1,150 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .invoicestatus import InvoiceStatus -from .lendingcustomerref import LendingCustomerRef, LendingCustomerRefTypedDict -from .payment import Payment, PaymentTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 EnhancedInvoiceReportItemTypedDict(TypedDict): - amount_due: NotRequired[Decimal] - r"""Invoice's total amount due.""" - 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. - """ - customer_ref: NotRequired[LendingCustomerRefTypedDict] - due_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. - """ - id: NotRequired[str] - r"""ID of the invoice, which may be a GUID but it may be something else depending on the accounting software.""" - invoice_number: NotRequired[str] - r"""Invoice number.""" - issue_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - modified_date: NotRequired[str] - paid_on_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. - """ - payments: NotRequired[List[PaymentTypedDict]] - source_modified_date: NotRequired[str] - status: NotRequired[InvoiceStatus] - r"""Current state of the invoice: - - - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. - """ - total_amount: NotRequired[Decimal] - r"""Invoice's total amount.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.invoicestatus import InvoiceStatus +from codat_lending.models.shared.lendingcustomerref import LendingCustomerRef, LendingCustomerRefTypedDict +from codat_lending.models.shared.payment import Payment, PaymentTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class EnhancedInvoiceReportItem(BaseModel): - amount_due: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="amountDue"), - ] = None - r"""Invoice's total amount due.""" - - 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. - """ - - customer_ref: Annotated[ - Optional[LendingCustomerRef], pydantic.Field(alias="customerRef") - ] = None - - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + EnhancedInvoiceReportItem + """ # noqa: E501 + 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") + id: Optional[str] = Field(default=None, description="ID of the invoice, which may be a GUID but it may be something else depending on the accounting software.") + invoice_number: Optional[str] = Field(default=None, description="Invoice number.", alias="invoiceNumber") + customer_ref: Optional[LendingCustomerRef] = Field(default=None, alias="customerRef") + issue_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="issueDate") + due_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="dueDate") + status: Optional[InvoiceStatus] = None + 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.") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Invoice's total amount.", alias="totalAmount") + amount_due: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Invoice's total amount due.", alias="amountDue") + payments: Optional[List[Payment]] = None + paid_on_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="paidOnDate") + __properties: ClassVar[List[str]] = ["modifiedDate", "sourceModifiedDate", "id", "invoiceNumber", "customerRef", "issueDate", "dueDate", "status", "currency", "totalAmount", "amountDue", "payments", "paidOnDate"] - id: Optional[str] = None - r"""ID of the invoice, which may be a GUID but it may be something else depending on the accounting software.""" - - invoice_number: Annotated[Optional[str], pydantic.Field(alias="invoiceNumber")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Invoice number.""" - - issue_date: Annotated[Optional[str], pydantic.Field(alias="issueDate")] = 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. - """ - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - - paid_on_date: Annotated[Optional[str], pydantic.Field(alias="paidOnDate")] = 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 - ``` + 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 EnhancedInvoiceReportItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - - 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. - """ - - payments: Optional[List[Payment]] = None + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + * `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([ + ]) - status: Optional[InvoiceStatus] = None - r"""Current state of the invoice: - - - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. - """ - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Invoice's total amount.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amountDue", - "currency", - "customerRef", - "dueDate", - "id", - "invoiceNumber", - "issueDate", - "modifiedDate", - "paidOnDate", - "payments", - "sourceModifiedDate", - "status", - "totalAmount", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of customer_ref + if self.customer_ref: + _dict['customerRef'] = self.customer_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in payments (list) + _items = [] + if self.payments: + for _item_payments in self.payments: + if _item_payments: + _items.append(_item_payments.to_dict()) + _dict['payments'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedInvoiceReportItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "id": obj.get("id"), + "invoiceNumber": obj.get("invoiceNumber"), + "customerRef": LendingCustomerRef.from_dict(obj["customerRef"]) if obj.get("customerRef") is not None else None, + "issueDate": obj.get("issueDate"), + "dueDate": obj.get("dueDate"), + "status": obj.get("status"), + "currency": obj.get("currency"), + "totalAmount": obj.get("totalAmount"), + "amountDue": obj.get("amountDue"), + "payments": [Payment.from_dict(_item) for _item in obj["payments"]] if obj.get("payments") is not None else None, + "paidOnDate": obj.get("paidOnDate") + }) + 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: - EnhancedInvoiceReportItem.model_rebuild() -except NameError: - pass +class EnhancedInvoiceReportItemTypedDict(TypedDict): + """TypedDict variant of EnhancedInvoiceReportItem, for dict-literal request/response inputs.""" + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + invoice_number: NotRequired[Optional[str]] + customer_ref: NotRequired[Optional[LendingCustomerRefTypedDict]] + issue_date: NotRequired[Optional[str]] + due_date: NotRequired[Optional[str]] + status: NotRequired[Optional[InvoiceStatus]] + currency: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] + amount_due: NotRequired[Optional[Decimal]] + payments: NotRequired[Optional[List[PaymentTypedDict]]] + paid_on_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/enhancedinvoicesreport.py b/lending/src/codat_lending/models/shared/enhancedinvoicesreport.py index f9765ef11..722c31b76 100644 --- a/lending/src/codat_lending/models/shared/enhancedinvoicesreport.py +++ b/lending/src/codat_lending/models/shared/enhancedinvoicesreport.py @@ -1,57 +1,115 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .enhancedinvoicereportitem import ( - EnhancedInvoiceReportItem, - EnhancedInvoiceReportItemTypedDict, -) -from .reportinfo import ReportInfo, ReportInfoTypedDict -from codat_lending.types import BaseModel, Nullable, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class EnhancedInvoicesReportTypedDict(TypedDict): - r"""The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting software have actually been paid by matching with the bank statement.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - report_info: NotRequired[ReportInfoTypedDict] - r"""Report additional information, which is specific to Lending reports.""" - report_items: NotRequired[List[Nullable[EnhancedInvoiceReportItemTypedDict]]] + Do not edit the class manually. +""" # noqa: E501 -class EnhancedInvoicesReport(BaseModel): - r"""The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting software have actually been paid by matching with the bank statement.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - report_info: Annotated[Optional[ReportInfo], pydantic.Field(alias="reportInfo")] = ( - None - ) - r"""Report additional information, which is specific to Lending reports.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.enhancedinvoicereportitem import EnhancedInvoiceReportItem, EnhancedInvoiceReportItemTypedDict +from codat_lending.models.shared.reportinfo import ReportInfo, ReportInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - report_items: Annotated[ - Optional[List[Nullable[EnhancedInvoiceReportItem]]], - pydantic.Field(alias="reportItems"), - ] = None +from codat_lending.types import Nullable +class EnhancedInvoicesReport(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["reportInfo", "reportItems"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The enhanced invoices report takes the key elements of the Invoices report verifying those marked as paid in the accounting software have actually been paid by matching with the bank statement. + """ # noqa: E501 + report_info: Optional[ReportInfo] = Field(default=None, alias="reportInfo") + report_items: Optional[List[Nullable[EnhancedInvoiceReportItem]]] = Field(default=None, alias="reportItems") + __properties: ClassVar[List[str]] = ["reportInfo", "reportItems"] + + 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 EnhancedInvoicesReport 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: - EnhancedInvoicesReport.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 report_info + if self.report_info: + _dict['reportInfo'] = self.report_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in report_items (list) + _items = [] + if self.report_items: + for _item_report_items in self.report_items: + if _item_report_items: + _items.append(_item_report_items.to_dict()) + _dict['reportItems'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedInvoicesReport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reportInfo": ReportInfo.from_dict(obj["reportInfo"]) if obj.get("reportInfo") is not None else None, + "reportItems": [EnhancedInvoiceReportItem.from_dict(_item) for _item in obj["reportItems"]] if obj.get("reportItems") is not None else None + }) + return _obj + + + + + +class EnhancedInvoicesReportTypedDict(TypedDict): + """TypedDict variant of EnhancedInvoicesReport, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[ReportInfoTypedDict]] + report_items: NotRequired[Optional[List[Nullable[EnhancedInvoiceReportItemTypedDict]]]] diff --git a/lending/src/codat_lending/models/shared/enhancedreportaccountcategory.py b/lending/src/codat_lending/models/shared/enhancedreportaccountcategory.py index 271e65a0e..e0d18e1d8 100644 --- a/lending/src/codat_lending/models/shared/enhancedreportaccountcategory.py +++ b/lending/src/codat_lending/models/shared/enhancedreportaccountcategory.py @@ -1,37 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountcategorylevel import AccountCategoryLevel, AccountCategoryLevelTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class EnhancedReportAccountCategoryTypedDict(TypedDict): - levels: NotRequired[List[AccountCategoryLevelTypedDict]] - status: NotRequired[str] - r"""Returns a status of \"Suggested\" or \"Confirmed\". If an account has a confirmed category, it will replace any suggested category returned.""" + 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 EnhancedReportAccountCategory(BaseModel): - levels: Optional[List[AccountCategoryLevel]] = None - status: Optional[str] = None - r"""Returns a status of \"Suggested\" or \"Confirmed\". If an account has a confirmed category, it will replace any suggested category returned.""" +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_lending.models.shared.accountcategorylevel import AccountCategoryLevel, AccountCategoryLevelTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class EnhancedReportAccountCategory(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["levels", "status"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + EnhancedReportAccountCategory + """ # noqa: E501 + status: Optional[str] = Field(default=None, description="Returns a status of \"Suggested\" or \"Confirmed\". If an account has a confirmed category, it will replace any suggested category returned.") + levels: Optional[List[AccountCategoryLevel]] = None + __properties: ClassVar[List[str]] = ["status", "levels"] + + 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 EnhancedReportAccountCategory 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)`: + + * `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 levels (list) + _items = [] + if self.levels: + for _item_levels in self.levels: + if _item_levels: + _items.append(_item_levels.to_dict()) + _dict['levels'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnhancedReportAccountCategory 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"), + "levels": [AccountCategoryLevel.from_dict(_item) for _item in obj["levels"]] if obj.get("levels") is not None else None + }) + return _obj + + + + + +class EnhancedReportAccountCategoryTypedDict(TypedDict): + """TypedDict variant of EnhancedReportAccountCategory, for dict-literal request/response inputs.""" + status: NotRequired[Optional[str]] + levels: NotRequired[Optional[List[AccountCategoryLevelTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/enhancedreportinfo.py b/lending/src/codat_lending/models/shared/enhancedreportinfo.py index 04dbcb029..d22d8ee43 100644 --- a/lending/src/codat_lending/models/shared/enhancedreportinfo.py +++ b/lending/src/codat_lending/models/shared/enhancedreportinfo.py @@ -1,111 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class EnhancedReportInfoTypedDict(TypedDict): - company_name: NotRequired[str] - r"""Name of the company queried.""" - 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. - """ - generated_date: NotRequired[str] - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - report_name: NotRequired[str] - r"""The name of the report.""" +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 EnhancedReportInfo(BaseModel): - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""Name of the company queried.""" - - 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) + return {k: v for k, v in serialized.items() if v is not None} """ - - generated_date: Annotated[Optional[str], pydantic.Field(alias="generatedDate")] = ( - None + EnhancedReportInfo + """ # noqa: E501 + 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.") + report_name: Optional[str] = Field(default=None, description="The name of the report.", alias="reportName") + company_name: Optional[str] = Field(default=None, description="Name of the company queried.", alias="companyName") + 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") + __properties: ClassVar[List[str]] = ["currency", "reportName", "companyName", "generatedDate"] + + 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 EnhancedReportInfo 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)`: - report_name: Annotated[Optional[str], pydantic.Field(alias="reportName")] = None - r"""The name of the report.""" + * `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( - ["companyName", "currency", "generatedDate", "reportName"] + _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 EnhancedReportInfo from a dict""" + if obj is None: + return None - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + _obj = cls.model_validate({ + "currency": obj.get("currency"), + "reportName": obj.get("reportName"), + "companyName": obj.get("companyName"), + "generatedDate": obj.get("generatedDate") + }) + return _obj - return m -try: - EnhancedReportInfo.model_rebuild() -except NameError: - pass + + +class EnhancedReportInfoTypedDict(TypedDict): + """TypedDict variant of EnhancedReportInfo, for dict-literal request/response inputs.""" + currency: NotRequired[Optional[str]] + report_name: NotRequired[Optional[str]] + company_name: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/errorvalidation.py b/lending/src/codat_lending/models/shared/errorvalidation.py index 9e57b5a02..8d1357bee 100644 --- a/lending/src/codat_lending/models/shared/errorvalidation.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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_lending.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/lending/src/codat_lending/models/shared/errorvalidationitem.py b/lending/src/codat_lending/models/shared/errorvalidationitem.py index 5f2395538..380cb9d86 100644 --- a/lending/src/codat_lending/models/shared/errorvalidationitem.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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/lending/src/codat_lending/models/shared/excelreporttypes.py b/lending/src/codat_lending/models/shared/excelreporttypes.py index 8b114a187..b402c5e70 100644 --- a/lending/src/codat_lending/models/shared/excelreporttypes.py +++ b/lending/src/codat_lending/models/shared/excelreporttypes.py @@ -1,13 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ExcelReportTypes(str, Enum): - r"""The type of the report requested in the query string.""" + """ + The type of the report requested in the query string. + """ + + """ + allowed enum values + """ + AUDIT = 'audit' + ENHANCED_FINANCIALS = 'enhancedFinancials' + ENHANCED_INVOICES = 'enhancedInvoices' + ENHANCED_CASH_FLOW = 'enhancedCashFlow' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ExcelReportTypes from a JSON string""" + return cls(json.loads(json_str)) + - AUDIT = "audit" - ENHANCED_FINANCIALS = "enhancedFinancials" - ENHANCED_INVOICES = "enhancedInvoices" - ENHANCED_CASH_FLOW = "enhancedCashFlow" diff --git a/lending/src/codat_lending/models/shared/excelstatus.py b/lending/src/codat_lending/models/shared/excelstatus.py index 41b110546..2c9c25905 100644 --- a/lending/src/codat_lending/models/shared/excelstatus.py +++ b/lending/src/codat_lending/models/shared/excelstatus.py @@ -1,148 +1,126 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .excelreporttypes import ExcelReportTypes -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ExcelStatusTypedDict(TypedDict): - error_message: NotRequired[str] - r"""Error details in case the report generation request was unsuccessful.""" - file_size: NotRequired[Nullable[int]] - r"""The file size in Bytes is populated upon successful generation of the report.""" - in_progress: NotRequired[bool] - r"""When true, the request was successful and the report is being generated. If false, the request was unsuccessful and the report is not being generated.""" - last_generated: 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_lending.models.shared.excelreporttypes import ExcelReportTypes +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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ExcelStatus(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 = {'fileSize', 'file_size'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - last_invocation_id: NotRequired[str] - r"""A unique ID generated for this request.""" - queued: NotRequired[str] - r"""The date and time of when a successful request was queued for the most recent report.""" - report_type: NotRequired[ExcelReportTypes] - r"""The type of the report requested in the query string.""" - success: NotRequired[bool] - r"""True if the requested report was successfully queued and false if the requested report was not able to be queued.""" + ExcelStatus + """ # noqa: E501 + last_generated: 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="lastGenerated") + in_progress: Optional[bool] = Field(default=None, description="When true, the request was successful and the report is being generated. If false, the request was unsuccessful and the report is not being generated.", alias="inProgress") + queued: Optional[str] = Field(default=None, description="The date and time of when a successful request was queued for the most recent report.") + success: Optional[bool] = Field(default=None, description="True if the requested report was successfully queued and false if the requested report was not able to be queued.") + error_message: Optional[str] = Field(default=None, description="Error details in case the report generation request was unsuccessful.", alias="errorMessage") + last_invocation_id: Optional[str] = Field(default=None, description="A unique ID generated for this request.", alias="lastInvocationId") + report_type: Optional[ExcelReportTypes] = Field(default=None, alias="reportType") + file_size: OptionalNullable[int] = Field(default=UNSET, description="The file size in Bytes is populated upon successful generation of the report.", alias="fileSize") + __properties: ClassVar[List[str]] = ["lastGenerated", "inProgress", "queued", "success", "errorMessage", "lastInvocationId", "reportType", "fileSize"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class ExcelStatus(BaseModel): - error_message: Annotated[Optional[str], pydantic.Field(alias="errorMessage")] = None - r"""Error details in case the report generation request was unsuccessful.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - file_size: Annotated[OptionalNullable[int], pydantic.Field(alias="fileSize")] = ( - UNSET - ) - r"""The file size in Bytes is populated upon successful generation of the report.""" + 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_progress: Annotated[Optional[bool], pydantic.Field(alias="inProgress")] = None - r"""When true, the request was successful and the report is being generated. If false, the request was unsuccessful and the report is not being generated.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExcelStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) - last_generated: Annotated[Optional[str], pydantic.Field(alias="lastGenerated")] = ( - 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_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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 - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExcelStatus from a dict""" + if obj is None: + return None - - 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` + if not isinstance(obj, dict): + return cls.model_validate(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. - """ + _obj = cls.model_validate({ + "lastGenerated": obj.get("lastGenerated"), + "inProgress": obj.get("inProgress"), + "queued": obj.get("queued"), + "success": obj.get("success"), + "errorMessage": obj.get("errorMessage"), + "lastInvocationId": obj.get("lastInvocationId"), + "reportType": obj.get("reportType"), + "fileSize": obj.get("fileSize") + }) + return _obj - last_invocation_id: Annotated[ - Optional[str], pydantic.Field(alias="lastInvocationId") - ] = None - r"""A unique ID generated for this request.""" - queued: Optional[str] = None - r"""The date and time of when a successful request was queued for the most recent report.""" - report_type: Annotated[ - Optional[ExcelReportTypes], pydantic.Field(alias="reportType") - ] = None - r"""The type of the report requested in the query string.""" - success: Optional[bool] = None - r"""True if the requested report was successfully queued and false if the requested report was not able to be queued.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "errorMessage", - "fileSize", - "inProgress", - "lastGenerated", - "lastInvocationId", - "queued", - "reportType", - "success", - ] - ) - nullable_fields = set(["fileSize"]) - 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: - ExcelStatus.model_rebuild() -except NameError: - pass +class ExcelStatusTypedDict(TypedDict): + """TypedDict variant of ExcelStatus, for dict-literal request/response inputs.""" + last_generated: NotRequired[Optional[str]] + in_progress: NotRequired[Optional[bool]] + queued: NotRequired[Optional[str]] + success: NotRequired[Optional[bool]] + error_message: NotRequired[Optional[str]] + last_invocation_id: NotRequired[Optional[str]] + report_type: NotRequired[Optional[ExcelReportTypes]] + file_size: NotRequired[Optional[int]] diff --git a/lending/src/codat_lending/models/shared/file.py b/lending/src/codat_lending/models/shared/file.py index 1e25f2085..c2121c351 100644 --- a/lending/src/codat_lending/models/shared/file.py +++ b/lending/src/codat_lending/models/shared/file.py @@ -1,114 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class FileTypedDict(TypedDict): - display_name: NotRequired[Nullable[str]] - r"""An optional display name for the file.""" - file_name: NotRequired[Nullable[str]] - r"""The file's name.""" - source_type: NotRequired[Nullable[str]] - r"""The source of the file uploaded.""" - uploaded: 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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class File(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 = {'displayName', 'display_name', 'fileName', 'file_name', 'sourceType', 'source_type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + File + """ # noqa: E501 + file_name: OptionalNullable[str] = Field(default=UNSET, description="The file's name.", alias="fileName") + display_name: OptionalNullable[str] = Field(default=UNSET, description="An optional display name for the file.", alias="displayName") + source_type: OptionalNullable[str] = Field(default=UNSET, description="The source of the file uploaded.", alias="sourceType") + uploaded: 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.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["fileName", "displayName", "sourceType", "uploaded"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class File(BaseModel): - display_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="displayName") - ] = UNSET - r"""An optional display name for the file.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - file_name: Annotated[OptionalNullable[str], pydantic.Field(alias="fileName")] = ( - UNSET - ) - r"""The file's name.""" + 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_type: Annotated[ - OptionalNullable[str], pydantic.Field(alias="sourceType") - ] = UNSET - r"""The source of the file uploaded.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of File from a JSON string""" + return cls.from_dict(json.loads(json_str)) - uploaded: 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: + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + 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 - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + return _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_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of File from a dict""" + if obj is None: + return None - > 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. - """ + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["displayName", "fileName", "sourceType", "uploaded"]) - nullable_fields = set(["displayName", "fileName", "sourceType"]) - 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: - File.model_rebuild() -except NameError: - pass + _obj = cls.model_validate({ + "fileName": obj.get("fileName"), + "displayName": obj.get("displayName"), + "sourceType": obj.get("sourceType"), + "uploaded": obj.get("uploaded") + }) + # 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 FileTypedDict(TypedDict): + """TypedDict variant of File, for dict-literal request/response inputs.""" + file_name: NotRequired[Optional[str]] + display_name: NotRequired[Optional[str]] + source_type: NotRequired[Optional[str]] + uploaded: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/fileupload.py b/lending/src/codat_lending/models/shared/fileupload.py index 29922b67d..6f27fc467 100644 --- a/lending/src/codat_lending/models/shared/fileupload.py +++ b/lending/src/codat_lending/models/shared/fileupload.py @@ -1,19 +1,28 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - +"""File to be uploaded as an attachment. Synthesized to match Speakeasy's shared surface.""" from __future__ import annotations -from .codatfile import CodatFile, CodatFileTypedDict -from codat_lending.types import BaseModel -from codat_lending.utils import FieldMetadata, MultipartFormMetadata -from typing_extensions import Annotated, TypedDict +from typing import Optional +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict +from codat_lending.models.shared.codatfile import CodatFile, CodatFileTypedDict class FileUploadTypedDict(TypedDict): file: CodatFileTypedDict - r"""The file to be uploaded as an attachment.""" class FileUpload(BaseModel): - file: Annotated[ - CodatFile, FieldMetadata(multipart=MultipartFormMetadata(file=True)) - ] - r"""The file to be uploaded as an attachment.""" + @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} + + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) + + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + + file: CodatFile + + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/shared/halref.py b/lending/src/codat_lending/models/shared/halref.py index 735e5a2fc..7c97e9e31 100644 --- a/lending/src/codat_lending/models/shared/halref.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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/lending/src/codat_lending/models/shared/integritystatus.py b/lending/src/codat_lending/models/shared/integritystatus.py index a8b62ef20..6b45b81bd 100644 --- a/lending/src/codat_lending/models/shared/integritystatus.py +++ b/lending/src/codat_lending/models/shared/integritystatus.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 IntegrityStatus(str, Enum): - r"""The current status of the most recently run matching algorithm.""" + """ + The current status of the most recently run matching algorithm. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + DOES_NOT_EXIST = 'DoesNotExist' + ERROR = 'Error' + COMPLETE = 'Complete' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of IntegrityStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - DOES_NOT_EXIST = "DoesNotExist" - ERROR = "Error" - COMPLETE = "Complete" diff --git a/lending/src/codat_lending/models/shared/invoicelineitem.py b/lending/src/codat_lending/models/shared/invoicelineitem.py index 7a2796c9b..a604fb1e1 100644 --- a/lending/src/codat_lending/models/shared/invoicelineitem.py +++ b/lending/src/codat_lending/models/shared/invoicelineitem.py @@ -1,234 +1,169 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .accountsreceivabletracking import ( - AccountsReceivableTracking, - AccountsReceivableTrackingTypedDict, -) -from .propertie_itemref import PropertieItemRef, PropertieItemRefTypedDict -from .taxrateref import TaxRateRef, TaxRateRefTypedDict -from .trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class InvoiceLineItemTypedDict(TypedDict): - quantity: Decimal - r"""Number of units of goods or services provided.""" - unit_amount: Decimal - r"""Price of each unit of goods or services.""" - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - description: NotRequired[Nullable[str]] - r"""Friendly name of the goods or services provided.""" - discount_amount: NotRequired[Nullable[Decimal]] - r"""Numerical value of any discounts applied.""" - discount_percentage: NotRequired[Nullable[Decimal]] - r"""Percentage rate (from 0 to 100) of any discounts applied to the unit amount.""" - is_direct_income: NotRequired[bool] - r"""The invoice is a direct income if `True`.""" - item_ref: NotRequired[PropertieItemRefTypedDict] - r"""Reference to the item the line is linked to.""" - sub_total: NotRequired[Nullable[Decimal]] - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - tax_amount: NotRequired[Nullable[Decimal]] - r"""Amount of tax for the line.""" - tax_rate_ref: NotRequired[TaxRateRefTypedDict] - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ - total_amount: NotRequired[Nullable[Decimal]] - r"""Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified.""" - tracking: NotRequired[AccountsReceivableTrackingTypedDict] - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: NotRequired[Nullable[List[TrackingCategoryRefTypedDict]]] - r"""Reference to the tracking categories to which the line item is linked.""" + 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_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from codat_lending.models.shared.accountsreceivabletracking import AccountsReceivableTracking, AccountsReceivableTrackingTypedDict +from codat_lending.models.item_reference import ItemReference, ItemReferenceTypedDict +from codat_lending.models.shared.taxrateref import TaxRateRef, TaxRateRefTypedDict +from codat_lending.models.shared.trackingcategoryref import TrackingCategoryRef, TrackingCategoryRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class InvoiceLineItem(BaseModel): - quantity: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Number of units of goods or services provided.""" - - unit_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitAmount"), - ] - r"""Price of each unit of goods or services.""" - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - description: OptionalNullable[str] = UNSET - r"""Friendly name of the goods or services provided.""" - - discount_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountAmount"), - ] = UNSET - r"""Numerical value of any discounts applied.""" - - discount_percentage: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="discountPercentage"), - ] = UNSET - r"""Percentage rate (from 0 to 100) of any discounts applied to the unit amount.""" - - is_direct_income: Annotated[ - Optional[bool], pydantic.Field(alias="isDirectIncome") - ] = None - r"""The invoice is a direct income if `True`.""" - - item_ref: Annotated[Optional[PropertieItemRef], pydantic.Field(alias="itemRef")] = ( - None - ) - r"""Reference to the item the line is linked to.""" - - sub_total: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="subTotal"), - ] = UNSET - r"""Amount of the line, inclusive of discounts but exclusive of tax.""" - - tax_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = UNSET - r"""Amount of tax for the line.""" - - tax_rate_ref: Annotated[ - Optional[TaxRateRef], pydantic.Field(alias="taxRateRef") - ] = None - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: - - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'description', 'discountAmount', 'discountPercentage', 'discount_amount', 'discount_percentage', 'subTotal', 'sub_total', 'taxAmount', 'tax_amount', 'totalAmount', 'total_amount', 'trackingCategoryRefs', 'tracking_category_refs'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + InvoiceLineItem + """ # noqa: E501 + description: OptionalNullable[str] = Field(default=UNSET, description="Friendly name of the goods or services provided.") + unit_amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Price of each unit of goods or services.", alias="unitAmount") + quantity: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Number of units of goods or services provided.") + discount_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Numerical value of any discounts applied.", alias="discountAmount") + sub_total: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of the line, inclusive of discounts but exclusive of tax.", alias="subTotal") + tax_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount of tax for the line.", alias="taxAmount") + total_amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified.", alias="totalAmount") + account_ref: Optional[AccountRef] = Field(default=None, description="Reference to the account to which the line item is linked.", alias="accountRef") + discount_percentage: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Percentage rate (from 0 to 100) of any discounts applied to the unit amount.", alias="discountPercentage") + tax_rate_ref: Optional[TaxRateRef] = Field(default=None, description="Reference to the tax rate to which the line item is linked.", alias="taxRateRef") + item_ref: Optional[ItemReference] = Field(default=None, description="Reference to the item the line is linked to.", alias="itemRef") + tracking_category_refs: OptionalNullable[List[TrackingCategoryRef]] = Field(default=UNSET, description="Reference to the tracking categories to which the line item is linked.", alias="trackingCategoryRefs") + tracking: Optional[AccountsReceivableTracking] = None + is_direct_income: Optional[bool] = Field(default=None, description="The invoice is a direct income if `True`.", alias="isDirectIncome") + __properties: ClassVar[List[str]] = ["description", "unitAmount", "quantity", "discountAmount", "subTotal", "taxAmount", "totalAmount", "accountRef", "discountPercentage", "taxRateRef", "itemRef", "trackingCategoryRefs", "tracking", "isDirectIncome"] - total_amount: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = UNSET - r"""Total amount of the line, including tax. When pushing invoices to Xero, the total amount is exclusive of tax to allow automatic calculations if a tax rate or tax amount is not specified.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - tracking: Optional[AccountsReceivableTracking] = None - r"""Categories, and a project and customer, against which the item is tracked.""" - tracking_category_refs: Annotated[ - OptionalNullable[List[TrackingCategoryRef]], - pydantic.Field(alias="trackingCategoryRefs"), - ] = UNSET - r"""Reference to the tracking categories to which the line item is linked.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "description", - "discountAmount", - "discountPercentage", - "isDirectIncome", - "itemRef", - "subTotal", - "taxAmount", - "taxRateRef", - "totalAmount", - "tracking", - "trackingCategoryRefs", - ] - ) - nullable_fields = set( - [ - "description", - "discountAmount", - "discountPercentage", - "subTotal", - "taxAmount", - "totalAmount", - "trackingCategoryRefs", - ] + 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 InvoiceLineItem 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, ) - 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: - InvoiceLineItem.model_rebuild() -except NameError: - pass + # override the default output from pydantic by calling `to_dict()` of account_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_rate_ref + if self.tax_rate_ref: + _dict['taxRateRef'] = self.tax_rate_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tracking_category_refs (list) + _items = [] + if self.tracking_category_refs: + for _item_tracking_category_refs in self.tracking_category_refs: + if _item_tracking_category_refs: + _items.append(_item_tracking_category_refs.to_dict()) + _dict['trackingCategoryRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of tracking + if self.tracking: + _dict['tracking'] = self.tracking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InvoiceLineItem 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"), + "unitAmount": obj.get("unitAmount"), + "quantity": obj.get("quantity"), + "discountAmount": obj.get("discountAmount"), + "subTotal": obj.get("subTotal"), + "taxAmount": obj.get("taxAmount"), + "totalAmount": obj.get("totalAmount"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "discountPercentage": obj.get("discountPercentage"), + "taxRateRef": TaxRateRef.from_dict(obj["taxRateRef"]) if obj.get("taxRateRef") is not None else None, + "itemRef": ItemReference.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "trackingCategoryRefs": [TrackingCategoryRef.from_dict(_item) for _item in obj["trackingCategoryRefs"]] if obj.get("trackingCategoryRefs") is not None else None, + "tracking": AccountsReceivableTracking.from_dict(obj["tracking"]) if obj.get("tracking") is not None else None, + "isDirectIncome": obj.get("isDirectIncome") + }) + return _obj + + + + + +class InvoiceLineItemTypedDict(TypedDict): + """TypedDict variant of InvoiceLineItem, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + unit_amount: NotRequired[Decimal] + quantity: NotRequired[Decimal] + discount_amount: NotRequired[Optional[Decimal]] + sub_total: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + discount_percentage: NotRequired[Optional[Decimal]] + tax_rate_ref: NotRequired[Optional[TaxRateRefTypedDict]] + item_ref: NotRequired[Optional[ItemReferenceTypedDict]] + tracking_category_refs: NotRequired[Optional[List[TrackingCategoryRefTypedDict]]] + tracking: NotRequired[Optional[AccountsReceivableTrackingTypedDict]] + is_direct_income: NotRequired[Optional[bool]] diff --git a/lending/src/codat_lending/models/shared/invoicestatus.py b/lending/src/codat_lending/models/shared/invoicestatus.py index ab709c93d..6bed38926 100644 --- a/lending/src/codat_lending/models/shared/invoicestatus.py +++ b/lending/src/codat_lending/models/shared/invoicestatus.py @@ -1,22 +1,42 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 InvoiceStatus(str, Enum): - r"""Current state of the invoice: + """ + Current state of the invoice: - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. + """ - - `Draft` - Invoice hasn't been submitted to the supplier. It may be in a pending state or is scheduled for future submission, for example by email. - - `Submitted` - Invoice is no longer a draft. It has been processed and, or, sent to the customer. In this state, it will impact the ledger. It also has no payments made against it, meaning `amountDue` will usually equal `totalAmount` (unless tax is witheld). - - `PartiallyPaid` - The balance paid against the invoice is positive, but less than the total invoice amount, meaning `0 < amountDue < totalAmount`. - - `Paid` - Invoice is paid in full. This includes if the invoice has been credited or overpaid, meaning `amountDue == 0`. - - `Void` - An invoice can become Void when it's deleted, refunded, written off, or cancelled. A voided invoice may still be PartiallyPaid, and so all outstanding amounts on voided invoices are removed from the accounts receivable account. """ + allowed enum values + """ + UNKNOWN = 'Unknown' + DRAFT = 'Draft' + SUBMITTED = 'Submitted' + PARTIALLY_PAID = 'PartiallyPaid' + PAID = 'Paid' + VOID = 'Void' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of InvoiceStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - DRAFT = "Draft" - SUBMITTED = "Submitted" - PARTIALLY_PAID = "PartiallyPaid" - PAID = "Paid" - VOID = "Void" diff --git a/lending/src/codat_lending/models/shared/itemref.py b/lending/src/codat_lending/models/shared/itemref.py index ea61d31b2..952466f7d 100644 --- a/lending/src/codat_lending/models/shared/itemref.py +++ b/lending/src/codat_lending/models/shared/itemref.py @@ -1,52 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ItemRefTypedDict(TypedDict): - data_connection_id: NotRequired[str] - r"""The data connection id being referenced.""" - id: NotRequired[str] - r"""The id of the object, e.g. the Journal entry.""" - type: NotRequired[str] - r"""The data type the loan transaction entry was extracted from.""" + 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 ItemRef(BaseModel): - data_connection_id: Annotated[ - Optional[str], pydantic.Field(alias="dataConnectionId") - ] = None - r"""The data connection id being referenced.""" - id: Optional[str] = None - r"""The id of the object, e.g. the Journal entry.""" +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 - type: Optional[str] = None - r"""The data type the loan transaction entry was extracted from.""" +class ItemRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataConnectionId", "id", "type"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + ItemRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The id of the object, e.g. the Journal entry.") + data_connection_id: Optional[str] = Field(default=None, description="The data connection id being referenced.", alias="dataConnectionId") + type: Optional[str] = Field(default=None, description="The data type the loan transaction entry was extracted from.") + __properties: ClassVar[List[str]] = ["id", "dataConnectionId", "type"] + + 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 ItemRef 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([ + ]) -try: - ItemRef.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 ItemRef 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"), + "dataConnectionId": obj.get("dataConnectionId"), + "type": obj.get("type") + }) + return _obj + + + + + +class ItemRefTypedDict(TypedDict): + """TypedDict variant of ItemRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_connection_id: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/items.py b/lending/src/codat_lending/models/shared/items.py index 352987e92..ede5a7547 100644 --- a/lending/src/codat_lending/models/shared/items.py +++ b/lending/src/codat_lending/models/shared/items.py @@ -1,28 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import BaseModel -from codat_lending.utils import serialize_decimal, validate_decimal from decimal import Decimal -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing_extensions import Annotated, TypedDict +from codat_lending.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 Any, ClassVar, Dict, List, Union +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self -class ItemsTypedDict(TypedDict): - amount: Decimal - r"""Amount of tax withheld.""" - name: str - r"""Name assigned to withheld tax.""" +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} + """ + Items + """ # noqa: E501 + name: str = Field(description="Name assigned to withheld tax.") + amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of tax withheld.") + __properties: ClassVar[List[str]] = ["name", "amount"] -class Items(BaseModel): - amount: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Amount of tax withheld.""" - - name: str - r"""Name assigned to withheld tax.""" + 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, + ) + 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({ + "name": obj.get("name"), + "amount": obj.get("amount") + }) + return _obj + + + + + +class ItemsTypedDict(TypedDict): + """TypedDict variant of Items, for dict-literal request/response inputs.""" + name: NotRequired[str] + amount: NotRequired[Decimal] diff --git a/lending/src/codat_lending/models/shared/journalentryrecordref.py b/lending/src/codat_lending/models/shared/journalentryrecordref.py index 9785607e9..d251f1e89 100644 --- a/lending/src/codat_lending/models/shared/journalentryrecordref.py +++ b/lending/src/codat_lending/models/shared/journalentryrecordref.py @@ -1,68 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, 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 JournalEntryRecordRefDataType(str, Enum): - r"""Name of underlying data type.""" - - BANK_TRANSACTIONS = "bankTransactions" - BILL_CREDIT_NOTES = "billCreditNotes" - BILL_PAYMENTS = "billPayments" - BILLS = "bills" - CREDIT_NOTES = "creditNotes" - DIRECT_COSTS = "directCosts" - DIRECT_INCOMES = "directIncomes" - INVOICES = "invoices" - JOURNAL_ENTRIES = "journalEntries" - PAYMENTS = "payments" - TRANSFERS = "transfers" +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class JournalEntryRecordRefTypedDict(TypedDict): - r"""Links a journal entry to the underlying record that created it.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - data_type: NotRequired[JournalEntryRecordRefDataType] - r"""Name of underlying data type.""" - id: NotRequired[str] - r"""'id' of the underlying record or data type.""" + Do not edit the class manually. +""" # noqa: E501 -class JournalEntryRecordRef(BaseModel): - r"""Links a journal entry to the underlying record that created it.""" +from __future__ import annotations +from codat_lending.models.journal_entry_record_ref_data_type import JournalEntryRecordRefDataType +import pprint +import re # noqa: F401 +import json - data_type: Annotated[ - Optional[JournalEntryRecordRefDataType], pydantic.Field(alias="dataType") - ] = None - r"""Name of underlying data type.""" +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 - id: Optional[str] = None - r"""'id' of the underlying record or data type.""" +class JournalEntryRecordRef(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} + """ + Links a journal entry to the underlying record that created it. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' of the underlying record or data type.") + data_type: Optional[JournalEntryRecordRefDataType] = Field(default=None, description="Name of underlying data type.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'creditNotes', 'directCosts', 'directIncomes', 'invoices', 'journalEntries', 'payments', 'transfers']): + raise ValueError("must be one of enum values ('bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'creditNotes', 'directCosts', 'directIncomes', 'invoices', 'journalEntries', 'payments', 'transfers')") + 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)) - 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 JournalEntryRecordRef 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: - JournalEntryRecordRef.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 JournalEntryRecordRef 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") + }) + return _obj + + + + + +class JournalEntryRecordRefTypedDict(TypedDict): + """TypedDict variant of JournalEntryRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[JournalEntryRecordRefDataType]] diff --git a/lending/src/codat_lending/models/shared/journalline.py b/lending/src/codat_lending/models/shared/journalline.py index 54d8ccb29..ea6a74be7 100644 --- a/lending/src/codat_lending/models/shared/journalline.py +++ b/lending/src/codat_lending/models/shared/journalline.py @@ -1,221 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from .trackingrecordref import TrackingRecordRef, TrackingRecordRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class JournalLineDataType(str, Enum): - r"""Allowed name of the 'dataType'.""" - - CUSTOMERS = "customers" - SUPPLIERS = "suppliers" - - -class ContactReferenceTypedDict(TypedDict): - id: str - r"""Unique identifier for a customer or supplier.""" - data_type: NotRequired[Nullable[JournalLineDataType]] - r"""Allowed name of the 'dataType'.""" - - -class ContactReference(BaseModel): - id: str - r"""Unique identifier for a customer or supplier.""" - - data_type: Annotated[ - OptionalNullable[JournalLineDataType], pydantic.Field(alias="dataType") - ] = UNSET - r"""Allowed name of the 'dataType'.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType"]) - nullable_fields = set(["dataType"]) - 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 JournalLineTrackingTypedDict(TypedDict): - r"""List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.)""" - - record_refs: NotRequired[Nullable[List[TrackingRecordRefTypedDict]]] - - -class JournalLineTracking(BaseModel): - r"""List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.)""" - - record_refs: Annotated[ - OptionalNullable[List[TrackingRecordRef]], pydantic.Field(alias="recordRefs") - ] = UNSET - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["recordRefs"]) - nullable_fields = set(["recordRefs"]) - 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 JournalLineTypedDict(TypedDict): - net_amount: Decimal - r"""Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative.""" - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - contact_ref: NotRequired[ContactReferenceTypedDict] - currency: NotRequired[Nullable[str]] - r"""Currency for the journal line item.""" - description: NotRequired[Nullable[str]] - r"""Description of the journal line item.""" - tracking: NotRequired[JournalLineTrackingTypedDict] - r"""List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.)""" - transaction_amount: NotRequired[Decimal] - r"""The amount in the original transaction currency.""" - transaction_currency: NotRequired[Nullable[str]] - r"""Currency of the original transaction.""" - - -class JournalLine(BaseModel): - net_amount: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="netAmount"), - ] - r"""Amount for the journal line. Debit entries are considered positive, and credit entries are considered negative.""" - - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account.""" - - contact_ref: Annotated[ - Optional[ContactReference], pydantic.Field(alias="contactRef") - ] = None - - currency: OptionalNullable[str] = UNSET - r"""Currency for the journal line item.""" - - description: OptionalNullable[str] = UNSET - r"""Description of the journal line item.""" - - tracking: Optional[JournalLineTracking] = None - r"""List of record refs associated with the tracking information for the line (eg to a Tracking Category, or customer etc.)""" - - transaction_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="transactionAmount"), - ] = None - r"""The amount in the original transaction currency.""" - - transaction_currency: Annotated[ - OptionalNullable[str], pydantic.Field(alias="transactionCurrency") - ] = UNSET - r"""Currency of the original transaction.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "contactRef", - "currency", - "description", - "tracking", - "transactionAmount", - "transactionCurrency", - ] - ) - nullable_fields = set(["currency", "description", "transactionCurrency"]) - 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: - ContactReference.model_rebuild() -except NameError: - pass -try: - JournalLineTracking.model_rebuild() -except NameError: - pass -try: - JournalLine.model_rebuild() -except NameError: - pass +from codat_lending.models._compat.journalline import JournalLineDataType diff --git a/lending/src/codat_lending/models/shared/journalref.py b/lending/src/codat_lending/models/shared/journalref.py index 8b26e82b7..ffea8aac8 100644 --- a/lending/src/codat_lending/models/shared/journalref.py +++ b/lending/src/codat_lending/models/shared/journalref.py @@ -1,56 +1,122 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class JournalRefTypedDict(TypedDict): - r"""Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals).""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""GUID of the underlying journal.""" - name: NotRequired[Nullable[str]] - r"""Name of journal""" + Do not edit the class manually. +""" # noqa: E501 -class JournalRef(BaseModel): - r"""Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals).""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""GUID of the underlying journal.""" +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 - name: OptionalNullable[str] = UNSET - r"""Name of journal""" +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class JournalRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) + 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 = {'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Links journal entries to the relevant journal in accounting integrations that use multi-book accounting (multiple journals). + """ # noqa: E501 + id: str = Field(description="GUID of the underlying journal.") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of journal") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 JournalRef 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 JournalRef 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") + }) + # 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 JournalRefTypedDict(TypedDict): + """TypedDict variant of JournalRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/journalstatus.py b/lending/src/codat_lending/models/shared/journalstatus.py index 4cbadd55d..bc89b0b03 100644 --- a/lending/src/codat_lending/models/shared/journalstatus.py +++ b/lending/src/codat_lending/models/shared/journalstatus.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 JournalStatus(str, Enum): - r"""Current journal status.""" + """ + Current journal status. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of JournalStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" diff --git a/lending/src/codat_lending/models/shared/lendingcustomerref.py b/lending/src/codat_lending/models/shared/lendingcustomerref.py index 3d7ce8152..a1867927e 100644 --- a/lending/src/codat_lending/models/shared/lendingcustomerref.py +++ b/lending/src/codat_lending/models/shared/lendingcustomerref.py @@ -1,62 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LendingCustomerRefTypedDict(TypedDict): - customer_name: NotRequired[Nullable[str]] - r"""`customerName` from the Customer data type.""" - id: NotRequired[str] - r"""`id` from the Customers data type.""" + 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 LendingCustomerRef(BaseModel): - customer_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="customerName") - ] = UNSET - r"""`customerName` from the Customer data type.""" - id: Optional[str] = None - r"""`id` from the Customers data type.""" +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 typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class LendingCustomerRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["customerName", "id"]) - nullable_fields = set(["customerName"]) + 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: - LendingCustomerRef.model_rebuild() -except NameError: - pass + _nullable = {'customerName', 'customer_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + LendingCustomerRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="`id` from the Customers data type.") + customer_name: OptionalNullable[str] = Field(default=UNSET, description="`customerName` from the Customer data type.", alias="customerName") + __properties: ClassVar[List[str]] = ["id", "customerName"] + + 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 LendingCustomerRef 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 LendingCustomerRef 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"), + "customerName": obj.get("customerName") + }) + return _obj + + + + + +class LendingCustomerRefTypedDict(TypedDict): + """TypedDict variant of LendingCustomerRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + customer_name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/links.py b/lending/src/codat_lending/models/shared/links.py index ea1b558a9..ade295b09 100644 --- a/lending/src/codat_lending/models/shared/links.py +++ b/lending/src/codat_lending/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_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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/lending/src/codat_lending/models/shared/loanref.py b/lending/src/codat_lending/models/shared/loanref.py index 4393eb9fb..49c4430fc 100644 --- a/lending/src/codat_lending/models/shared/loanref.py +++ b/lending/src/codat_lending/models/shared/loanref.py @@ -1,52 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanRefTypedDict(TypedDict): - data_connection_id: NotRequired[str] - r"""The dataConnectionId the object being referred to is associated with.""" - id: NotRequired[str] - r"""The id of the object being referred to.""" - type: NotRequired[str] - r"""The object type data is referring to, e.g. 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 LoanRef(BaseModel): - data_connection_id: Annotated[ - Optional[str], pydantic.Field(alias="dataConnectionId") - ] = None - r"""The dataConnectionId the object being referred to is associated with.""" - id: Optional[str] = None - r"""The id of the object being referred to.""" +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 - type: Optional[str] = None - r"""The object type data is referring to, e.g. Account.""" +class LoanRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataConnectionId", "id", "type"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + LoanRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The id of the object being referred to.") + data_connection_id: Optional[str] = Field(default=None, description="The dataConnectionId the object being referred to is associated with.", alias="dataConnectionId") + type: Optional[str] = Field(default=None, description="The object type data is referring to, e.g. Account.") + __properties: ClassVar[List[str]] = ["id", "dataConnectionId", "type"] + + 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 LoanRef 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([ + ]) -try: - LoanRef.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 LoanRef 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"), + "dataConnectionId": obj.get("dataConnectionId"), + "type": obj.get("type") + }) + return _obj + + + + + +class LoanRefTypedDict(TypedDict): + """TypedDict variant of LoanRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_connection_id: NotRequired[Optional[str]] + type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/loansummary.py b/lending/src/codat_lending/models/shared/loansummary.py index 916454153..43e7f7dfb 100644 --- a/lending/src/codat_lending/models/shared/loansummary.py +++ b/lending/src/codat_lending/models/shared/loansummary.py @@ -1,49 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .loansummaryreportinfo import LoanSummaryReportInfo, LoanSummaryReportInfoTypedDict -from .loansummaryreportitem import LoanSummaryReportItem, LoanSummaryReportItemTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanSummaryTypedDict(TypedDict): - report_info: NotRequired[LoanSummaryReportInfoTypedDict] - report_items: NotRequired[List[LoanSummaryReportItemTypedDict]] - r"""Returns a summary of all loan activity for that integration type""" + 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 LoanSummary(BaseModel): - report_info: Annotated[ - Optional[LoanSummaryReportInfo], pydantic.Field(alias="reportInfo") - ] = None - report_items: Annotated[ - Optional[List[LoanSummaryReportItem]], pydantic.Field(alias="reportItems") - ] = None - r"""Returns a summary of all loan activity for that integration type""" +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_lending.models.shared.loansummaryreportinfo import LoanSummaryReportInfo, LoanSummaryReportInfoTypedDict +from codat_lending.models.shared.loansummaryreportitem import LoanSummaryReportItem, LoanSummaryReportItemTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class LoanSummary(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["reportInfo", "reportItems"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + LoanSummary + """ # noqa: E501 + report_info: Optional[LoanSummaryReportInfo] = Field(default=None, alias="reportInfo") + report_items: Optional[List[LoanSummaryReportItem]] = Field(default=None, description="Returns a summary of all loan activity for that integration type", alias="reportItems") + __properties: ClassVar[List[str]] = ["reportInfo", "reportItems"] + + 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 LoanSummary 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: - LoanSummary.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 report_info + if self.report_info: + _dict['reportInfo'] = self.report_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in report_items (list) + _items = [] + if self.report_items: + for _item_report_items in self.report_items: + if _item_report_items: + _items.append(_item_report_items.to_dict()) + _dict['reportItems'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoanSummary from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reportInfo": LoanSummaryReportInfo.from_dict(obj["reportInfo"]) if obj.get("reportInfo") is not None else None, + "reportItems": [LoanSummaryReportItem.from_dict(_item) for _item in obj["reportItems"]] if obj.get("reportItems") is not None else None + }) + return _obj + + + + + +class LoanSummaryTypedDict(TypedDict): + """TypedDict variant of LoanSummary, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[LoanSummaryReportInfoTypedDict]] + report_items: NotRequired[Optional[List[LoanSummaryReportItemTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/loansummaryintegrationtype.py b/lending/src/codat_lending/models/shared/loansummaryintegrationtype.py index 2e514cde2..df2a38998 100644 --- a/lending/src/codat_lending/models/shared/loansummaryintegrationtype.py +++ b/lending/src/codat_lending/models/shared/loansummaryintegrationtype.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 LoanSummaryIntegrationType(str, Enum): - r"""The integration type begin referred to.""" + """ + The integration type begin referred to. + """ + + """ + allowed enum values + """ + ACCOUNTING = 'Accounting' + BANKING = 'Banking' + COMMERCE = 'Commerce' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LoanSummaryIntegrationType from a JSON string""" + return cls(json.loads(json_str)) + - ACCOUNTING = "Accounting" - BANKING = "Banking" - COMMERCE = "Commerce" diff --git a/lending/src/codat_lending/models/shared/loansummaryrecordref.py b/lending/src/codat_lending/models/shared/loansummaryrecordref.py index 6bf7a11b9..a238526fc 100644 --- a/lending/src/codat_lending/models/shared/loansummaryrecordref.py +++ b/lending/src/codat_lending/models/shared/loansummaryrecordref.py @@ -1,65 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .loansummaryintegrationtype import LoanSummaryIntegrationType -from .loansummaryrecordreftype import LoanSummaryRecordRefType -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanSummaryRecordRefTypedDict(TypedDict): - data_connection_id: NotRequired[str] - r"""The dataConnectionId the object being referred to is associated with.""" - id: NotRequired[str] - r"""The id of the object being referred to.""" - integration_type: NotRequired[LoanSummaryIntegrationType] - r"""The integration type begin referred to.""" - record_ref_type: NotRequired[LoanSummaryRecordRefType] - r"""The datatype being referred to.""" + 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 LoanSummaryRecordRef(BaseModel): - data_connection_id: Annotated[ - Optional[str], pydantic.Field(alias="dataConnectionId") - ] = None - r"""The dataConnectionId the object being referred to is associated with.""" - id: Optional[str] = None - r"""The id of the object being referred to.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - integration_type: Annotated[ - Optional[LoanSummaryIntegrationType], pydantic.Field(alias="integrationType") - ] = None - r"""The integration type begin referred to.""" +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.loansummaryintegrationtype import LoanSummaryIntegrationType +from codat_lending.models.shared.loansummaryrecordreftype import LoanSummaryRecordRefType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - record_ref_type: Annotated[ - Optional[LoanSummaryRecordRefType], pydantic.Field(alias="recordRefType") - ] = None - r"""The datatype being referred to.""" +class LoanSummaryRecordRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["dataConnectionId", "id", "integrationType", "recordRefType"] - ) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + LoanSummaryRecordRef + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="The id of the object being referred to.") + data_connection_id: Optional[str] = Field(default=None, description="The dataConnectionId the object being referred to is associated with.", alias="dataConnectionId") + integration_type: Optional[LoanSummaryIntegrationType] = Field(default=None, alias="integrationType") + record_ref_type: Optional[LoanSummaryRecordRefType] = Field(default=None, alias="recordRefType") + __properties: ClassVar[List[str]] = ["id", "dataConnectionId", "integrationType", "recordRefType"] + + 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 LoanSummaryRecordRef 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([ + ]) -try: - LoanSummaryRecordRef.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 LoanSummaryRecordRef 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"), + "dataConnectionId": obj.get("dataConnectionId"), + "integrationType": obj.get("integrationType"), + "recordRefType": obj.get("recordRefType") + }) + return _obj + + + + + +class LoanSummaryRecordRefTypedDict(TypedDict): + """TypedDict variant of LoanSummaryRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_connection_id: NotRequired[Optional[str]] + integration_type: NotRequired[Optional[LoanSummaryIntegrationType]] + record_ref_type: NotRequired[Optional[LoanSummaryRecordRefType]] diff --git a/lending/src/codat_lending/models/shared/loansummaryrecordreftype.py b/lending/src/codat_lending/models/shared/loansummaryrecordreftype.py index 8a8ec68cb..bfcc0b9d1 100644 --- a/lending/src/codat_lending/models/shared/loansummaryrecordreftype.py +++ b/lending/src/codat_lending/models/shared/loansummaryrecordreftype.py @@ -1,12 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 LoanSummaryRecordRefType(str, Enum): - r"""The datatype being referred to.""" + """ + The datatype being referred to. + """ + + """ + allowed enum values + """ + ACCOUNTS = 'accounts' + BANKING_MINUS_ACCOUNTS = 'banking-accounts' + BANKING_ACCOUNTS = 'banking-accounts' + COMMERCE_MINUS_TRANSACTIONS = 'commerce-transactions' + + COMMERCE_TRANSACTIONS = 'commerce-transactions' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of LoanSummaryRecordRefType from a JSON string""" + return cls(json.loads(json_str)) + - ACCOUNTS = "accounts" - BANKING_ACCOUNTS = "banking-accounts" - COMMERCE_TRANSACTIONS = "commerce-transactions" diff --git a/lending/src/codat_lending/models/shared/loansummaryreportinfo.py b/lending/src/codat_lending/models/shared/loansummaryreportinfo.py index c5a4628d2..42bec3c20 100644 --- a/lending/src/codat_lending/models/shared/loansummaryreportinfo.py +++ b/lending/src/codat_lending/models/shared/loansummaryreportinfo.py @@ -1,90 +1,105 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanSummaryReportInfoTypedDict(TypedDict): - company_name: NotRequired[str] - r"""Name of the company queried.""" - 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 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 LoanSummaryReportInfo(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} """ - report_name: NotRequired[str] - r"""The name of the report.""" + LoanSummaryReportInfo + """ # noqa: E501 + report_name: Optional[str] = Field(default=None, description="The name of the report.", alias="reportName") + company_name: Optional[str] = Field(default=None, description="Name of the company queried.", alias="companyName") + 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") + __properties: ClassVar[List[str]] = ["reportName", "companyName", "generatedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class LoanSummaryReportInfo(BaseModel): - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""Name of the company queried.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - 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_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 LoanSummaryReportInfo 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. + """ + excluded_fields: Set[str] = set([ + ]) - - 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, + ) + return _dict - > 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. - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoanSummaryReportInfo from a dict""" + if obj is None: + return None - report_name: Annotated[Optional[str], pydantic.Field(alias="reportName")] = None - r"""The name of the report.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["companyName", "generatedDate", "reportName"]) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "reportName": obj.get("reportName"), + "companyName": obj.get("companyName"), + "generatedDate": obj.get("generatedDate") + }) + 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: - LoanSummaryReportInfo.model_rebuild() -except NameError: - pass +class LoanSummaryReportInfoTypedDict(TypedDict): + """TypedDict variant of LoanSummaryReportInfo, for dict-literal request/response inputs.""" + report_name: NotRequired[Optional[str]] + company_name: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/loansummaryreportitem.py b/lending/src/codat_lending/models/shared/loansummaryreportitem.py index df168a6aa..2521d97d2 100644 --- a/lending/src/codat_lending/models/shared/loansummaryreportitem.py +++ b/lending/src/codat_lending/models/shared/loansummaryreportitem.py @@ -1,141 +1,123 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .loansummaryrecordref import LoanSummaryRecordRef, LoanSummaryRecordRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanSummaryReportItemTypedDict(TypedDict): - balance: NotRequired[Decimal] - r"""The loan outstanding balance. This may not equal totalDrawdowns - totalRepayments due to interest which has been accrued.""" - description: NotRequired[str] - r"""The description of the object being referred to. E.g. the account.""" - lender: NotRequired[str] - r"""The name of lender providing the loan.""" - record_ref: NotRequired[LoanSummaryRecordRefTypedDict] - 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 - ``` + 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. - """ - total_drawdowns: NotRequired[Decimal] - r"""The total loan drawdowns.""" - total_repayments: NotRequired[Decimal] - r"""The total loan repayments which includes capital plus any interest.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.loansummaryrecordref import LoanSummaryRecordRef, LoanSummaryRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class LoanSummaryReportItem(BaseModel): - balance: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The loan outstanding balance. This may not equal totalDrawdowns - totalRepayments due to interest which has been accrued.""" - - description: Optional[str] = None - r"""The description of the object being referred to. E.g. the account.""" - - lender: Optional[str] = None - r"""The name of lender providing the loan.""" - - record_ref: Annotated[ - Optional[LoanSummaryRecordRef], pydantic.Field(alias="recordRef") - ] = None - - start_date: Annotated[Optional[str], pydantic.Field(alias="startDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ + LoanSummaryReportItem + """ # noqa: E501 + record_ref: Optional[LoanSummaryRecordRef] = Field(default=None, description="Contains object that contains a summary of all loan transactions for that integration type.", alias="recordRef") + description: Optional[str] = Field(default=None, description="The description of the object being referred to. E.g. the account.") + 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="startDate") + total_drawdowns: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total loan drawdowns.", alias="totalDrawdowns") + total_repayments: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The total loan repayments which includes capital plus any interest.", alias="totalRepayments") + balance: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The loan outstanding balance. This may not equal totalDrawdowns - totalRepayments due to interest which has been accrued.") + lender: Optional[str] = Field(default=None, description="The name of lender providing the loan.") + __properties: ClassVar[List[str]] = ["recordRef", "description", "startDate", "totalDrawdowns", "totalRepayments", "balance", "lender"] + + 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 LoanSummaryReportItem 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 - total_drawdowns: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalDrawdowns"), - ] = None - r"""The total loan drawdowns.""" - - total_repayments: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalRepayments"), - ] = None - r"""The total loan repayments which includes capital plus any interest.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoanSummaryReportItem from a dict""" + if obj is None: + return None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "balance", - "description", - "lender", - "recordRef", - "startDate", - "totalDrawdowns", - "totalRepayments", - ] - ) - serialized = handler(self) - m = {} + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "recordRef": LoanSummaryRecordRef.from_dict(obj["recordRef"]) if obj.get("recordRef") is not None else None, + "description": obj.get("description"), + "startDate": obj.get("startDate"), + "totalDrawdowns": obj.get("totalDrawdowns"), + "totalRepayments": obj.get("totalRepayments"), + "balance": obj.get("balance"), + "lender": obj.get("lender") + }) + 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: - LoanSummaryReportItem.model_rebuild() -except NameError: - pass +class LoanSummaryReportItemTypedDict(TypedDict): + """TypedDict variant of LoanSummaryReportItem, for dict-literal request/response inputs.""" + record_ref: NotRequired[Optional[LoanSummaryRecordRefTypedDict]] + description: NotRequired[Optional[str]] + start_date: NotRequired[Optional[str]] + total_drawdowns: NotRequired[Optional[Decimal]] + total_repayments: NotRequired[Optional[Decimal]] + balance: NotRequired[Optional[Decimal]] + lender: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/loantransactions.py b/lending/src/codat_lending/models/shared/loantransactions.py index e0498e64f..68a3c4c06 100644 --- a/lending/src/codat_lending/models/shared/loantransactions.py +++ b/lending/src/codat_lending/models/shared/loantransactions.py @@ -1,52 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .loantransactionsreportinfo import ( - LoanTransactionsReportInfo, - LoanTransactionsReportInfoTypedDict, -) -from .reportitems import ReportItems, ReportItemsTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LoanTransactionsTypedDict(TypedDict): - report_info: NotRequired[LoanTransactionsReportInfoTypedDict] - report_items: NotRequired[List[ReportItemsTypedDict]] - r"""Contains object of reporting properties. The loan ref will reference a different object depending on the integration type.""" + 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 LoanTransactions(BaseModel): - report_info: Annotated[ - Optional[LoanTransactionsReportInfo], pydantic.Field(alias="reportInfo") - ] = None - report_items: Annotated[ - Optional[List[ReportItems]], pydantic.Field(alias="reportItems") - ] = None - r"""Contains object of reporting properties. The loan ref will reference a different object depending on the integration type.""" +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_lending.models.shared.loantransactionsreportinfo import LoanTransactionsReportInfo, LoanTransactionsReportInfoTypedDict +from codat_lending.models.shared.reportitems import ReportItems, ReportItemsTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class LoanTransactions(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["reportInfo", "reportItems"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + LoanTransactions + """ # noqa: E501 + report_info: Optional[LoanTransactionsReportInfo] = Field(default=None, alias="reportInfo") + report_items: Optional[List[ReportItems]] = Field(default=None, description="Contains object of reporting properties. The loan ref will reference a different object depending on the integration type.", alias="reportItems") + __properties: ClassVar[List[str]] = ["reportInfo", "reportItems"] + + 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 LoanTransactions 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: - LoanTransactions.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 report_info + if self.report_info: + _dict['reportInfo'] = self.report_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in report_items (list) + _items = [] + if self.report_items: + for _item_report_items in self.report_items: + if _item_report_items: + _items.append(_item_report_items.to_dict()) + _dict['reportItems'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoanTransactions from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "reportInfo": LoanTransactionsReportInfo.from_dict(obj["reportInfo"]) if obj.get("reportInfo") is not None else None, + "reportItems": [ReportItems.from_dict(_item) for _item in obj["reportItems"]] if obj.get("reportItems") is not None else None + }) + return _obj + + + + + +class LoanTransactionsTypedDict(TypedDict): + """TypedDict variant of LoanTransactions, for dict-literal request/response inputs.""" + report_info: NotRequired[Optional[LoanTransactionsReportInfoTypedDict]] + report_items: NotRequired[Optional[List[ReportItemsTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/loantransactionsreportinfo.py b/lending/src/codat_lending/models/shared/loantransactionsreportinfo.py index 014f769b7..ee4109e0b 100644 --- a/lending/src/codat_lending/models/shared/loantransactionsreportinfo.py +++ b/lending/src/codat_lending/models/shared/loantransactionsreportinfo.py @@ -1,114 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class LoanTransactionsReportInfoTypedDict(TypedDict): - company_name: NotRequired[str] - r"""Name of the company queried.""" - 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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - page_number: NotRequired[int] - r"""The page number.""" - page_size: NotRequired[int] - r"""Queried page size.""" - report_name: NotRequired[str] - r"""The name of the report.""" - total_results: NotRequired[int] - r"""The total number of transactions returned.""" +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 LoanTransactionsReportInfo(BaseModel): - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""Name of the company queried.""" - generated_date: Annotated[Optional[str], pydantic.Field(alias="generatedDate")] = ( - 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} + """ + LoanTransactionsReportInfo + """ # noqa: E501 + page_number: Optional[int] = Field(default=None, description="The page number.", alias="pageNumber") + page_size: Optional[int] = Field(default=None, description="Queried page size.", alias="pageSize") + total_results: Optional[int] = Field(default=None, description="The total number of transactions returned.", alias="totalResults") + report_name: Optional[str] = Field(default=None, description="The name of the report.", alias="reportName") + company_name: Optional[str] = Field(default=None, description="Name of the company queried.", alias="companyName") + 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") + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "reportName", "companyName", "generatedDate"] + + 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 LoanTransactionsReportInfo 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)`: - page_number: Annotated[Optional[int], pydantic.Field(alias="pageNumber")] = None - r"""The 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[Optional[int], pydantic.Field(alias="pageSize")] = None - r"""Queried page size.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - report_name: Annotated[Optional[str], pydantic.Field(alias="reportName")] = None - r"""The name of the report.""" + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LoanTransactionsReportInfo from a dict""" + if obj is None: + return None - total_results: Annotated[Optional[int], pydantic.Field(alias="totalResults")] = None - r"""The total number of transactions returned.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "companyName", - "generatedDate", - "pageNumber", - "pageSize", - "reportName", - "totalResults", - ] - ) - serialized = handler(self) - m = {} + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "reportName": obj.get("reportName"), + "companyName": obj.get("companyName"), + "generatedDate": obj.get("generatedDate") + }) + 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: - LoanTransactionsReportInfo.model_rebuild() -except NameError: - pass +class LoanTransactionsReportInfoTypedDict(TypedDict): + """TypedDict variant of LoanTransactionsReportInfo, for dict-literal request/response inputs.""" + page_number: NotRequired[Optional[int]] + page_size: NotRequired[Optional[int]] + total_results: NotRequired[Optional[int]] + report_name: NotRequired[Optional[str]] + company_name: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/locationref.py b/lending/src/codat_lending/models/shared/locationref.py index becb3731a..a8b3edf2e 100644 --- a/lending/src/codat_lending/models/shared/locationref.py +++ b/lending/src/codat_lending/models/shared/locationref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class LocationRefTypedDict(TypedDict): - r"""Reference to the geographic location where the order was placed.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique identitifer of the location being referenced.""" - name: NotRequired[str] - r"""Name of the location being referenced.""" + Do not edit the class manually. +""" # noqa: E501 -class LocationRef(BaseModel): - r"""Reference to the geographic location where the order was placed.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique identitifer of the location being referenced.""" +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 - name: Optional[str] = None - r"""Name of the location being referenced.""" +class LocationRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Reference to the geographic location where the order was placed. + """ # noqa: E501 + id: str = Field(description="The unique identitifer of the location being referenced.") + name: Optional[str] = Field(default=None, description="Name of the location being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 LocationRef 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 LocationRef 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") + }) + return _obj + + + + + +class LocationRefTypedDict(TypedDict): + """TypedDict variant of LocationRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/metadata.py b/lending/src/codat_lending/models/shared/metadata.py index 0f5a767d4..276602a97 100644 --- a/lending/src/codat_lending/models/shared/metadata.py +++ b/lending/src/codat_lending/models/shared/metadata.py @@ -1,56 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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.""" + 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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL 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"]) + 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: - Metadata.model_rebuild() -except NameError: - pass + _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/lending/src/codat_lending/models/shared/orderdiscountallocation.py b/lending/src/codat_lending/models/shared/orderdiscountallocation.py index 209000a0c..1006cf9b2 100644 --- a/lending/src/codat_lending/models/shared/orderdiscountallocation.py +++ b/lending/src/codat_lending/models/shared/orderdiscountallocation.py @@ -1,56 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class OrderDiscountAllocationTypedDict(TypedDict): - name: NotRequired[str] - r"""Name of the discount in the commerce or point of sale platform.""" - total_amount: NotRequired[Decimal] - r"""Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line).""" + 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_lending.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 OrderDiscountAllocation(BaseModel): - name: Optional[str] = None - r"""Name of the discount in the commerce or point of sale platform.""" - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line).""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name", "totalAmount"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + OrderDiscountAllocation + """ # noqa: E501 + name: Optional[str] = Field(default=None, description="Name of the discount in the commerce or point of sale platform.") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of discount applied, excluding tax. This is typically positive (for discounts which decrease the amount of the order line), but can also be negative (for discounts which increase the amount of the order line).", alias="totalAmount") + __properties: ClassVar[List[str]] = ["name", "totalAmount"] + + 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 OrderDiscountAllocation 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: - OrderDiscountAllocation.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 OrderDiscountAllocation 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"), + "totalAmount": obj.get("totalAmount") + }) + return _obj + + + + + +class OrderDiscountAllocationTypedDict(TypedDict): + """TypedDict variant of OrderDiscountAllocation, for dict-literal request/response inputs.""" + name: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/orderlineitem.py b/lending/src/codat_lending/models/shared/orderlineitem.py index 9c9fefddc..e207302c1 100644 --- a/lending/src/codat_lending/models/shared/orderlineitem.py +++ b/lending/src/codat_lending/models/shared/orderlineitem.py @@ -1,154 +1,152 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .orderdiscountallocation import ( - OrderDiscountAllocation, - OrderDiscountAllocationTypedDict, -) -from .productref import ProductRef, ProductRefTypedDict -from .productvariantref import ProductVariantRef, ProductVariantRefTypedDict -from .taxcomponentallocation import ( - TaxComponentAllocation, - TaxComponentAllocationTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class OrderLineItemTypedDict(TypedDict): - id: str - r"""A unique, persistent identifier for this record""" - discount_allocations: NotRequired[List[OrderDiscountAllocationTypedDict]] - product_ref: NotRequired[ProductRefTypedDict] - r"""Reference that links the line item to the correct product details.""" - product_variant_ref: NotRequired[ProductVariantRefTypedDict] - r"""Reference that links the line item to the specific version of product that has been ordered.""" - quantity: NotRequired[Decimal] - r"""Number of units of the product sold. - For refunds, quantity is negative. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - """ - tax_percentage: NotRequired[Decimal] - r"""Percentage rate (from 0 to 100) of any sales tax applied to the unit price.""" - taxes: NotRequired[List[TaxComponentAllocationTypedDict]] - r"""Taxes breakdown as applied to order lines.""" - total_amount: NotRequired[Decimal] - r"""Total amount of the line item, including discounts and tax.""" - total_tax_amount: NotRequired[Decimal] - r"""Total amount of tax applied to the line item, factoring in any discounts.""" - unit_price: NotRequired[Decimal] - r"""Price per unit of goods or services, excluding discounts and tax.""" + Do not edit the class manually. +""" # noqa: E501 -class OrderLineItem(BaseModel): - id: str - r"""A unique, persistent identifier for this record""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.orderdiscountallocation import OrderDiscountAllocation, OrderDiscountAllocationTypedDict +from codat_lending.models.shared.productref import ProductRef, ProductRefTypedDict +from codat_lending.models.shared.productvariantref import ProductVariantRef, ProductVariantRefTypedDict +from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocation, TaxComponentAllocationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - discount_allocations: Annotated[ - Optional[List[OrderDiscountAllocation]], - pydantic.Field(alias="discountAllocations"), - ] = None +class OrderLineItem(BaseModel): - product_ref: Annotated[Optional[ProductRef], pydantic.Field(alias="productRef")] = ( - 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} + """ + OrderLineItem + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + quantity: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Number of units of the product sold. For refunds, quantity is negative. ") + tax_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Percentage rate (from 0 to 100) of any sales tax applied to the unit price.", alias="taxPercentage") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of the line item, including discounts and tax.", alias="totalAmount") + total_tax_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of tax applied to the line item, factoring in any discounts.", alias="totalTaxAmount") + unit_price: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Price per unit of goods or services, excluding discounts and tax.", alias="unitPrice") + taxes: Optional[List[TaxComponentAllocation]] = Field(default=None, description="Taxes breakdown as applied to order lines.") + product_ref: Optional[ProductRef] = Field(default=None, alias="productRef") + product_variant_ref: Optional[ProductVariantRef] = Field(default=None, alias="productVariantRef") + discount_allocations: Optional[List[OrderDiscountAllocation]] = Field(default=None, alias="discountAllocations") + __properties: ClassVar[List[str]] = ["id", "quantity", "taxPercentage", "totalAmount", "totalTaxAmount", "unitPrice", "taxes", "productRef", "productVariantRef", "discountAllocations"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Reference that links the line item to the correct product details.""" - product_variant_ref: Annotated[ - Optional[ProductVariantRef], pydantic.Field(alias="productVariantRef") - ] = None - r"""Reference that links the line item to the specific version of product that has been ordered.""" - quantity: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Number of units of the product sold. - For refunds, quantity is negative. + 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()) - tax_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxPercentage"), - ] = None - r"""Percentage rate (from 0 to 100) of any sales tax applied to the unit price.""" - - taxes: Optional[List[TaxComponentAllocation]] = None - r"""Taxes breakdown as applied to order lines.""" - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount of the line item, including discounts and tax.""" - - total_tax_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalTaxAmount"), - ] = None - r"""Total amount of tax applied to the line item, factoring in any discounts.""" - - unit_price: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitPrice"), - ] = None - r"""Price per unit of goods or services, excluding discounts and tax.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderLineItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "discountAllocations", - "productRef", - "productVariantRef", - "quantity", - "taxPercentage", - "taxes", - "totalAmount", - "totalTaxAmount", - "unitPrice", - ] + 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 = {} + # override the default output from pydantic by calling `to_dict()` of each item in taxes (list) + _items = [] + if self.taxes: + for _item_taxes in self.taxes: + if _item_taxes: + _items.append(_item_taxes.to_dict()) + _dict['taxes'] = _items + # override the default output from pydantic by calling `to_dict()` of product_ref + if self.product_ref: + _dict['productRef'] = self.product_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of product_variant_ref + if self.product_variant_ref: + _dict['productVariantRef'] = self.product_variant_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in discount_allocations (list) + _items = [] + if self.discount_allocations: + for _item_discount_allocations in self.discount_allocations: + if _item_discount_allocations: + _items.append(_item_discount_allocations.to_dict()) + _dict['discountAllocations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderLineItem 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"), + "quantity": obj.get("quantity"), + "taxPercentage": obj.get("taxPercentage"), + "totalAmount": obj.get("totalAmount"), + "totalTaxAmount": obj.get("totalTaxAmount"), + "unitPrice": obj.get("unitPrice"), + "taxes": [TaxComponentAllocation.from_dict(_item) for _item in obj["taxes"]] if obj.get("taxes") is not None else None, + "productRef": ProductRef.from_dict(obj["productRef"]) if obj.get("productRef") is not None else None, + "productVariantRef": ProductVariantRef.from_dict(obj["productVariantRef"]) if obj.get("productVariantRef") is not None else None, + "discountAllocations": [OrderDiscountAllocation.from_dict(_item) for _item in obj["discountAllocations"]] if obj.get("discountAllocations") 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: - OrderLineItem.model_rebuild() -except NameError: - pass +class OrderLineItemTypedDict(TypedDict): + """TypedDict variant of OrderLineItem, for dict-literal request/response inputs.""" + id: NotRequired[str] + quantity: NotRequired[Optional[Decimal]] + tax_percentage: NotRequired[Optional[Decimal]] + total_amount: NotRequired[Optional[Decimal]] + total_tax_amount: NotRequired[Optional[Decimal]] + unit_price: NotRequired[Optional[Decimal]] + taxes: NotRequired[Optional[List[TaxComponentAllocationTypedDict]]] + product_ref: NotRequired[Optional[ProductRefTypedDict]] + product_variant_ref: NotRequired[Optional[ProductVariantRefTypedDict]] + discount_allocations: NotRequired[Optional[List[OrderDiscountAllocationTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/path.py b/lending/src/codat_lending/models/shared/path.py index 3cba924dd..600d9d5c5 100644 --- a/lending/src/codat_lending/models/shared/path.py +++ b/lending/src/codat_lending/models/shared/path.py @@ -1,8 +1,8 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations + from enum import Enum class Path(str, Enum): - AUTH_GET = "auth/get" + """Shared OAS parameter enum (lifted from components/parameters/path).""" + AUTH_GET = 'auth/get' diff --git a/lending/src/codat_lending/models/shared/payment.py b/lending/src/codat_lending/models/shared/payment.py index 75530c862..2e5f15b96 100644 --- a/lending/src/codat_lending/models/shared/payment.py +++ b/lending/src/codat_lending/models/shared/payment.py @@ -1,228 +1,132 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .bankingtransactionref import BankingTransactionRef, BankingTransactionRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 PaymentTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""Payment amount.""" - banking_transaction_refs: NotRequired[List[BankingTransactionRefTypedDict]] - 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP +""" + Lending - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - ## Examples with base currency of USD + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - 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. - """ - id: NotRequired[str] - r"""ID of the invoice, which may be a GUID but it may be something else depending on the accounting software.""" - payment_type: NotRequired[str] - r"""The type of payment.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.bankingtransactionref import BankingTransactionRef, BankingTransactionRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class Payment(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Payment amount.""" - banking_transaction_refs: Annotated[ - Optional[List[BankingTransactionRef]], - pydantic.Field(alias="bankingTransactionRefs"), - ] = None - - 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. - """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'currencyRate', 'currency_rate'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + Payment + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="ID of the invoice, which may be a GUID but it may be something else depending on 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: ``` 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="date") + payment_type: Optional[str] = Field(default=None, description="The type of payment.", alias="paymentType") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Payment amount.") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + banking_transaction_refs: Optional[List[BankingTransactionRef]] = Field(default=None, alias="bankingTransactionRefs") + __properties: ClassVar[List[str]] = ["id", "date", "paymentType", "amount", "currency", "currencyRate", "bankingTransactionRefs"] + + 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 Payment 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 banking_transaction_refs (list) + _items = [] + if self.banking_transaction_refs: + for _item_banking_transaction_refs in self.banking_transaction_refs: + if _item_banking_transaction_refs: + _items.append(_item_banking_transaction_refs.to_dict()) + _dict['bankingTransactionRefs'] = _items + return _dict - 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: - - ``` - 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 Payment 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({ + "id": obj.get("id"), + "date": obj.get("date"), + "paymentType": obj.get("paymentType"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "bankingTransactionRefs": [BankingTransactionRef.from_dict(_item) for _item in obj["bankingTransactionRefs"]] if obj.get("bankingTransactionRefs") is not None else None + }) + 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. - """ - id: Optional[str] = None - r"""ID of the invoice, which may be a GUID but it may be something else depending on the accounting software.""" - payment_type: Annotated[Optional[str], pydantic.Field(alias="paymentType")] = None - r"""The type of payment.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amount", - "bankingTransactionRefs", - "currency", - "currencyRate", - "date", - "id", - "paymentType", - ] - ) - nullable_fields = set(["currencyRate"]) - 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: - Payment.model_rebuild() -except NameError: - pass +class PaymentTypedDict(TypedDict): + """TypedDict variant of Payment, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + date_: NotRequired[Optional[str]] + payment_type: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + banking_transaction_refs: NotRequired[Optional[List[BankingTransactionRefTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/paymentallocationpayment.py b/lending/src/codat_lending/models/shared/paymentallocationpayment.py index 84d6fa2f0..f2c866cec 100644 --- a/lending/src/codat_lending/models/shared/paymentallocationpayment.py +++ b/lending/src/codat_lending/models/shared/paymentallocationpayment.py @@ -1,238 +1,131 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountref import AccountRef, AccountRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 PaymentAllocationPaymentTypedDict(TypedDict): - account_ref: NotRequired[AccountRefTypedDict] - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. +""" + Lending - ## Examples with base currency of GBP + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Identifier of the allocated payment.""" - note: NotRequired[Nullable[str]] - r"""Notes attached to the allocated payment.""" - paid_on_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. - """ - reference: NotRequired[Nullable[str]] - r"""Reference to the allocated payment.""" - total_amount: NotRequired[Decimal] - r"""Total amount that was paid.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountref import AccountRef, AccountRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class PaymentAllocationPayment(BaseModel): - account_ref: Annotated[Optional[AccountRef], pydantic.Field(alias="accountRef")] = ( - None - ) - r"""Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked 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 = {'currencyRate', 'currency_rate', 'note', 'reference'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + PaymentAllocationPayment + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Identifier of the allocated payment.") + note: OptionalNullable[str] = Field(default=UNSET, description="Notes attached to the allocated payment.") + reference: OptionalNullable[str] = Field(default=UNSET, description="Reference to the allocated payment.") + account_ref: Optional[AccountRef] = Field(default=None, description="The account that the allocated payment is made from or to.", alias="accountRef") + 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.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + paid_on_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="paidOnDate") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount that was paid.", alias="totalAmount") + __properties: ClassVar[List[str]] = ["id", "note", "reference", "accountRef", "currency", "currencyRate", "paidOnDate", "totalAmount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - ### Integration-specific details + 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()) - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaymentAllocationPayment from a JSON string""" + return cls.from_dict(json.loads(json_str)) - id: Optional[str] = None - r"""Identifier of the allocated payment.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - note: OptionalNullable[str] = UNSET - r"""Notes attached to the allocated payment.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - paid_on_date: Annotated[Optional[str], pydantic.Field(alias="paidOnDate")] = 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. + """ + excluded_fields: Set[str] = set([ + ]) - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + _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_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + return _dict + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaymentAllocationPayment 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({ + "id": obj.get("id"), + "note": obj.get("note"), + "reference": obj.get("reference"), + "accountRef": AccountRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "currency": obj.get("currency"), + "currencyRate": obj.get("currencyRate"), + "paidOnDate": obj.get("paidOnDate"), + "totalAmount": obj.get("totalAmount") + }) + 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. - """ - reference: OptionalNullable[str] = UNSET - r"""Reference to the allocated payment.""" - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount that was paid.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "accountRef", - "currency", - "currencyRate", - "id", - "note", - "paidOnDate", - "reference", - "totalAmount", - ] - ) - nullable_fields = set(["currencyRate", "note", "reference"]) - 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: - PaymentAllocationPayment.model_rebuild() -except NameError: - pass +class PaymentAllocationPaymentTypedDict(TypedDict): + """TypedDict variant of PaymentAllocationPayment, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + note: NotRequired[Optional[str]] + reference: NotRequired[Optional[str]] + account_ref: NotRequired[Optional[AccountRefTypedDict]] + currency: NotRequired[Optional[str]] + currency_rate: NotRequired[Optional[Decimal]] + paid_on_date: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/paymentline.py b/lending/src/codat_lending/models/shared/paymentline.py index 3596aa3bd..abde3d766 100644 --- a/lending/src/codat_lending/models/shared/paymentline.py +++ b/lending/src/codat_lending/models/shared/paymentline.py @@ -1,112 +1,120 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .paymentlinelink import PaymentLineLink, PaymentLineLinkTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 - +from codat_lending.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_lending.models.shared.paymentlinelink import PaymentLineLink, PaymentLineLinkTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class PaymentLine(BaseModel): -class PaymentLineTypedDict(TypedDict): - amount: Decimal - r"""Amount in the payment currency.""" - allocated_on_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: + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'links'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + PaymentLine + """ # noqa: E501 + amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount in the payment currency.") + links: OptionalNullable[List[PaymentLineLink]] = UNSET + allocated_on_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="allocatedOnDate") + __properties: ClassVar[List[str]] = ["amount", "links", "allocatedOnDate"] - ``` - 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 PaymentLine 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. - """ - links: NotRequired[Nullable[List[PaymentLineLinkTypedDict]]] + 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 PaymentLine(BaseModel): - amount: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Amount in the payment currency.""" + * `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([ + ]) - allocated_on_date: Annotated[ - Optional[str], pydantic.Field(alias="allocatedOnDate") - ] = 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 each item in links (list) + _items = [] + if self.links: + for _item_links in self.links: + if _item_links: + _items.append(_item_links.to_dict()) + _dict['links'] = _items + 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 PaymentLine from a dict""" + if obj is None: + return None + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "links": [PaymentLineLink.from_dict(_item) for _item in obj["links"]] if obj.get("links") is not None else None, + "allocatedOnDate": obj.get("allocatedOnDate") + }) + 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. - """ - links: OptionalNullable[List[PaymentLineLink]] = UNSET - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["allocatedOnDate", "links"]) - nullable_fields = set(["links"]) - 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: - PaymentLine.model_rebuild() -except NameError: - pass +class PaymentLineTypedDict(TypedDict): + """TypedDict variant of PaymentLine, for dict-literal request/response inputs.""" + amount: NotRequired[Decimal] + links: NotRequired[Optional[List[PaymentLineLinkTypedDict]]] + allocated_on_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/paymentlinelink.py b/lending/src/codat_lending/models/shared/paymentlinelink.py index 57d430c69..879b70598 100644 --- a/lending/src/codat_lending/models/shared/paymentlinelink.py +++ b/lending/src/codat_lending/models/shared/paymentlinelink.py @@ -1,178 +1,130 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .paymentlinktype import PaymentLinkType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 PaymentLineLinkTypedDict(TypedDict): - type: PaymentLinkType - r"""Types of payment line links, either: - `Unknown` - `Unlinked` - Not used - `Invoice` - ID refers to the invoice - `CreditNote` - ID refers to the credit note - `Refund` - ID refers to the sibling payment - `Payment` - ID refers to the sibling payment - `PaymentOnAccount` - ID refers to the customer - `Other` - ID refers to the customer - `Manual Journal` - `Discount` - ID refers to the payment - """ - amount: NotRequired[Nullable[Decimal]] - r"""Amount by which the balance of the linked entity is altered, in the currency of the linked entity. - A negative link amount _reduces_ the outstanding amount on the accounts receivable account. - A positive link amount _increases_ the outstanding amount on the accounts receivable account. - """ - currency_rate: NotRequired[Nullable[Decimal]] - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. +""" + Lending - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | - - - ### Integration-specific details - - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: NotRequired[str] - r"""Unique identifier of the transaction represented by the link.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.paymentlinktype import PaymentLinkType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class PaymentLineLink(BaseModel): - type: PaymentLinkType - r"""Types of payment line links, either: - `Unknown` - `Unlinked` - Not used - `Invoice` - ID refers to the invoice - `CreditNote` - ID refers to the credit note - `Refund` - ID refers to the sibling payment - `Payment` - ID refers to the sibling payment - `PaymentOnAccount` - ID refers to the customer - `Other` - ID refers to the customer - `Manual Journal` - `Discount` - ID refers to the payment - """ - amount: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Amount by which the balance of the linked entity is altered, in the currency of the linked entity. - A negative link amount _reduces_ the outstanding amount on the accounts receivable account. - A positive link amount _increases_ the outstanding amount on the accounts receivable account. + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'amount', 'currencyRate', 'currency_rate'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ - - currency_rate: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="currencyRate"), - ] = UNSET - r"""Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. - - Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. - - It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. - - Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). - - For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. - - ## Examples with base currency of GBP - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **USD** | $20 | 0.781 | £15.62 | - | **EUR** | €20 | 0.885 | £17.70 | - | **RUB** | ₽20 | 0.011 | £0.22 | - - ## Examples with base currency of USD - - | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | - | :--------------- | :------------- | :------------ | :------------------------- | - | **GBP** | £20 | 1.277 | $25.54 | - | **EUR** | €20 | 1.134 | $22.68 | - | **RUB** | ₽20 | 0.015 | $0.30 | + PaymentLineLink + """ # noqa: E501 + type: PaymentLinkType + id: Optional[str] = Field(default=None, description="Unique identifier of the transaction represented by the link.") + amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Amount by which the balance of the linked entity is altered, in the currency of the linked entity. A negative link amount _reduces_ the outstanding amount on the accounts receivable account. A positive link amount _increases_ the outstanding amount on the accounts receivable account.") + currency_rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. ## Examples with base currency of GBP | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | | :--------------- | :------------- | :------------ | :------------------------- | | **USD** | $20 | 0.781 | £15.62 | | **EUR** | €20 | 0.885 | £17.70 | | **RUB** | ₽20 | 0.011 | £0.22 | ## Examples with base currency of USD | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | | :--------------- | :------------- | :------------ | :------------------------- | | **GBP** | £20 | 1.277 | $25.54 | | **EUR** | €20 | 1.134 | $22.68 | | **RUB** | ₽20 | 0.015 | $0.30 | ### Integration-specific details | Integration | Scenario | System behavior | |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. |", alias="currencyRate") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type", "id", "amount", "currencyRate"] + + 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 PaymentLineLink 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 PaymentLineLink 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"), + "id": obj.get("id"), + "amount": obj.get("amount"), + "currencyRate": obj.get("currencyRate") + }) + # 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 - ### Integration-specific details - | Integration | Scenario | System behavior | - |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | - """ - id: Optional[str] = None - r"""Unique identifier of the transaction represented by the link.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["amount", "currencyRate", "id"]) - nullable_fields = set(["amount", "currencyRate"]) - 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: - PaymentLineLink.model_rebuild() -except NameError: - pass +class PaymentLineLinkTypedDict(TypedDict): + """TypedDict variant of PaymentLineLink, for dict-literal request/response inputs.""" + type: PaymentLinkType + id: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency_rate: NotRequired[Optional[Decimal]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/paymentlinktype.py b/lending/src/codat_lending/models/shared/paymentlinktype.py index 76a34d141..4c78ee54d 100644 --- a/lending/src/codat_lending/models/shared/paymentlinktype.py +++ b/lending/src/codat_lending/models/shared/paymentlinktype.py @@ -1,30 +1,46 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 PaymentLinkType(str, Enum): - r"""Types of payment line links, either: - `Unknown` - `Unlinked` - Not used - `Invoice` - ID refers to the invoice - `CreditNote` - ID refers to the credit note - `Refund` - ID refers to the sibling payment - `Payment` - ID refers to the sibling payment - `PaymentOnAccount` - ID refers to the customer - `Other` - ID refers to the customer - `Manual Journal` - `Discount` - ID refers to the payment """ + Types of payment line links, either: `Unknown` `Unlinked` - Not used `Invoice` - ID refers to the invoice `CreditNote` - ID refers to the credit note `Refund` - ID refers to the sibling payment `Payment` - ID refers to the sibling payment `PaymentOnAccount` - ID refers to the customer `Other` - ID refers to the customer `Manual Journal` `Discount` - ID refers to the payment + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + UNLINKED = 'Unlinked' + INVOICE = 'Invoice' + CREDIT_NOTE = 'CreditNote' + OTHER = 'Other' + REFUND = 'Refund' + PAYMENT = 'Payment' + PAYMENT_ON_ACCOUNT = 'PaymentOnAccount' + MANUAL_JOURNAL = 'ManualJournal' + DISCOUNT = 'Discount' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PaymentLinkType from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - UNLINKED = "Unlinked" - INVOICE = "Invoice" - CREDIT_NOTE = "CreditNote" - OTHER = "Other" - REFUND = "Refund" - PAYMENT = "Payment" - PAYMENT_ON_ACCOUNT = "PaymentOnAccount" - MANUAL_JOURNAL = "ManualJournal" - DISCOUNT = "Discount" diff --git a/lending/src/codat_lending/models/shared/paymentmethodref.py b/lending/src/codat_lending/models/shared/paymentmethodref.py index 01eb8a46a..bb76fccf5 100644 --- a/lending/src/codat_lending/models/shared/paymentmethodref.py +++ b/lending/src/codat_lending/models/shared/paymentmethodref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class PaymentMethodRefTypedDict(TypedDict): - r"""The payment method the record is linked to in the accounting or commerce software.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique identifier of the location being referenced.""" - name: NotRequired[str] - r"""Name of the location being referenced.""" + Do not edit the class manually. +""" # noqa: E501 -class PaymentMethodRef(BaseModel): - r"""The payment method the record is linked to in the accounting or commerce software.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique identifier of the location being referenced.""" +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 - name: Optional[str] = None - r"""Name of the location being referenced.""" +class PaymentMethodRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + The payment method the record is linked to in the accounting or commerce software. + """ # noqa: E501 + id: str = Field(description="The unique identifier of the location being referenced.") + name: Optional[str] = Field(default=None, description="Name of the location being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 PaymentMethodRef 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 PaymentMethodRef 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") + }) + return _obj + + + + + +class PaymentMethodRefTypedDict(TypedDict): + """TypedDict variant of PaymentMethodRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/paymentref.py b/lending/src/codat_lending/models/shared/paymentref.py index 9d5227cc4..8303207a3 100644 --- a/lending/src/codat_lending/models/shared/paymentref.py +++ b/lending/src/codat_lending/models/shared/paymentref.py @@ -1,212 +1,135 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .paymentstatus import PaymentStatus -from .paymenttype import PaymentType -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 PaymentRefTypedDict(TypedDict): - id: str - r"""A unique, persistent identifier for this record""" - amount: NotRequired[Nullable[Decimal]] - r"""Payment Amount (including gratuity).""" - created_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. - """ - 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. - """ - due_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - modified_date: NotRequired[str] - payment_provider: NotRequired[str] - r"""Service provider of the payment, if applicable.""" - source_modified_date: NotRequired[str] - status: NotRequired[PaymentStatus] - r"""Status of the payment.""" - type: NotRequired[Nullable[PaymentType]] - r"""Type of payment.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.paymentstatus import PaymentStatus +from codat_lending.models.shared.paymenttype import PaymentType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class PaymentRef(BaseModel): - id: str - r"""A unique, persistent identifier for this record""" - - amount: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Payment Amount (including gratuity).""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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. - """ - - 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 = {'amount', 'type'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + PaymentRef + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + created_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="createdDate") + 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") + amount: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Payment Amount (including gratuity).") + 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.") + type: OptionalNullable[PaymentType] = UNSET + status: Optional[PaymentStatus] = None + payment_provider: Optional[str] = Field(default=None, description="Service provider of the payment, if applicable.", alias="paymentProvider") + due_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="dueDate") + __properties: ClassVar[List[str]] = ["id", "createdDate", "modifiedDate", "sourceModifiedDate", "amount", "currency", "type", "status", "paymentProvider", "dueDate"] + + 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 PaymentRef 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 - due_date: Annotated[Optional[str], pydantic.Field(alias="dueDate")] = 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` + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaymentRef from a dict""" + if obj is None: + return None - > 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. - """ + if not isinstance(obj, dict): + return cls.model_validate(obj) - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "type": obj.get("type"), + "status": obj.get("status"), + "paymentProvider": obj.get("paymentProvider"), + "dueDate": obj.get("dueDate") + }) + return _obj - payment_provider: Annotated[ - Optional[str], pydantic.Field(alias="paymentProvider") - ] = None - r"""Service provider of the payment, if applicable.""" - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None - status: Optional[PaymentStatus] = None - r"""Status of the payment.""" - type: OptionalNullable[PaymentType] = UNSET - r"""Type of payment.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "amount", - "createdDate", - "currency", - "dueDate", - "modifiedDate", - "paymentProvider", - "sourceModifiedDate", - "status", - "type", - ] - ) - nullable_fields = set(["amount", "type"]) - 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: - PaymentRef.model_rebuild() -except NameError: - pass +class PaymentRefTypedDict(TypedDict): + """TypedDict variant of PaymentRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + currency: NotRequired[Optional[str]] + type: NotRequired[Optional[PaymentType]] + status: NotRequired[Optional[PaymentStatus]] + payment_provider: NotRequired[Optional[str]] + due_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/paymentstatus.py b/lending/src/codat_lending/models/shared/paymentstatus.py index c8efdd84c..4388421a7 100644 --- a/lending/src/codat_lending/models/shared/paymentstatus.py +++ b/lending/src/codat_lending/models/shared/paymentstatus.py @@ -1,15 +1,42 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 PaymentStatus(str, Enum): - r"""Status of the payment.""" - - PENDING = "Pending" - AUTHORIZED = "Authorized" - PAID = "Paid" - FAILED = "Failed" - CANCELLED = "Cancelled" - UNKNOWN = "Unknown" + """ + Status of the payment. + """ + + """ + allowed enum values + """ + PENDING = 'Pending' + AUTHORIZED = 'Authorized' + PAID = 'Paid' + FAILED = 'Failed' + CANCELLED = 'Cancelled' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PaymentStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/paymenttype.py b/lending/src/codat_lending/models/shared/paymenttype.py index 6144c553c..55d9faa9d 100644 --- a/lending/src/codat_lending/models/shared/paymenttype.py +++ b/lending/src/codat_lending/models/shared/paymenttype.py @@ -1,21 +1,48 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 PaymentType(str, Enum): - r"""Type of payment.""" - - CASH = "Cash" - CARD = "Card" - INVOICE = "Invoice" - ONLINE_CARD = "OnlineCard" - SWISH = "Swish" - VIPPS = "Vipps" - MOBILE = "Mobile" - STORE_CREDIT = "StoreCredit" - PAYPAL = "Paypal" - CUSTOM = "Custom" - PREPAID = "Prepaid" - UNKNOWN = "Unknown" + """ + Type of payment. + """ + + """ + allowed enum values + """ + CASH = 'Cash' + CARD = 'Card' + INVOICE = 'Invoice' + ONLINE_CARD = 'OnlineCard' + SWISH = 'Swish' + VIPPS = 'Vipps' + MOBILE = 'Mobile' + STORE_CREDIT = 'StoreCredit' + PAYPAL = 'Paypal' + CUSTOM = 'Custom' + PREPAID = 'Prepaid' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of PaymentType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/periodunit.py b/lending/src/codat_lending/models/shared/periodunit.py index 6291cebca..754edc76c 100644 --- a/lending/src/codat_lending/models/shared/periodunit.py +++ b/lending/src/codat_lending/models/shared/periodunit.py @@ -1,11 +1,11 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations + from enum import Enum class PeriodUnit(str, Enum): - DAY = "Day" - WEEK = "Week" - MONTH = "Month" - YEAR = "Year" + """Shared OAS parameter enum (lifted from components/parameters/periodUnit).""" + DAY = 'Day' + WEEK = 'Week' + MONTH = 'Month' + YEAR = 'Year' diff --git a/lending/src/codat_lending/models/shared/phonenumber.py b/lending/src/codat_lending/models/shared/phonenumber.py index bd09e956c..198eb8f1f 100644 --- a/lending/src/codat_lending/models/shared/phonenumber.py +++ b/lending/src/codat_lending/models/shared/phonenumber.py @@ -1,63 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from enum import Enum -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict - - -class PhoneNumberType(str, Enum): - r"""The type of phone number""" - - PRIMARY = "Primary" - LANDLINE = "Landline" - MOBILE = "Mobile" - FAX = "Fax" - UNKNOWN = "Unknown" - -class PhoneNumberTypedDict(TypedDict): - type: PhoneNumberType - r"""The type of phone number""" - number: NotRequired[Nullable[str]] - r"""A phone number.""" - - -class PhoneNumber(BaseModel): - type: PhoneNumberType - r"""The type of phone number""" - - number: OptionalNullable[str] = UNSET - r"""A phone number.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["number"]) - nullable_fields = set(["number"]) - 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 - ) +from enum import Enum - 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 codat_lending.models._compat.phonenumber import PhoneNumberType diff --git a/lending/src/codat_lending/models/shared/productinventory.py b/lending/src/codat_lending/models/shared/productinventory.py index 54d48380e..7ebab30c6 100644 --- a/lending/src/codat_lending/models/shared/productinventory.py +++ b/lending/src/codat_lending/models/shared/productinventory.py @@ -1,77 +1,117 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .productinventorylocation import ( - ProductInventoryLocation, - ProductInventoryLocationTypedDict, -) -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ProductInventoryTypedDict(TypedDict): - r"""Information about the total inventory as well as the locations inventory is in.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - locations: NotRequired[List[ProductInventoryLocationTypedDict]] - total_quantity: NotRequired[Nullable[Decimal]] - r"""The total quantity of stock remaining across locations.""" + Do not edit the class manually. +""" # noqa: E501 -class ProductInventory(BaseModel): - r"""Information about the total inventory as well as the locations inventory is in.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json - locations: Optional[List[ProductInventoryLocation]] = None +from pydantic import BeforeValidator, PlainSerializer, BaseModel, ConfigDict, Field, model_serializer +from typing import Annotated, Any, ClassVar, Dict, List, Optional, Union +from codat_lending.models.shared.productinventorylocation import ProductInventoryLocation, ProductInventoryLocationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - total_quantity: Annotated[ - Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalQuantity"), - ] = UNSET - r"""The total quantity of stock remaining across locations.""" +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ProductInventory(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["locations", "totalQuantity"]) - nullable_fields = set(["totalQuantity"]) + 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: - ProductInventory.model_rebuild() -except NameError: - pass + _nullable = {'totalQuantity', 'total_quantity'} + 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 total inventory as well as the locations inventory is in. + """ # noqa: E501 + total_quantity: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="The total quantity of stock remaining across locations.", alias="totalQuantity") + locations: Optional[List[ProductInventoryLocation]] = None + __properties: ClassVar[List[str]] = ["totalQuantity", "locations"] + + 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 ProductInventory 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 locations (list) + _items = [] + if self.locations: + for _item_locations in self.locations: + if _item_locations: + _items.append(_item_locations.to_dict()) + _dict['locations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductInventory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "totalQuantity": obj.get("totalQuantity"), + "locations": [ProductInventoryLocation.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None + }) + return _obj + + + + + +class ProductInventoryTypedDict(TypedDict): + """TypedDict variant of ProductInventory, for dict-literal request/response inputs.""" + total_quantity: NotRequired[Optional[Decimal]] + locations: NotRequired[Optional[List[ProductInventoryLocationTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/productinventorylocation.py b/lending/src/codat_lending/models/shared/productinventorylocation.py index 72beda703..93151788e 100644 --- a/lending/src/codat_lending/models/shared/productinventorylocation.py +++ b/lending/src/codat_lending/models/shared/productinventorylocation.py @@ -1,56 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .locationref import LocationRef, LocationRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ProductInventoryLocationTypedDict(TypedDict): - location_ref: NotRequired[LocationRefTypedDict] - r"""Reference to the geographic location where the order was placed.""" - quantity: NotRequired[Decimal] - r"""The quantity of stock remaining at location.""" + 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_lending.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_lending.models.shared.locationref import LocationRef, LocationRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class ProductInventoryLocation(BaseModel): - location_ref: Annotated[ - Optional[LocationRef], pydantic.Field(alias="locationRef") - ] = None - r"""Reference to the geographic location where the order was placed.""" - - quantity: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The quantity of stock remaining at location.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["locationRef", "quantity"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + ProductInventoryLocation + """ # noqa: E501 + quantity: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The quantity of stock remaining at location.") + location_ref: Optional[LocationRef] = Field(default=None, alias="locationRef") + __properties: ClassVar[List[str]] = ["quantity", "locationRef"] + + 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 ProductInventoryLocation 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: - ProductInventoryLocation.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 location_ref + if self.location_ref: + _dict['locationRef'] = self.location_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductInventoryLocation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "quantity": obj.get("quantity"), + "locationRef": LocationRef.from_dict(obj["locationRef"]) if obj.get("locationRef") is not None else None + }) + return _obj + + + + + +class ProductInventoryLocationTypedDict(TypedDict): + """TypedDict variant of ProductInventoryLocation, for dict-literal request/response inputs.""" + quantity: NotRequired[Optional[Decimal]] + location_ref: NotRequired[Optional[LocationRefTypedDict]] diff --git a/lending/src/codat_lending/models/shared/productprice.py b/lending/src/codat_lending/models/shared/productprice.py index 4d81e8e9b..b6a4911e4 100644 --- a/lending/src/codat_lending/models/shared/productprice.py +++ b/lending/src/codat_lending/models/shared/productprice.py @@ -1,70 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +from codat_lending.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 ProductPriceTypedDict(TypedDict): - 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_. +class ProductPrice(BaseModel): - ## Unknown currencies + @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} + """ + ProductPrice + """ # noqa: E501 + 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.") + unit_price: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The product variant's unit price.", alias="unitPrice") + __properties: ClassVar[List[str]] = ["currency", "unitPrice"] - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ - unit_price: NotRequired[Decimal] - r"""The product variant's unit price.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) -class ProductPrice(BaseModel): - 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_. + 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()) - ## Unknown currencies + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductPrice from a JSON string""" + return cls.from_dict(json.loads(json_str)) - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - unit_price: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="unitPrice"), - ] = None - r"""The product variant's unit price.""" + * `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(["currency", "unitPrice"]) - serialized = handler(self) - m = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _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_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductPrice from a dict""" + if obj is None: + return None - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + if not isinstance(obj, dict): + return cls.model_validate(obj) - return m + _obj = cls.model_validate({ + "currency": obj.get("currency"), + "unitPrice": obj.get("unitPrice") + }) + return _obj -try: - ProductPrice.model_rebuild() -except NameError: - pass + + + +class ProductPriceTypedDict(TypedDict): + """TypedDict variant of ProductPrice, for dict-literal request/response inputs.""" + currency: NotRequired[Optional[str]] + unit_price: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/productref.py b/lending/src/codat_lending/models/shared/productref.py index 39a789fa1..d496bcf80 100644 --- a/lending/src/codat_lending/models/shared/productref.py +++ b/lending/src/codat_lending/models/shared/productref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ProductRefTypedDict(TypedDict): - r"""Reference that links the line item to the correct product details.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique identifier of the product being referenced.""" - name: NotRequired[str] - r"""Name of the product being referenced.""" + Do not edit the class manually. +""" # noqa: E501 -class ProductRef(BaseModel): - r"""Reference that links the line item to the correct product details.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique identifier of the product being referenced.""" +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 - name: Optional[str] = None - r"""Name of the product being referenced.""" +class ProductRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Reference that links the line item to the correct product details. + """ # noqa: E501 + id: str = Field(description="The unique identifier of the product being referenced.") + name: Optional[str] = Field(default=None, description="Name of the product being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 ProductRef 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 ProductRef 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") + }) + return _obj + + + + + +class ProductRefTypedDict(TypedDict): + """TypedDict variant of ProductRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/productvariant.py b/lending/src/codat_lending/models/shared/productvariant.py index 1b969aa24..8b9f98d92 100644 --- a/lending/src/codat_lending/models/shared/productvariant.py +++ b/lending/src/codat_lending/models/shared/productvariant.py @@ -1,181 +1,153 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .productinventory import ProductInventory, ProductInventoryTypedDict -from .productprice import ProductPrice, ProductPriceTypedDict -from .productvariantstatus import ProductVariantStatus -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 ProductVariantTypedDict(TypedDict): - r"""Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors.""" - - id: str - r"""A unique, persistent identifier for this record""" - barcode: NotRequired[str] - r"""Unique product number of the variant. This might be a barcode, UPC, ISBN, etc.""" - created_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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - inventory: NotRequired[ProductInventoryTypedDict] - r"""Information about the total inventory as well as the locations inventory is in.""" - is_tax_enabled: NotRequired[bool] - r"""Whether sales taxes are enabled for this product variant.""" - modified_date: NotRequired[str] - name: NotRequired[str] - r"""Name of the product recorded in the commerce or point of sale platform.""" - prices: NotRequired[List[ProductPriceTypedDict]] - r"""Prices for the product variants in different currencies.""" - shipping_required: NotRequired[bool] - r"""Indicates whether or not the product requires physical delivery.""" - sku: NotRequired[str] - r"""SKU (stock keeping unit) of the variant, as defined by the merchant.""" - source_modified_date: NotRequired[str] - status: NotRequired[ProductVariantStatus] - r"""The status of the product variant.""" - unit_of_measure: NotRequired[str] - r"""Unit of measure for the variant, such as `kg` or `meters`.""" - vat_percentage: NotRequired[Decimal] - r"""VAT rate for the product variant if sales taxes are enabled.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.productinventory import ProductInventory, ProductInventoryTypedDict +from codat_lending.models.shared.productprice import ProductPrice, ProductPriceTypedDict +from codat_lending.models.shared.productvariantstatus import ProductVariantStatus +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class ProductVariant(BaseModel): - r"""Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors.""" - - id: str - r"""A unique, persistent identifier for this record""" - - barcode: Optional[str] = None - r"""Unique product number of the variant. This might be a barcode, UPC, ISBN, etc.""" - - created_date: Annotated[Optional[str], pydantic.Field(alias="createdDate")] = 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) + return {k: v for k, v in serialized.items() if v is not None} """ - + Represents a variation of a product available for sale, for example an item of clothing that may be available for sale in multiple sizes and colors. + """ # noqa: E501 + id: str = Field(description="A unique, persistent identifier for this record") + created_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="createdDate") + 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") + name: Optional[str] = Field(default=None, description="Name of the product recorded in the commerce or point of sale platform.") + is_tax_enabled: Optional[bool] = Field(default=None, description="Whether sales taxes are enabled for this product variant.", alias="isTaxEnabled") + sku: Optional[str] = Field(default=None, description="SKU (stock keeping unit) of the variant, as defined by the merchant.") + barcode: Optional[str] = Field(default=None, description="Unique product number of the variant. This might be a barcode, UPC, ISBN, etc.") + unit_of_measure: Optional[str] = Field(default=None, description="Unit of measure for the variant, such as `kg` or `meters`.", alias="unitOfMeasure") + vat_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="VAT rate for the product variant if sales taxes are enabled.", alias="vatPercentage") + prices: Optional[List[ProductPrice]] = Field(default=None, description="Prices for the product variants in different currencies.") inventory: Optional[ProductInventory] = None - r"""Information about the total inventory as well as the locations inventory is in.""" + shipping_required: Optional[bool] = Field(default=None, description="Indicates whether or not the product requires physical delivery.", alias="shippingRequired") + status: Optional[ProductVariantStatus] = None + __properties: ClassVar[List[str]] = ["id", "createdDate", "modifiedDate", "sourceModifiedDate", "name", "isTaxEnabled", "sku", "barcode", "unitOfMeasure", "vatPercentage", "prices", "inventory", "shippingRequired", "status"] - is_tax_enabled: Annotated[Optional[bool], pydantic.Field(alias="isTaxEnabled")] = ( - None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Whether sales taxes are enabled for this product variant.""" - - modified_date: Annotated[Optional[str], pydantic.Field(alias="modifiedDate")] = None - name: Optional[str] = None - r"""Name of the product recorded in the commerce or point of sale platform.""" - prices: Optional[List[ProductPrice]] = None - r"""Prices for the product variants in different currencies.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - shipping_required: Annotated[ - Optional[bool], pydantic.Field(alias="shippingRequired") - ] = None - r"""Indicates whether or not the product requires physical delivery.""" + 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()) - sku: Optional[str] = None - r"""SKU (stock keeping unit) of the variant, as defined by the merchant.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProductVariant from a JSON string""" + return cls.from_dict(json.loads(json_str)) - source_modified_date: Annotated[ - Optional[str], pydantic.Field(alias="sourceModifiedDate") - ] = None + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - status: Optional[ProductVariantStatus] = None - r"""The status of the product variant.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - unit_of_measure: Annotated[Optional[str], pydantic.Field(alias="unitOfMeasure")] = ( - None - ) - r"""Unit of measure for the variant, such as `kg` or `meters`.""" - - vat_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="vatPercentage"), - ] = None - r"""VAT rate for the product variant if sales taxes are enabled.""" + * `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( - [ - "barcode", - "createdDate", - "inventory", - "isTaxEnabled", - "modifiedDate", - "name", - "prices", - "shippingRequired", - "sku", - "sourceModifiedDate", - "status", - "unitOfMeasure", - "vatPercentage", - ] + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, ) - serialized = handler(self) - m = {} + # override the default output from pydantic by calling `to_dict()` of each item in prices (list) + _items = [] + if self.prices: + for _item_prices in self.prices: + if _item_prices: + _items.append(_item_prices.to_dict()) + _dict['prices'] = _items + # override the default output from pydantic by calling `to_dict()` of inventory + if self.inventory: + _dict['inventory'] = self.inventory.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProductVariant 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"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "sourceModifiedDate": obj.get("sourceModifiedDate"), + "name": obj.get("name"), + "isTaxEnabled": obj.get("isTaxEnabled"), + "sku": obj.get("sku"), + "barcode": obj.get("barcode"), + "unitOfMeasure": obj.get("unitOfMeasure"), + "vatPercentage": obj.get("vatPercentage"), + "prices": [ProductPrice.from_dict(_item) for _item in obj["prices"]] if obj.get("prices") is not None else None, + "inventory": ProductInventory.from_dict(obj["inventory"]) if obj.get("inventory") is not None else None, + "shippingRequired": obj.get("shippingRequired"), + "status": obj.get("status") + }) + 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: - ProductVariant.model_rebuild() -except NameError: - pass +class ProductVariantTypedDict(TypedDict): + """TypedDict variant of ProductVariant, for dict-literal request/response inputs.""" + id: NotRequired[str] + created_date: NotRequired[Optional[str]] + modified_date: NotRequired[Optional[str]] + source_modified_date: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + is_tax_enabled: NotRequired[Optional[bool]] + sku: NotRequired[Optional[str]] + barcode: NotRequired[Optional[str]] + unit_of_measure: NotRequired[Optional[str]] + vat_percentage: NotRequired[Optional[Decimal]] + prices: NotRequired[Optional[List[ProductPriceTypedDict]]] + inventory: NotRequired[Optional[ProductInventoryTypedDict]] + shipping_required: NotRequired[Optional[bool]] + status: NotRequired[Optional[ProductVariantStatus]] diff --git a/lending/src/codat_lending/models/shared/productvariantref.py b/lending/src/codat_lending/models/shared/productvariantref.py index ba795803b..ed0d43e39 100644 --- a/lending/src/codat_lending/models/shared/productvariantref.py +++ b/lending/src/codat_lending/models/shared/productvariantref.py @@ -1,42 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ProductVariantRefTypedDict(TypedDict): - r"""Reference that links the line item to the specific version of product that has been ordered.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique identifier of the product variant being referenced.""" - name: NotRequired[str] - r"""Name of the product variant being referenced.""" + Do not edit the class manually. +""" # noqa: E501 -class ProductVariantRef(BaseModel): - r"""Reference that links the line item to the specific version of product that has been ordered.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique identifier of the product variant being referenced.""" +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 - name: Optional[str] = None - r"""Name of the product variant being referenced.""" +class ProductVariantRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Reference that links the line item to the specific version of product that has been ordered. + """ # noqa: E501 + id: str = Field(description="The unique identifier of the product variant being referenced.") + name: Optional[str] = Field(default=None, description="Name of the product variant being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 ProductVariantRef 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 ProductVariantRef 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") + }) + return _obj + + + + + +class ProductVariantRefTypedDict(TypedDict): + """TypedDict variant of ProductVariantRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/productvariantstatus.py b/lending/src/codat_lending/models/shared/productvariantstatus.py index d7a741140..00f991286 100644 --- a/lending/src/codat_lending/models/shared/productvariantstatus.py +++ b/lending/src/codat_lending/models/shared/productvariantstatus.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ProductVariantStatus(str, Enum): - r"""The status of the product variant.""" + """ + The status of the product variant. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + PUBLISHED = 'Published' + UNPUBLISHED = 'Unpublished' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ProductVariantStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - PUBLISHED = "Published" - UNPUBLISHED = "Unpublished" diff --git a/lending/src/codat_lending/models/shared/profitandlossreport.py b/lending/src/codat_lending/models/shared/profitandlossreport.py index fc4d36c71..5c605cf5d 100644 --- a/lending/src/codat_lending/models/shared/profitandlossreport.py +++ b/lending/src/codat_lending/models/shared/profitandlossreport.py @@ -1,205 +1,161 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .reportline import ReportLine, ReportLineTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 ProfitAndLossReportTypedDict(TypedDict): - gross_profit: Decimal - r"""Gross profit of the company in the given date range.""" - net_operating_profit: Decimal - r"""Net operating profit of the company in the given date range.""" - net_other_income: Decimal - r"""Net other income of the company in the given date range.""" - net_profit: Decimal - r"""Net profit of the company in the given date range.""" - cost_of_sales: NotRequired[ReportLineTypedDict] - expenses: NotRequired[ReportLineTypedDict] - from_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. - """ - income: NotRequired[ReportLineTypedDict] - other_expenses: NotRequired[ReportLineTypedDict] - other_income: NotRequired[ReportLineTypedDict] - to_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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.reportline import ReportLine, ReportLineTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class ProfitAndLossReport(BaseModel): - gross_profit: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="grossProfit"), - ] - r"""Gross profit of the company in the given date range.""" - - net_operating_profit: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="netOperatingProfit"), - ] - r"""Net operating profit of the company in the given date range.""" - - net_other_income: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="netOtherIncome"), - ] - r"""Net other income of the company in the given date range.""" - - net_profit: Annotated[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="netProfit"), - ] - r"""Net profit of the company in the given date range.""" - - cost_of_sales: Annotated[ - Optional[ReportLine], pydantic.Field(alias="costOfSales") - ] = None - - expenses: Optional[ReportLine] = None - - from_date: Annotated[Optional[str], pydantic.Field(alias="fromDate")] = 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. - """ - - income: Optional[ReportLine] = None - - other_expenses: Annotated[ - Optional[ReportLine], pydantic.Field(alias="otherExpenses") - ] = None - - other_income: Annotated[ - Optional[ReportLine], pydantic.Field(alias="otherIncome") - ] = None - - to_date: Annotated[Optional[str], pydantic.Field(alias="toDate")] = None - r"""In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` - - - - When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - - - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - - Unqualified local time: `2021-11-15T01:00:00` - - UTC time offsets: `2021-11-15T01:00:00-05:00` - - > Time zones - > - > Not all dates from Codat will contain information about time zones. - > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - """ @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "costOfSales", - "expenses", - "fromDate", - "income", - "otherExpenses", - "otherIncome", - "toDate", - ] - ) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + ProfitAndLossReport + """ # noqa: E501 + from_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="fromDate") + to_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="toDate") + income: Optional[ReportLine] = Field(default=None, description="ReportLine items for income in the given date range.") + cost_of_sales: Optional[ReportLine] = Field(default=None, description="ReportLine items for cost of sales in the given date range.", alias="costOfSales") + gross_profit: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Gross profit of the company in the given date range.", alias="grossProfit") + expenses: Optional[ReportLine] = Field(default=None, description="ReportLine items for expenses in the given date range.") + net_operating_profit: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Net operating profit of the company in the given date range.", alias="netOperatingProfit") + other_expenses: Optional[ReportLine] = Field(default=None, description="ReportLine items for other expenses in the given date range.", alias="otherExpenses") + other_income: Optional[ReportLine] = Field(default=None, description="ReportLine items for other income in the given date range.", alias="otherIncome") + net_other_income: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Net other income of the company in the given date range.", alias="netOtherIncome") + net_profit: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Net profit of the company in the given date range.", alias="netProfit") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["fromDate", "toDate", "income", "costOfSales", "grossProfit", "expenses", "netOperatingProfit", "otherExpenses", "otherIncome", "netOtherIncome", "netProfit"] + + 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 ProfitAndLossReport 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 income + if self.income: + _dict['income'] = self.income.to_dict() + # override the default output from pydantic by calling `to_dict()` of cost_of_sales + if self.cost_of_sales: + _dict['costOfSales'] = self.cost_of_sales.to_dict() + # override the default output from pydantic by calling `to_dict()` of expenses + if self.expenses: + _dict['expenses'] = self.expenses.to_dict() + # override the default output from pydantic by calling `to_dict()` of other_expenses + if self.other_expenses: + _dict['otherExpenses'] = self.other_expenses.to_dict() + # override the default output from pydantic by calling `to_dict()` of other_income + if self.other_income: + _dict['otherIncome'] = self.other_income.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 ProfitAndLossReport from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fromDate": obj.get("fromDate"), + "toDate": obj.get("toDate"), + "income": ReportLine.from_dict(obj["income"]) if obj.get("income") is not None else None, + "costOfSales": ReportLine.from_dict(obj["costOfSales"]) if obj.get("costOfSales") is not None else None, + "grossProfit": obj.get("grossProfit"), + "expenses": ReportLine.from_dict(obj["expenses"]) if obj.get("expenses") is not None else None, + "netOperatingProfit": obj.get("netOperatingProfit"), + "otherExpenses": ReportLine.from_dict(obj["otherExpenses"]) if obj.get("otherExpenses") is not None else None, + "otherIncome": ReportLine.from_dict(obj["otherIncome"]) if obj.get("otherIncome") is not None else None, + "netOtherIncome": obj.get("netOtherIncome"), + "netProfit": obj.get("netProfit") + }) + # 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 - 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: - ProfitAndLossReport.model_rebuild() -except NameError: - pass +class ProfitAndLossReportTypedDict(TypedDict): + """TypedDict variant of ProfitAndLossReport, for dict-literal request/response inputs.""" + from_date: NotRequired[Optional[str]] + to_date: NotRequired[Optional[str]] + income: NotRequired[Optional[ReportLineTypedDict]] + cost_of_sales: NotRequired[Optional[ReportLineTypedDict]] + gross_profit: NotRequired[Decimal] + expenses: NotRequired[Optional[ReportLineTypedDict]] + net_operating_profit: NotRequired[Decimal] + other_expenses: NotRequired[Optional[ReportLineTypedDict]] + other_income: NotRequired[Optional[ReportLineTypedDict]] + net_other_income: NotRequired[Decimal] + net_profit: NotRequired[Decimal] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/projectref.py b/lending/src/codat_lending/models/shared/projectref.py index 0948a1ea9..7a1a22c93 100644 --- a/lending/src/codat_lending/models/shared/projectref.py +++ b/lending/src/codat_lending/models/shared/projectref.py @@ -1,52 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ProjectRefTypedDict(TypedDict): - id: str - r"""Unique identifier to the project reference.""" - name: NotRequired[Nullable[str]] - r"""The project's name.""" + 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 ProjectRef(BaseModel): - id: str - r"""Unique identifier to the project reference.""" - name: OptionalNullable[str] = UNSET - r"""The project's name.""" +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 typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ProjectRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) + 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 = {'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ProjectRef + """ # noqa: E501 + id: str = Field(description="Unique identifier to the project reference.") + name: OptionalNullable[str] = Field(default=UNSET, description="The project's name.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 ProjectRef 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 ProjectRef 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") + }) + return _obj + + + + + +class ProjectRefTypedDict(TypedDict): + """TypedDict variant of ProjectRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/propertie_accounttype.py b/lending/src/codat_lending/models/shared/propertie_accounttype.py index dadf3c507..d3d40c0d9 100644 --- a/lending/src/codat_lending/models/shared/propertie_accounttype.py +++ b/lending/src/codat_lending/models/shared/propertie_accounttype.py @@ -1,14 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from enum import Enum +from enum import Enum -class PropertieAccountType(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" +from codat_lending.models._compat.propertie_accounttype import PropertieAccountType diff --git a/lending/src/codat_lending/models/shared/propertie_itemref.py b/lending/src/codat_lending/models/shared/propertie_itemref.py deleted file mode 100644 index b01e32e5c..000000000 --- a/lending/src/codat_lending/models/shared/propertie_itemref.py +++ /dev/null @@ -1,56 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict - - -class PropertieItemRefTypedDict(TypedDict): - r"""Reference to the item the line is linked to.""" - - id: str - r"""Unique identifier for the item in the accounting software.""" - name: NotRequired[Nullable[str]] - r"""Name of the item in the accounting software.""" - - -class PropertieItemRef(BaseModel): - r"""Reference to the item the line is linked to.""" - - id: str - r"""Unique identifier for the item in the accounting software.""" - - name: OptionalNullable[str] = UNSET - r"""Name of the item in the accounting software.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) - 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 diff --git a/lending/src/codat_lending/models/shared/pulloperation.py b/lending/src/codat_lending/models/shared/pulloperation.py index 92ae1fee7..939f31763 100644 --- a/lending/src/codat_lending/models/shared/pulloperation.py +++ b/lending/src/codat_lending/models/shared/pulloperation.py @@ -1,225 +1,145 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 DatasetStatus(str, Enum): - r"""The current status of the dataset.""" - - 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" +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class PullOperationTypedDict(TypedDict): - r"""Information about a queued, in progress or completed pull operation. - *Formally called `dataset`* - """ - - company_id: str - r"""Unique identifier of the company associated to this pull operation.""" - connection_id: str - r"""Unique identifier of the connection associated to this pull operation.""" - data_type: str - r"""The data type you are requesting in a pull operation.""" - id: str - r"""Unique identifier of the pull operation.""" - is_completed: bool - r"""`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 - r"""`True` if the pull operation entered an error state.""" - progress: int - r"""An integer signifying the progress of the pull operation.""" - requested: 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: DatasetStatus - r"""The current status of the dataset.""" - completed: 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 +from codat_lending.models.dataset_status import DatasetStatus +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: - - - 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: NotRequired[Nullable[str]] - r"""A message about a transient or persistent error returned by Codat or the source platform.""" - status_description: NotRequired[Nullable[str]] - r"""Additional information about the dataset status.""" - +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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class PullOperation(BaseModel): - r"""Information about a queued, in progress or completed pull operation. - *Formally called `dataset`* - """ - - company_id: Annotated[str, pydantic.Field(alias="companyId")] - r"""Unique identifier of the company associated to this pull operation.""" - - connection_id: Annotated[str, pydantic.Field(alias="connectionId")] - r"""Unique identifier of the connection associated to this pull operation.""" - - data_type: Annotated[str, pydantic.Field(alias="dataType")] - r"""The data type you are requesting in a pull operation.""" - - id: str - r"""Unique identifier of the pull operation.""" - - is_completed: Annotated[bool, pydantic.Field(alias="isCompleted")] - r"""`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: Annotated[bool, pydantic.Field(alias="isErrored")] - r"""`True` if the pull operation entered an error state.""" - - progress: int - r"""An integer signifying the progress of the pull operation.""" - requested: 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 = {'errorMessage', 'error_message', 'statusDescription', 'status_description'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } """ + 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: OptionalNullable[str] = Field(default=UNSET, description="Additional information about the dataset status.", alias="statusDescription") + error_message: OptionalNullable[str] = Field(default=UNSET, 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 - status: DatasetStatus - r"""The current status of the dataset.""" - - completed: 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. - """ - - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A message about a transient or persistent error returned by Codat or the source platform.""" - - status_description: Annotated[ - OptionalNullable[str], pydantic.Field(alias="statusDescription") - ] = UNSET - r"""Additional information about the dataset status.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["completed", "errorMessage", "statusDescription"]) - nullable_fields = set(["errorMessage", "statusDescription"]) - 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: - PullOperation.model_rebuild() -except NameError: - pass +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/lending/src/codat_lending/models/shared/pulloperations.py b/lending/src/codat_lending/models/shared/pulloperations.py index 0444755ff..aba79be5d 100644 --- a/lending/src/codat_lending/models/shared/pulloperations.py +++ b/lending/src/codat_lending/models/shared/pulloperations.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .pulloperation import PullOperation, PullOperationTypedDict -from codat_lending.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_lending.models.shared.links import Links, LinksTypedDict +from codat_lending.models.shared.pulloperation import PullOperation, PullOperationTypedDict +from typing import Optional, Set +from typing_extensions import Self +class PullOperations(BaseModel): -class PullOperationsTypedDict(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[PullOperationTypedDict]] + @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=(), + ) -class PullOperations(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 PullOperations from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[PullOperation]] = 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 PullOperations 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": [PullOperation.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - PullOperations.model_rebuild() -except NameError: - pass + + + + +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/lending/src/codat_lending/models/shared/pushchangetype.py b/lending/src/codat_lending/models/shared/pushchangetype.py index 76371e9e3..ab6e78202 100644 --- a/lending/src/codat_lending/models/shared/pushchangetype.py +++ b/lending/src/codat_lending/models/shared/pushchangetype.py @@ -1,14 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/pushfieldvalidation.py b/lending/src/codat_lending/models/shared/pushfieldvalidation.py index 1c05bda18..97603eda5 100644 --- a/lending/src/codat_lending/models/shared/pushfieldvalidation.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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/lending/src/codat_lending/models/shared/pushoperation.py b/lending/src/codat_lending/models/shared/pushoperation.py index bdbac8e4b..5112a8637 100644 --- a/lending/src/codat_lending/models/shared/pushoperation.py +++ b/lending/src/codat_lending/models/shared/pushoperation.py @@ -1,219 +1,164 @@ -"""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_lending.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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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 +from codat_lending.models.shared.datatype import DataType +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_lending.models.shared.pushoperationchange import PushOperationChange, PushOperationChangeTypedDict +from codat_lending.models.shared.pushoperationstatus import PushOperationStatus +from codat_lending.models.shared.validation import Validation, ValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.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="Available data types", 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"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + 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 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/lending/src/codat_lending/models/shared/pushoperationchange.py b/lending/src/codat_lending/models/shared/pushoperationchange.py index e19813c46..7d63815bf 100644 --- a/lending/src/codat_lending/models/shared/pushoperationchange.py +++ b/lending/src/codat_lending/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_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.models.shared.pushchangetype import PushChangeType +from codat_lending.models.shared.pushoperationref import PushOperationRef, PushOperationRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.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/lending/src/codat_lending/models/shared/pushoperationref.py b/lending/src/codat_lending/models/shared/pushoperationref.py index f7bc6d791..9345e4ece 100644 --- a/lending/src/codat_lending/models/shared/pushoperationref.py +++ b/lending/src/codat_lending/models/shared/pushoperationref.py @@ -1,46 +1,127 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .datatype import DataType -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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 +from codat_lending.models.shared.datatype import DataType +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 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, description="Available data types", alias="dataType") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions']): + raise ValueError("must be one of enum values ('accountTransactions', 'balanceSheet', 'bankAccounts', 'bankTransactions', 'billCreditNotes', 'billPayments', 'bills', 'cashFlowStatement', 'chartOfAccounts', 'company', 'creditNotes', 'customers', 'directCosts', 'directIncomes', 'invoices', 'itemReceipts', 'items', 'journalEntries', 'journals', 'paymentMethods', 'payments', 'profitAndLoss', 'purchaseOrders', 'salesOrders', 'suppliers', 'taxRates', 'trackingCategories', 'transfers', 'banking-accountBalances', 'banking-accounts', 'banking-transactionCategories', 'banking-transactions', 'commerce-companyInfo', 'commerce-customers', 'commerce-disputes', 'commerce-locations', 'commerce-orders', 'commerce-paymentMethods', 'commerce-payments', 'commerce-productCategories', 'commerce-products', 'commerce-taxComponents', 'commerce-transactions')") + 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)) - 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 PushOperationRef 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: - PushOperationRef.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. + * 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 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/lending/src/codat_lending/models/shared/pushoperations.py b/lending/src/codat_lending/models/shared/pushoperations.py index 00f69158e..b20cdae93 100644 --- a/lending/src/codat_lending/models/shared/pushoperations.py +++ b/lending/src/codat_lending/models/shared/pushoperations.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.models.shared.links import Links, LinksTypedDict +from codat_lending.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/lending/src/codat_lending/models/shared/pushoperationstatus.py b/lending/src/codat_lending/models/shared/pushoperationstatus.py index 09fa8b1f2..ce2b6c9d2 100644 --- a/lending/src/codat_lending/models/shared/pushoperationstatus.py +++ b/lending/src/codat_lending/models/shared/pushoperationstatus.py @@ -1,13 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/pushoption.py b/lending/src/codat_lending/models/shared/pushoption.py index 1d815148d..fa66b1860 100644 --- a/lending/src/codat_lending/models/shared/pushoption.py +++ b/lending/src/codat_lending/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_lending.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] +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict +from codat_lending.models.shared.pushoptionproperty import PushOptionProperty, PushOptionPropertyTypedDict +from codat_lending.models.shared.pushoptiontype import PushOptionType +from codat_lending.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self + +from codat_lending.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/lending/src/codat_lending/models/shared/pushoptionchoice.py b/lending/src/codat_lending/models/shared/pushoptionchoice.py index d2ec76302..67c3f959f 100644 --- a/lending/src/codat_lending/models/shared/pushoptionchoice.py +++ b/lending/src/codat_lending/models/shared/pushoptionchoice.py @@ -1,63 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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_lending.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/lending/src/codat_lending/models/shared/pushoptionproperty.py b/lending/src/codat_lending/models/shared/pushoptionproperty.py index dd8003e1c..31ef9e89a 100644 --- a/lending/src/codat_lending/models/shared/pushoptionproperty.py +++ b/lending/src/codat_lending/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_lending.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 +""" + Lending -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] + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.models.shared.pushoptionchoice import PushOptionChoice, PushOptionChoiceTypedDict +from codat_lending.models.shared.pushoptiontype import PushOptionType +from codat_lending.models.shared.pushvalidationinfo import PushValidationInfo, PushValidationInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self - validation: Optional[PushValidationInfo] = None +from codat_lending.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/lending/src/codat_lending/models/shared/pushoptiontype.py b/lending/src/codat_lending/models/shared/pushoptiontype.py index c9c246f2a..3976b3ae0 100644 --- a/lending/src/codat_lending/models/shared/pushoptiontype.py +++ b/lending/src/codat_lending/models/shared/pushoptiontype.py @@ -1,17 +1,43 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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/lending/src/codat_lending/models/shared/pushvalidationinfo.py b/lending/src/codat_lending/models/shared/pushvalidationinfo.py index 5e3a28edb..e675aa71f 100644 --- a/lending/src/codat_lending/models/shared/pushvalidationinfo.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.models.shared.pushfieldvalidation import PushFieldValidation, PushFieldValidationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.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/lending/src/codat_lending/models/shared/reportbasis.py b/lending/src/codat_lending/models/shared/reportbasis.py index 0ac131707..3e031d3b7 100644 --- a/lending/src/codat_lending/models/shared/reportbasis.py +++ b/lending/src/codat_lending/models/shared/reportbasis.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ReportBasis(str, Enum): - r"""Accounting method used when aggregating the report data. In this case, `Cash`.""" + """ + Accounting method used when aggregating the report data. In this case, `Cash`. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACCRUAL = 'Accrual' + CASH = 'Cash' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ReportBasis from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACCRUAL = "Accrual" - CASH = "Cash" diff --git a/lending/src/codat_lending/models/shared/reportcomponentmeasure.py b/lending/src/codat_lending/models/shared/reportcomponentmeasure.py index 6c446be58..b83edb714 100644 --- a/lending/src/codat_lending/models/shared/reportcomponentmeasure.py +++ b/lending/src/codat_lending/models/shared/reportcomponentmeasure.py @@ -1,60 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ReportComponentMeasureTypedDict(TypedDict): - index: NotRequired[int] - r"""The measure's index.""" - measure_display_name: NotRequired[str] - r"""The measure's display name.""" - value: NotRequired[Decimal] - r"""The measure's value.""" + 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 ReportComponentMeasure(BaseModel): - index: Optional[int] = None - r"""The measure's index.""" - measure_display_name: Annotated[ - Optional[str], pydantic.Field(alias="measureDisplayName") - ] = None - r"""The measure's display name.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +import pprint +import re # noqa: F401 +import json - value: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The measure's value.""" +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 ReportComponentMeasure(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["index", "measureDisplayName", "value"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + ReportComponentMeasure + """ # noqa: E501 + index: Optional[int] = Field(default=None, description="The measure's index.") + measure_display_name: Optional[str] = Field(default=None, description="The measure's display name.", alias="measureDisplayName") + value: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The measure's value.") + __properties: ClassVar[List[str]] = ["index", "measureDisplayName", "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)) - 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 ReportComponentMeasure 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: - ReportComponentMeasure.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 ReportComponentMeasure from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "measureDisplayName": obj.get("measureDisplayName"), + "value": obj.get("value") + }) + return _obj + + + + + +class ReportComponentMeasureTypedDict(TypedDict): + """TypedDict variant of ReportComponentMeasure, for dict-literal request/response inputs.""" + index: NotRequired[Optional[int]] + measure_display_name: NotRequired[Optional[str]] + value: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/reportgenerationpayload.py b/lending/src/codat_lending/models/shared/reportgenerationpayload.py index 951fb72e2..d8803cf32 100644 --- a/lending/src/codat_lending/models/shared/reportgenerationpayload.py +++ b/lending/src/codat_lending/models/shared/reportgenerationpayload.py @@ -1,46 +1,30 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - +"""Report generation payload. Synthesized to match Speakeasy's shared surface.""" from __future__ import annotations -from .companyreference import CompanyReference, CompanyReferenceTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict +from codat_lending.models.shared.companyreference import CompanyReference, CompanyReferenceTypedDict class ReportGenerationPayloadTypedDict(TypedDict): - id: NotRequired[str] - r"""Unique identifier of the report.""" - reference_company: NotRequired[CompanyReferenceTypedDict] + id: NotRequired[Optional[str]] + reference_company: NotRequired[Optional[CompanyReferenceTypedDict]] class ReportGenerationPayload(BaseModel): - id: Optional[str] = None - r"""Unique identifier of the report.""" - - reference_company: Annotated[ - Optional[CompanyReference], pydantic.Field(alias="referenceCompany") - ] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["id", "referenceCompany"]) + 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)) + return {k: v for k, v in serialized.items() if v is not None} - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) - return m + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + id: Optional[str] = None + reference_company: Optional[CompanyReference] = Field(default=None, alias="referenceCompany") -try: - ReportGenerationPayload.model_rebuild() -except NameError: - pass + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/shared/reportinfo.py b/lending/src/codat_lending/models/shared/reportinfo.py index a7572aac8..1e19c3cae 100644 --- a/lending/src/codat_lending/models/shared/reportinfo.py +++ b/lending/src/codat_lending/models/shared/reportinfo.py @@ -1,80 +1,114 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ReportInfoTypedDict(TypedDict): - r"""Report additional information, which is specific to Lending reports.""" - - company_name: NotRequired[str] - r"""The name of the company being queried.""" - generated_date: NotRequired[str] - r"""Date the report was generated.""" - page_number: NotRequired[int] - r"""The number of the page queried.""" - page_size: NotRequired[int] - r"""The number of transactions returned per page.""" - report_name: NotRequired[str] - r"""Name of the report.""" - total_results: NotRequired[int] - r"""The total number of transactions available for a company for the period specified in the query string.""" + 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 ReportInfo(BaseModel): - r"""Report additional information, which is specific to Lending reports.""" - company_name: Annotated[Optional[str], pydantic.Field(alias="companyName")] = None - r"""The name of the company being queried.""" +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 - generated_date: Annotated[Optional[str], pydantic.Field(alias="generatedDate")] = ( - None +class ReportInfo(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} + """ + Report additional information, which is specific to Lending reports. + """ # noqa: E501 + page_number: Optional[int] = Field(default=None, description="The number of the page queried.", alias="pageNumber") + page_size: Optional[int] = Field(default=None, description="The number of transactions returned per page.", alias="pageSize") + total_results: Optional[int] = Field(default=None, description="The total number of transactions available for a company for the period specified in the query string.", alias="totalResults") + report_name: Optional[str] = Field(default=None, description="Name of the report.", alias="reportName") + company_name: Optional[str] = Field(default=None, description="The name of the company being queried.", alias="companyName") + generated_date: Optional[str] = Field(default=None, description="Date the report was generated.", alias="generatedDate") + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "reportName", "companyName", "generatedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Date the report was generated.""" - page_number: Annotated[Optional[int], pydantic.Field(alias="pageNumber")] = None - r"""The number of the page queried.""" - page_size: Annotated[Optional[int], pydantic.Field(alias="pageSize")] = None - r"""The number of transactions returned per page.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - report_name: Annotated[Optional[str], pydantic.Field(alias="reportName")] = None - r"""Name of the report.""" + 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[Optional[int], pydantic.Field(alias="totalResults")] = None - r"""The total number of transactions available for a company for the period specified in the query string.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReportInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "companyName", - "generatedDate", - "pageNumber", - "pageSize", - "reportName", - "totalResults", - ] + 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 = {} + return _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_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReportInfo from a dict""" + if obj is None: + return None - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + if not isinstance(obj, dict): + return cls.model_validate(obj) - return m + _obj = cls.model_validate({ + "pageNumber": obj.get("pageNumber"), + "pageSize": obj.get("pageSize"), + "totalResults": obj.get("totalResults"), + "reportName": obj.get("reportName"), + "companyName": obj.get("companyName"), + "generatedDate": obj.get("generatedDate") + }) + return _obj -try: - ReportInfo.model_rebuild() -except NameError: - pass + + + +class ReportInfoTypedDict(TypedDict): + """TypedDict variant of ReportInfo, for dict-literal request/response inputs.""" + page_number: NotRequired[Optional[int]] + page_size: NotRequired[Optional[int]] + total_results: NotRequired[Optional[int]] + report_name: NotRequired[Optional[str]] + company_name: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/reportinput.py b/lending/src/codat_lending/models/shared/reportinput.py index be7f6330c..50d294890 100644 --- a/lending/src/codat_lending/models/shared/reportinput.py +++ b/lending/src/codat_lending/models/shared/reportinput.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ReportInput(str, Enum): - r"""Accounting method used to prepare the cash flow statement.""" + """ + Accounting method used to prepare the cash flow statement. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + INDIRECT = 'Indirect' + DIRECT = 'Direct' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ReportInput from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - INDIRECT = "Indirect" - DIRECT = "Direct" diff --git a/lending/src/codat_lending/models/shared/reportitems.py b/lending/src/codat_lending/models/shared/reportitems.py index 469a48430..93c60b213 100644 --- a/lending/src/codat_lending/models/shared/reportitems.py +++ b/lending/src/codat_lending/models/shared/reportitems.py @@ -1,123 +1,135 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .itemref import ItemRef, ItemRefTypedDict -from .loanref import LoanRef, LoanRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 LoanTransactionType(str, Enum): - r"""The type of loan transaction.""" - - INVESTMENT = "Investment" - REPAYMENT = "Repayment" - INTEREST = "Interest" - ACCURED_INTEREST = "AccuredInterest" - - -class ReportItemsTypedDict(TypedDict): - amount: NotRequired[Decimal] - r"""The loan transaction amount.""" - 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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ - item_ref: NotRequired[ItemRefTypedDict] - lender: NotRequired[str] - r"""The name of lender providing the loan.""" - loan_ref: NotRequired[LoanRefTypedDict] - loan_transaction_type: NotRequired[LoanTransactionType] - r"""The type of loan transaction.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +from codat_lending.models.loan_transaction_type import LoanTransactionType +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_lending.models.shared.itemref import ItemRef, ItemRefTypedDict +from codat_lending.models.shared.loanref import LoanRef, LoanRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict class ReportItems(BaseModel): - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The loan transaction amount.""" - - 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: - ``` - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + ReportItems + """ # noqa: E501 + loan_ref: Optional[LoanRef] = Field(default=None, description="Contains object that contains all the Loan transactions for that integration type.", alias="loanRef") + item_ref: Optional[ItemRef] = Field(default=None, description="Contains object of reporting properties. The loan ref will reference a different object depending on the integration type.", alias="itemRef") + 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="date") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The loan transaction amount.") + loan_transaction_type: Optional[LoanTransactionType] = Field(default=None, description="The type of loan transaction.", alias="loanTransactionType") + lender: Optional[str] = Field(default=None, description="The name of lender providing the loan.") + __properties: ClassVar[List[str]] = ["loanRef", "itemRef", "date", "amount", "loanTransactionType", "lender"] + + @field_validator('loan_transaction_type') + def loan_transaction_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Investment', 'Repayment', 'Interest', 'AccuredInterest']): + raise ValueError("must be one of enum values ('Investment', 'Repayment', 'Interest', 'AccuredInterest')") + 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 ReportItems 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 loan_ref + if self.loan_ref: + _dict['loanRef'] = self.loan_ref.to_dict() + # override the default output from pydantic by calling `to_dict()` of item_ref + if self.item_ref: + _dict['itemRef'] = self.item_ref.to_dict() + return _dict - item_ref: Annotated[Optional[ItemRef], pydantic.Field(alias="itemRef")] = None + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReportItems from a dict""" + if obj is None: + return None - lender: Optional[str] = None - r"""The name of lender providing the loan.""" + if not isinstance(obj, dict): + return cls.model_validate(obj) - loan_ref: Annotated[Optional[LoanRef], pydantic.Field(alias="loanRef")] = None + _obj = cls.model_validate({ + "loanRef": LoanRef.from_dict(obj["loanRef"]) if obj.get("loanRef") is not None else None, + "itemRef": ItemRef.from_dict(obj["itemRef"]) if obj.get("itemRef") is not None else None, + "date": obj.get("date"), + "amount": obj.get("amount"), + "loanTransactionType": obj.get("loanTransactionType"), + "lender": obj.get("lender") + }) + return _obj - loan_transaction_type: Annotated[ - Optional[LoanTransactionType], pydantic.Field(alias="loanTransactionType") - ] = None - r"""The type of loan transaction.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - ["amount", "date", "itemRef", "lender", "loanRef", "loanTransactionType"] - ) - 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: - ReportItems.model_rebuild() -except NameError: - pass +class ReportItemsTypedDict(TypedDict): + """TypedDict variant of ReportItems, for dict-literal request/response inputs.""" + loan_ref: NotRequired[Optional[LoanRefTypedDict]] + item_ref: NotRequired[Optional[ItemRefTypedDict]] + date_: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] + loan_transaction_type: NotRequired[Optional[LoanTransactionType]] + lender: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/reportline.py b/lending/src/codat_lending/models/shared/reportline.py index 3de492146..dcb32dc77 100644 --- a/lending/src/codat_lending/models/shared/reportline.py +++ b/lending/src/codat_lending/models/shared/reportline.py @@ -1,80 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.utils import serialize_decimal, validate_decimal from decimal import Decimal -import pydantic -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing import List -from typing_extensions import Annotated, NotRequired, TypedDict +from codat_lending.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 ReportLineTypedDict(TypedDict): - value: Decimal - r"""Numerical value of the line item.""" - account_id: NotRequired[Nullable[str]] - r"""Identifier for the account, unique for the company in the accounting software.""" - items: NotRequired[Nullable[List[ReportLineTypedDict]]] - r"""An array of ReportLine items.""" - name: NotRequired[Nullable[str]] - r"""Name of the report line item.""" +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ReportLine(BaseModel): + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'accountId', 'account_id', 'items', 'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + ReportLine + """ # noqa: E501 + account_id: OptionalNullable[str] = Field(default=UNSET, description="Identifier for the account, unique for the company in the accounting software.", alias="accountId") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of the report line item.") + value: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Numerical value of the line item.") + items: OptionalNullable[List[ReportLine]] = Field(default=UNSET, description="An array of ReportLine items.") + __properties: ClassVar[List[str]] = ["accountId", "name", "value", "items"] -class ReportLine(BaseModel): - value: Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - r"""Numerical value of the line item.""" - - account_id: Annotated[OptionalNullable[str], pydantic.Field(alias="accountId")] = ( - UNSET + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), ) - r"""Identifier for the account, unique for the company in the accounting software.""" - items: OptionalNullable[List[ReportLine]] = UNSET - r"""An array of ReportLine items.""" - name: OptionalNullable[str] = UNSET - r"""Name of the report line item.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountId", "items", "name"]) - nullable_fields = set(["accountId", "items", "name"]) - 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: - ReportLine.model_rebuild() -except NameError: - pass + 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 ReportLine 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 items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReportLine 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"), + "name": obj.get("name"), + "value": obj.get("value"), + "items": [ReportLine.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None + }) + return _obj + +# TODO: Rewrite to not use raise_errors +ReportLine.model_rebuild(raise_errors=False) + + + + +class ReportLineTypedDict(TypedDict): + """TypedDict variant of ReportLine, for dict-literal request/response inputs.""" + account_id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + value: NotRequired[Decimal] + items: NotRequired[Optional[List[ReportLineTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/reportoperation.py b/lending/src/codat_lending/models/shared/reportoperation.py index be3cbb8a6..dd79fe0ec 100644 --- a/lending/src/codat_lending/models/shared/reportoperation.py +++ b/lending/src/codat_lending/models/shared/reportoperation.py @@ -1,183 +1,141 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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 ReportOperationStatus(str, Enum): - r"""The status of the report generation.""" - - IN_PROGRESS = "InProgress" - COMPLETE = "Complete" - ERROR = "Error" - - -class ReportOperationType(str, Enum): - r"""The name of the generated report.""" - - CATEGORIZED_BANK_STATEMENT = "categorizedBankStatement" - CREDIT_MODEL = "creditModel" - SPEND_ANALYSIS = "spendAnalysis" - - -class ReportOperationTypedDict(TypedDict): - r"""Information about report generation.""" - - error_message: NotRequired[Nullable[str]] - r"""A short message describing any errors that occurred while generating the report.""" - id: NotRequired[str] - r"""Unique identifier of the report""" - requested_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. - """ - status: NotRequired[ReportOperationStatus] - r"""The status of the report generation.""" - type: NotRequired[ReportOperationType] - r"""The name of the generated report.""" - updated_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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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. - """ + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from codat_lending.models.report_operation_type import ReportOperationType +from codat_lending.models.report_operation_status import ReportOperationStatus +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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class ReportOperation(BaseModel): - r"""Information about report generation.""" - error_message: Annotated[ - OptionalNullable[str], pydantic.Field(alias="errorMessage") - ] = UNSET - r"""A short message describing any errors that occurred while generating the report.""" - - id: Optional[str] = None - r"""Unique identifier of the report""" - - requested_date: Annotated[Optional[str], pydantic.Field(alias="requestedDate")] = ( - None + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'errorMessage', 'error_message'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Information about report generation. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier of the report") + status: Optional[ReportOperationStatus] = Field(default=None, description="The status of the report generation.") + type: Optional[ReportOperationType] = Field(default=None, description="The name of the generated report.") + requested_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="requestedDate") + updated_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="updatedDate") + error_message: OptionalNullable[str] = Field(default=UNSET, description="A short message describing any errors that occurred while generating the report.", alias="errorMessage") + __properties: ClassVar[List[str]] = ["id", "status", "type", "requestedDate", "updatedDate", "errorMessage"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['InProgress', 'Complete', 'Error']): + raise ValueError("must be one of enum values ('InProgress', 'Complete', 'Error')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['categorizedBankStatement', 'creditModel', 'spendAnalysis']): + raise ValueError("must be one of enum values ('categorizedBankStatement', 'creditModel', 'spendAnalysis')") + 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 ReportOperation 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)`: - status: Optional[ReportOperationStatus] = None - r"""The status of the report generation.""" + * `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([ + ]) - type: Optional[ReportOperationType] = None - r"""The name of the generated report.""" + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - updated_date: Annotated[Optional[str], pydantic.Field(alias="updatedDate")] = 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: + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReportOperation from a dict""" + if obj is None: + return None - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + if not isinstance(obj, dict): + return cls.model_validate(obj) + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "type": obj.get("type"), + "requestedDate": obj.get("requestedDate"), + "updatedDate": obj.get("updatedDate"), + "errorMessage": obj.get("errorMessage") + }) + 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( - ["errorMessage", "id", "requestedDate", "status", "type", "updatedDate"] - ) - nullable_fields = set(["errorMessage"]) - 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: - ReportOperation.model_rebuild() -except NameError: - pass +class ReportOperationTypedDict(TypedDict): + """TypedDict variant of ReportOperation, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + status: NotRequired[Optional[ReportOperationStatus]] + type: NotRequired[Optional[ReportOperationType]] + requested_date: NotRequired[Optional[str]] + updated_date: NotRequired[Optional[str]] + error_message: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/reports.py b/lending/src/codat_lending/models/shared/reports.py index ddbfb7176..5685deeda 100644 --- a/lending/src/codat_lending/models/shared/reports.py +++ b/lending/src/codat_lending/models/shared/reports.py @@ -1,58 +1,124 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .reportoperation import ReportOperation, ReportOperationTypedDict -from codat_lending.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_lending.models.shared.links import Links, LinksTypedDict +from codat_lending.models.shared.reportoperation import ReportOperation, ReportOperationTypedDict +from typing import Optional, Set +from typing_extensions import Self +class Reports(BaseModel): -class ReportsTypedDict(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[ReportOperationTypedDict]] + @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} + """ + Reports + """ # 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[ReportOperation]] = None + __properties: ClassVar[List[str]] = ["pageNumber", "pageSize", "totalResults", "_links", "results"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class Reports(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 Reports from a JSON string""" + return cls.from_dict(json.loads(json_str)) - results: Optional[List[ReportOperation]] = 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 Reports 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": [ReportOperation.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj -try: - Reports.model_rebuild() -except NameError: - pass + + + + +class ReportsTypedDict(TypedDict): + """TypedDict variant of Reports, 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[ReportOperationTypedDict]]] diff --git a/lending/src/codat_lending/models/shared/reporttype.py b/lending/src/codat_lending/models/shared/reporttype.py index a7a8ca992..1c0d046e0 100644 --- a/lending/src/codat_lending/models/shared/reporttype.py +++ b/lending/src/codat_lending/models/shared/reporttype.py @@ -1,9 +1,9 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations + from enum import Enum class ReportType(str, Enum): - CATEGORIZED_BANK_STATEMENT = "categorizedBankStatement" - CREDIT_MODEL = "creditModel" + """Shared OAS parameter enum (lifted from components/parameters/reportType).""" + CATEGORIZED_BANK_STATEMENT = 'categorizedBankStatement' + CREDIT_MODEL = 'creditModel' diff --git a/lending/src/codat_lending/models/shared/routinginfo.py b/lending/src/codat_lending/models/shared/routinginfo.py index 46a2fd32f..f0eb67df3 100644 --- a/lending/src/codat_lending/models/shared/routinginfo.py +++ b/lending/src/codat_lending/models/shared/routinginfo.py @@ -1,84 +1,119 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.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" +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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 +from __future__ import annotations +from codat_lending.models.source_account_v2_type import SourceAccountV2Type +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_lending.models.type import Type +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class RoutingInfo(BaseModel): - r"""Routing information for the bank. This does not include account number.""" - bank_code: Annotated[OptionalNullable[str], pydantic.Field(alias="bankCode")] = ( - UNSET + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _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=(), ) - r"""The numeric identifier of the routing number""" - type: OptionalNullable[Type] = Type.BANKCODE - r"""The type of routing number.""" - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bankCode", "type"]) - nullable_fields = set(["bankCode", "type"]) - 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 + 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/lending/src/codat_lending/models/shared/schema.py b/lending/src/codat_lending/models/shared/schema.py index 72927ba44..2b32c811a 100644 --- a/lending/src/codat_lending/models/shared/schema.py +++ b/lending/src/codat_lending/models/shared/schema.py @@ -1,97 +1,34 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - +"""Report generation webhook. Synthesized to match Speakeasy's shared surface.""" from __future__ import annotations -from .reportgenerationpayload import ( - ReportGenerationPayload, - ReportGenerationPayloadTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict +from codat_lending.models.shared.reportgenerationpayload import ReportGenerationPayload, ReportGenerationPayloadTypedDict class SchemaTypedDict(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: - - ``` - 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: NotRequired[str] - r"""Unique identifier of the event.""" - payload: NotRequired[ReportGenerationPayloadTypedDict] + id: NotRequired[Optional[str]] + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + payload: NotRequired[Optional[ReportGenerationPayloadTypedDict]] class Schema(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: - - ``` - 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: Optional[str] = None - r"""Unique identifier of the event.""" - - payload: Optional[ReportGenerationPayload] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["eventType", "generatedDate", "id", "payload"]) + 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)) + return {k: v for k, v in serialized.items() if v is not None} - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) - return m + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + id: Optional[str] = None + event_type: Optional[str] = Field(default=None, alias="eventType") + generated_date: Optional[str] = Field(default=None, alias="generatedDate") + payload: Optional[ReportGenerationPayload] = None -try: - Schema.model_rebuild() -except NameError: - pass + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/shared/schema_datatype.py b/lending/src/codat_lending/models/shared/schema_datatype.py index aa72f531c..f48af12eb 100644 --- a/lending/src/codat_lending/models/shared/schema_datatype.py +++ b/lending/src/codat_lending/models/shared/schema_datatype.py @@ -1,52 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from enum import Enum +from enum import Enum -class SchemaDataType(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" +from codat_lending.models._compat.schema_datatype import SchemaDataType diff --git a/lending/src/codat_lending/models/shared/security.py b/lending/src/codat_lending/models/shared/security.py index 7576c6415..0a03b4abe 100644 --- a/lending/src/codat_lending/models/shared/security.py +++ b/lending/src/codat_lending/models/shared/security.py @@ -1,9 +1,12 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Security model for codat_lending. + +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" from __future__ import annotations -from codat_lending.types import BaseModel -from codat_lending.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/lending/src/codat_lending/models/shared/servicecharge.py b/lending/src/codat_lending/models/shared/servicecharge.py index 214ecded4..6e8c3ba88 100644 --- a/lending/src/codat_lending/models/shared/servicecharge.py +++ b/lending/src/codat_lending/models/shared/servicecharge.py @@ -1,110 +1,128 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .servicechargetype import ServiceChargeType -from .taxcomponentallocation import ( - TaxComponentAllocation, - TaxComponentAllocationTypedDict, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class ServiceChargeTypedDict(TypedDict): - description: NotRequired[str] - r"""Service charges for this order.""" - quantity: NotRequired[int] - r"""The number of times the charge is charged.""" - tax_amount: NotRequired[Decimal] - r"""Amount of the service charge that is tax.""" - tax_percentage: NotRequired[Decimal] - r"""Percentage rate (from 0 to 100) of any tax applied to the service charge.""" - taxes: NotRequired[List[TaxComponentAllocationTypedDict]] - r"""Taxes breakdown as applied to service charges.""" - total_amount: NotRequired[Decimal] - r"""Total amount of the service charge, including tax.""" - type: NotRequired[ServiceChargeType] - r"""The type of the service charge.""" + 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 ServiceCharge(BaseModel): - description: Optional[str] = None - r"""Service charges for this order.""" - - quantity: Optional[int] = None - r"""The number of times the charge is charged.""" - - tax_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxAmount"), - ] = None - r"""Amount of the service charge that is tax.""" - - tax_percentage: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="taxPercentage"), - ] = None - r"""Percentage rate (from 0 to 100) of any tax applied to the service charge.""" - - taxes: Optional[List[TaxComponentAllocation]] = None - r"""Taxes breakdown as applied to service charges.""" - - total_amount: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="totalAmount"), - ] = None - r"""Total amount of the service charge, including tax.""" - type: Optional[ServiceChargeType] = None - r"""The type of the service charge.""" +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.servicechargetype import ServiceChargeType +from codat_lending.models.shared.taxcomponentallocation import TaxComponentAllocation, TaxComponentAllocationTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +class ServiceCharge(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "description", - "quantity", - "taxAmount", - "taxPercentage", - "taxes", - "totalAmount", - "type", - ] - ) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + ServiceCharge + """ # noqa: E501 + description: Optional[str] = Field(default=None, description="Service charges for this order.") + total_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Total amount of the service charge, including tax.", alias="totalAmount") + tax_percentage: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Percentage rate (from 0 to 100) of any tax applied to the service charge.", alias="taxPercentage") + tax_amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Amount of the service charge that is tax.", alias="taxAmount") + taxes: Optional[List[TaxComponentAllocation]] = Field(default=None, description="Taxes breakdown as applied to service charges.") + quantity: Optional[int] = Field(default=None, description="The number of times the charge is charged.") + type: Optional[ServiceChargeType] = None + __properties: ClassVar[List[str]] = ["description", "totalAmount", "taxPercentage", "taxAmount", "taxes", "quantity", "type"] + + 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 ServiceCharge 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 taxes (list) + _items = [] + if self.taxes: + for _item_taxes in self.taxes: + if _item_taxes: + _items.append(_item_taxes.to_dict()) + _dict['taxes'] = _items + return _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_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceCharge from a dict""" + if obj is None: + return None - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + if not isinstance(obj, dict): + return cls.model_validate(obj) - return m + _obj = cls.model_validate({ + "description": obj.get("description"), + "totalAmount": obj.get("totalAmount"), + "taxPercentage": obj.get("taxPercentage"), + "taxAmount": obj.get("taxAmount"), + "taxes": [TaxComponentAllocation.from_dict(_item) for _item in obj["taxes"]] if obj.get("taxes") is not None else None, + "quantity": obj.get("quantity"), + "type": obj.get("type") + }) + return _obj -try: - ServiceCharge.model_rebuild() -except NameError: - pass + + + +class ServiceChargeTypedDict(TypedDict): + """TypedDict variant of ServiceCharge, for dict-literal request/response inputs.""" + description: NotRequired[Optional[str]] + total_amount: NotRequired[Optional[Decimal]] + tax_percentage: NotRequired[Optional[Decimal]] + tax_amount: NotRequired[Optional[Decimal]] + taxes: NotRequired[Optional[List[TaxComponentAllocationTypedDict]]] + quantity: NotRequired[Optional[int]] + type: NotRequired[Optional[ServiceChargeType]] diff --git a/lending/src/codat_lending/models/shared/servicechargetype.py b/lending/src/codat_lending/models/shared/servicechargetype.py index 857357b01..366046910 100644 --- a/lending/src/codat_lending/models/shared/servicechargetype.py +++ b/lending/src/codat_lending/models/shared/servicechargetype.py @@ -1,13 +1,40 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 ServiceChargeType(str, Enum): - r"""The type of the service charge.""" + """ + The type of the service charge. + """ + + """ + allowed enum values + """ + GENERIC = 'Generic' + SHIPPING = 'Shipping' + OVERPAYMENT = 'Overpayment' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of ServiceChargeType from a JSON string""" + return cls(json.loads(json_str)) + - GENERIC = "Generic" - SHIPPING = "Shipping" - OVERPAYMENT = "Overpayment" - UNKNOWN = "Unknown" diff --git a/lending/src/codat_lending/models/shared/sourceaccount.py b/lending/src/codat_lending/models/shared/sourceaccount.py index c3c7dd038..753afb38f 100644 --- a/lending/src/codat_lending/models/shared/sourceaccount.py +++ b/lending/src/codat_lending/models/shared/sourceaccount.py @@ -1,244 +1,158 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 SourceAccountStatus(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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - 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[SourceAccountStatus]] - r"""Status of the source account.""" + Do not edit the class manually. +""" # noqa: E501 +from __future__ import annotations +from decimal import Decimal +from codat_lending.utils.serializers import serialize_decimal, validate_decimal +from codat_lending.models.source_account_status import SourceAccountStatus +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_lending.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[SourceAccountStatus] = 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[SourceAccountStatus] = 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[SourceAccountStatus]] + feed_start_date: NotRequired[Optional[str]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/sourceaccountprototype.py b/lending/src/codat_lending/models/shared/sourceaccountprototype.py index 271029ad4..187fa6717 100644 --- a/lending/src/codat_lending/models/shared/sourceaccountprototype.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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: +""" + Lending - ``` - 2020-10-08T22:40:50Z - 2021-01-01T00:00:00 - ``` + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.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_lending.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/lending/src/codat_lending/models/shared/sourceaccountv2.py b/lending/src/codat_lending/models/shared/sourceaccountv2.py index e0b79c7cc..395d95da0 100644 --- a/lending/src/codat_lending/models/shared/sourceaccountv2.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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_lending.models._compat.sourceaccountv2 import SourceAccountV2AccountType diff --git a/lending/src/codat_lending/models/shared/sourceaccountv2prototype.py b/lending/src/codat_lending/models/shared/sourceaccountv2prototype.py index a8436a695..fc8af34e1 100644 --- a/lending/src/codat_lending/models/shared/sourceaccountv2prototype.py +++ b/lending/src/codat_lending/models/shared/sourceaccountv2prototype.py @@ -1,169 +1,143 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountinfo import AccountInfo, AccountInfoTypedDict -from .propertie_accounttype import PropertieAccountType -from .routinginfo import RoutingInfo, RoutingInfoTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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: PropertieAccountType - 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 - ``` +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + 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_lending.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_lending.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict +from codat_lending.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.models.shared.accounttype import AccountType +from codat_lending.models._compat.propertie_accounttype import PropertieAccountType +from codat_lending.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[PropertieAccountType, 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: PropertieAccountType = 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[PropertieAccountType] + 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/lending/src/codat_lending/models/shared/sourceref.py b/lending/src/codat_lending/models/shared/sourceref.py index b54c6cfee..79a272681 100644 --- a/lending/src/codat_lending/models/shared/sourceref.py +++ b/lending/src/codat_lending/models/shared/sourceref.py @@ -1,44 +1,99 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class SourceRefTypedDict(TypedDict): - r"""A source reference containing the `sourceType` object \"Banking\".""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - source_type: NotRequired[str] - r"""The data source type.""" + Do not edit the class manually. +""" # noqa: E501 -class SourceRef(BaseModel): - r"""A source reference containing the `sourceType` object \"Banking\".""" +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 - source_type: Annotated[Optional[str], pydantic.Field(alias="sourceType")] = None - r"""The data source type.""" +class SourceRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["sourceType"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + A source reference containing the `sourceType` object \"Banking\". + """ # noqa: E501 + source_type: Optional[str] = Field(default=None, description="The data source type.", alias="sourceType") + __properties: ClassVar[List[str]] = ["sourceType"] + + 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 SourceRef 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([ + ]) -try: - SourceRef.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 SourceRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceType": obj.get("sourceType") + }) + return _obj + + + + + +class SourceRefTypedDict(TypedDict): + """TypedDict variant of SourceRef, for dict-literal request/response inputs.""" + source_type: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/startuploadsessionrequest.py b/lending/src/codat_lending/models/shared/startuploadsessionrequest.py index b238589b4..f8c737dfd 100644 --- a/lending/src/codat_lending/models/shared/startuploadsessionrequest.py +++ b/lending/src/codat_lending/models/shared/startuploadsessionrequest.py @@ -1,50 +1,110 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from enum import Enum -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class StartUploadSessionRequestDataType(str, Enum): - r"""A key for a Codat data type.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - BANKING_ACCOUNTS = "banking-accounts" - BANKING_TRANSACTIONS = "banking-transactions" + Do not edit the class manually. +""" # noqa: E501 -class StartUploadSessionRequestTypedDict(TypedDict): - data_type: NotRequired[StartUploadSessionRequestDataType] - r"""A key for a Codat data type.""" +from __future__ import annotations +from codat_lending.models.start_upload_session_request_data_type import StartUploadSessionRequestDataType +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 StartUploadSessionRequest(BaseModel): - data_type: Annotated[ - Optional[StartUploadSessionRequestDataType], pydantic.Field(alias="dataType") - ] = None - r"""A key for a Codat data type.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + StartUploadSessionRequest + """ # noqa: E501 + data_type: Optional[StartUploadSessionRequestDataType] = Field(default=None, description="A key for a Codat data type.", alias="dataType") + __properties: ClassVar[List[str]] = ["dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['banking-accounts', 'banking-transactions']): + raise ValueError("must be one of enum values ('banking-accounts', 'banking-transactions')") + 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 StartUploadSessionRequest 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([ + ]) -try: - StartUploadSessionRequest.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 StartUploadSessionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "dataType": obj.get("dataType") + }) + return _obj + + + + + +class StartUploadSessionRequestTypedDict(TypedDict): + """TypedDict variant of StartUploadSessionRequest, for dict-literal request/response inputs.""" + data_type: NotRequired[Optional[StartUploadSessionRequestDataType]] diff --git a/lending/src/codat_lending/models/shared/status.py b/lending/src/codat_lending/models/shared/status.py index bab5b3828..d27c30014 100644 --- a/lending/src/codat_lending/models/shared/status.py +++ b/lending/src/codat_lending/models/shared/status.py @@ -1,30 +1,56 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 Status(str, Enum): - r"""The current status of the dataset.""" - - 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" + """ + The current status of the dataset. + """ + + """ + allowed enum values + """ + 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' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Status from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/supplementaldata.py b/lending/src/codat_lending/models/shared/supplementaldata.py index 5ed25bfca..f98320a74 100644 --- a/lending/src/codat_lending/models/shared/supplementaldata.py +++ b/lending/src/codat_lending/models/shared/supplementaldata.py @@ -1,56 +1,104 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import Any, Dict -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class SupplementalDataTypedDict(TypedDict): - r"""Supplemental data is additional data you can include in our standard data types. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - 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. - """ + Do not edit the class manually. +""" # noqa: E501 - content: NotRequired[Nullable[Dict[str, Dict[str, Any]]]] +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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL 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. + @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_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["content"]) - nullable_fields = set(["content"]) - 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 + 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/lending/src/codat_lending/models/shared/supplierref.py b/lending/src/codat_lending/models/shared/supplierref.py index 25e1233a5..5d63a6cf5 100644 --- a/lending/src/codat_lending/models/shared/supplierref.py +++ b/lending/src/codat_lending/models/shared/supplierref.py @@ -1,65 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class SupplierRefTypedDict(TypedDict): - r"""Reference to the supplier the record relates to.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The supplier's unique ID""" - supplier_name: NotRequired[Nullable[str]] - r"""The supplier's name""" + Do not edit the class manually. +""" # noqa: E501 -class SupplierRef(BaseModel): - r"""Reference to the supplier the record relates to.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The supplier's unique ID""" +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 - supplier_name: Annotated[ - OptionalNullable[str], pydantic.Field(alias="supplierName") - ] = UNSET - r"""The supplier's name""" +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class SupplierRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["supplierName"]) - nullable_fields = set(["supplierName"]) + 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: - SupplierRef.model_rebuild() -except NameError: - pass + _nullable = {'supplierName', 'supplier_name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + Reference to the supplier the record relates to. + """ # noqa: E501 + id: str = Field(description="The supplier's unique ID") + supplier_name: OptionalNullable[str] = Field(default=UNSET, description="The supplier's name", alias="supplierName") + __properties: ClassVar[List[str]] = ["id", "supplierName"] + + 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 SupplierRef 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 SupplierRef 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"), + "supplierName": obj.get("supplierName") + }) + return _obj + + + + + +class SupplierRefTypedDict(TypedDict): + """TypedDict variant of SupplierRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + supplier_name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/supplierstatus.py b/lending/src/codat_lending/models/shared/supplierstatus.py index 0f7785837..88c56afc1 100644 --- a/lending/src/codat_lending/models/shared/supplierstatus.py +++ b/lending/src/codat_lending/models/shared/supplierstatus.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 SupplierStatus(str, Enum): - r"""Status of the supplier.""" + """ + Status of the supplier. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SupplierStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" diff --git a/lending/src/codat_lending/models/shared/targetaccountoption.py b/lending/src/codat_lending/models/shared/targetaccountoption.py index 8e5e8de1b..6c98f9a8b 100644 --- a/lending/src/codat_lending/models/shared/targetaccountoption.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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_lending.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/lending/src/codat_lending/models/shared/taxcomponentallocation.py b/lending/src/codat_lending/models/shared/taxcomponentallocation.py index d4c45a852..d1b77b7fa 100644 --- a/lending/src/codat_lending/models/shared/taxcomponentallocation.py +++ b/lending/src/codat_lending/models/shared/taxcomponentallocation.py @@ -1,71 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .taxcomponentref import TaxComponentRef, TaxComponentRefTypedDict -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TaxComponentAllocationTypedDict(TypedDict): - rate: NotRequired[Nullable[Decimal]] - r"""Tax amount on order line sale as available from source commerce software.""" - tax_component_ref: NotRequired[TaxComponentRefTypedDict] - r"""Taxes rates reference object depending on the rates being available on source commerce 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 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.taxcomponentref import TaxComponentRef, TaxComponentRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL class TaxComponentAllocation(BaseModel): - rate: Annotated[ - OptionalNullable[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = UNSET - r"""Tax amount on order line sale as available from source commerce software.""" - - tax_component_ref: Annotated[ - Optional[TaxComponentRef], pydantic.Field(alias="taxComponentRef") - ] = None - r"""Taxes rates reference object depending on the rates being available on source commerce software.""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["rate", "taxComponentRef"]) - nullable_fields = set(["rate"]) + 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: - TaxComponentAllocation.model_rebuild() -except NameError: - pass + _nullable = {'rate'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + TaxComponentAllocation + """ # noqa: E501 + tax_component_ref: Optional[TaxComponentRef] = Field(default=None, alias="taxComponentRef") + rate: Annotated[OptionalNullable[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=UNSET, description="Tax amount on order line sale as available from source commerce software.") + __properties: ClassVar[List[str]] = ["taxComponentRef", "rate"] + + 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 TaxComponentAllocation 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 tax_component_ref + if self.tax_component_ref: + _dict['taxComponentRef'] = self.tax_component_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaxComponentAllocation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "taxComponentRef": TaxComponentRef.from_dict(obj["taxComponentRef"]) if obj.get("taxComponentRef") is not None else None, + "rate": obj.get("rate") + }) + return _obj + + + + + +class TaxComponentAllocationTypedDict(TypedDict): + """TypedDict variant of TaxComponentAllocation, for dict-literal request/response inputs.""" + tax_component_ref: NotRequired[Optional[TaxComponentRefTypedDict]] + rate: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/taxcomponentref.py b/lending/src/codat_lending/models/shared/taxcomponentref.py index 29fa0c686..997d8cc4b 100644 --- a/lending/src/codat_lending/models/shared/taxcomponentref.py +++ b/lending/src/codat_lending/models/shared/taxcomponentref.py @@ -1,24 +1,102 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel -from typing_extensions import TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TaxComponentRefTypedDict(TypedDict): - r"""Taxes rates reference object depending on the rates being available on source commerce 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 - id: str - r"""The unique identitifer of the tax component being referenced.""" - name: str - r"""Name of the tax component being referenced.""" +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 TaxComponentRef(BaseModel): - r"""Taxes rates reference object depending on the rates being available on source commerce software.""" - id: str - r"""The unique identitifer of the tax component being referenced.""" + @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} + """ + Taxes rates reference object depending on the rates being available on source commerce software. + """ # noqa: E501 + id: str = Field(description="The unique identitifer of the tax component being referenced.") + name: str = Field(description="Name of the tax component being referenced.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 TaxComponentRef 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. - name: str - r"""Name of the tax component being referenced.""" + 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 TaxComponentRef 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") + }) + return _obj + + + + + +class TaxComponentRefTypedDict(TypedDict): + """TypedDict variant of TaxComponentRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[str] diff --git a/lending/src/codat_lending/models/shared/taxrateref.py b/lending/src/codat_lending/models/shared/taxrateref.py index 0dc88936e..6281c3eb4 100644 --- a/lending/src/codat_lending/models/shared/taxrateref.py +++ b/lending/src/codat_lending/models/shared/taxrateref.py @@ -1,85 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +from codat_lending.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 TaxRateRefTypedDict(TypedDict): - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. - - Found on: +class TaxRateRef(BaseModel): - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items + @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} """ + Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. Found on: - Bill line items - Bill Credit Note line items - Credit Note line items - Direct incomes line items - Invoice line items - Items + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for the tax rate in the accounting software.") + name: Optional[str] = Field(default=None, description="Name of the tax rate in the accounting software.") + effective_tax_rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Applicable tax rate.", alias="effectiveTaxRate") + __properties: ClassVar[List[str]] = ["id", "name", "effectiveTaxRate"] - effective_tax_rate: NotRequired[Decimal] - r"""Applicable tax rate.""" - id: NotRequired[str] - r"""Unique identifier for the tax rate in the accounting software.""" - name: NotRequired[str] - r"""Name of the tax rate in the accounting software.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class TaxRateRef(BaseModel): - r"""Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Found on: + 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()) - - Bill line items - - Bill Credit Note line items - - Credit Note line items - - Direct incomes line items - - Invoice line items - - Items - """ + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaxRateRef from a JSON string""" + return cls.from_dict(json.loads(json_str)) - effective_tax_rate: Annotated[ - Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ], - pydantic.Field(alias="effectiveTaxRate"), - ] = None - r"""Applicable tax rate.""" + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - id: Optional[str] = None - r"""Unique identifier for the tax rate in the accounting software.""" + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - name: Optional[str] = None - r"""Name of the tax rate in the accounting software.""" + * `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(["effectiveTaxRate", "id", "name"]) - serialized = handler(self) - m = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _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_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaxRateRef from a dict""" + if obj is None: + return None - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + if not isinstance(obj, dict): + return cls.model_validate(obj) - return m + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "effectiveTaxRate": obj.get("effectiveTaxRate") + }) + return _obj -try: - TaxRateRef.model_rebuild() -except NameError: - pass + + + +class TaxRateRefTypedDict(TypedDict): + """TypedDict variant of TaxRateRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + effective_tax_rate: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/tracking.py b/lending/src/codat_lending/models/shared/tracking.py index 07638fe07..dab3a15f8 100644 --- a/lending/src/codat_lending/models/shared/tracking.py +++ b/lending/src/codat_lending/models/shared/tracking.py @@ -1,53 +1,128 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from .trackingrecordref import TrackingRecordRef, TrackingRecordRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TrackingTypedDict(TypedDict): - record_refs: List[TrackingRecordRefTypedDict] - invoice_to: NotRequired[AccountingRecordRefTypedDict] - r"""Links the current record to the underlying record or data type that created it. + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ + Do not edit the class manually. +""" # noqa: E501 -class Tracking(BaseModel): - record_refs: Annotated[List[TrackingRecordRef], pydantic.Field(alias="recordRefs")] +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - invoice_to: Annotated[ - Optional[AccountingRecordRef], pydantic.Field(alias="invoiceTo") - ] = None - r"""Links the current record to the underlying record or data type that created it. +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing import Any, ClassVar, Dict, List, Optional +from codat_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from codat_lending.models.tracking_record_ref import TrackingRecordRef, TrackingRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ +class Tracking(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["invoiceTo"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + Tracking + """ # noqa: E501 + record_refs: List[TrackingRecordRef] = Field(alias="recordRefs") + invoice_to: Optional[AccountingRecordRef] = Field(default=None, alias="invoiceTo") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["recordRefs", "invoiceTo"] + + 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 Tracking 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: - Tracking.model_rebuild() -except NameError: - pass + _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 record_refs (list) + _items = [] + if self.record_refs: + for _item_record_refs in self.record_refs: + if _item_record_refs: + _items.append(_item_record_refs.to_dict()) + _dict['recordRefs'] = _items + # override the default output from pydantic by calling `to_dict()` of invoice_to + if self.invoice_to: + _dict['invoiceTo'] = self.invoice_to.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 Tracking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "recordRefs": [TrackingRecordRef.from_dict(_item) for _item in obj["recordRefs"]] if obj.get("recordRefs") is not None else None, + "invoiceTo": AccountingRecordRef.from_dict(obj["invoiceTo"]) if obj.get("invoiceTo") 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 TrackingTypedDict(TypedDict): + """TypedDict variant of Tracking, for dict-literal request/response inputs.""" + record_refs: NotRequired[List[TrackingRecordRefTypedDict]] + invoice_to: NotRequired[Optional[AccountingRecordRefTypedDict]] + additional_properties: NotRequired[Dict[str, Any]] diff --git a/lending/src/codat_lending/models/shared/trackingcategoryref.py b/lending/src/codat_lending/models/shared/trackingcategoryref.py index 4a96b954c..cd2aa2011 100644 --- a/lending/src/codat_lending/models/shared/trackingcategoryref.py +++ b/lending/src/codat_lending/models/shared/trackingcategoryref.py @@ -1,62 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict, deprecated - - -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class TrackingCategoryRefTypedDict(TypedDict): - r"""References a category against which the item is tracked.""" +""" + Lending - id: str - r"""Unique identifier to the tracking category.""" - name: NotRequired[Nullable[str]] - r"""Name of tracking category.""" + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) -@deprecated( - "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." -) -class TrackingCategoryRef(BaseModel): - r"""References a category against which the item is tracked.""" + Do not edit the class manually. +""" # noqa: E501 - id: str - r"""Unique identifier to the tracking category.""" - name: OptionalNullable[str] = UNSET - r"""Name of tracking category.""" +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 typing import Optional, Set +from typing_extensions import Self + +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class TrackingCategoryRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) + 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 = {'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + References a category against which the item is tracked. + """ # noqa: E501 + id: str = Field(description="Unique identifier to the tracking category.") + name: OptionalNullable[str] = Field(default=UNSET, description="Name of tracking category.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 TrackingCategoryRef 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 TrackingCategoryRef 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") + }) + return _obj + + + + + +class TrackingCategoryRefTypedDict(TypedDict): + """TypedDict variant of TrackingCategoryRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/trackingrecordref.py b/lending/src/codat_lending/models/shared/trackingrecordref.py index 80068b1b4..85052596c 100644 --- a/lending/src/codat_lending/models/shared/trackingrecordref.py +++ b/lending/src/codat_lending/models/shared/trackingrecordref.py @@ -1,60 +1,6 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel, 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 TrackingRecordRefDataType(str, Enum): - r"""Name of underlying data type.""" - - CUSTOMERS = "customers" - SUPPLIERS = "suppliers" - TRACKING_CATEGORIES = "trackingCategories" - - -class TrackingRecordRefTypedDict(TypedDict): - r"""Links to the customer or tracking category.""" - - data_type: NotRequired[TrackingRecordRefDataType] - r"""Name of underlying data type.""" - id: NotRequired[str] - r"""'id' of the underlying record or data type.""" - -class TrackingRecordRef(BaseModel): - r"""Links to the customer or tracking category.""" - - data_type: Annotated[ - Optional[TrackingRecordRefDataType], pydantic.Field(alias="dataType") - ] = None - r"""Name of underlying data type.""" - - id: Optional[str] = None - r"""'id' of the underlying record or data type.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id"]) - 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 enum import Enum -try: - TrackingRecordRef.model_rebuild() -except NameError: - pass +from codat_lending.models._compat.trackingrecordref import TrackingRecordRefDataType diff --git a/lending/src/codat_lending/models/shared/transactioncategory.py b/lending/src/codat_lending/models/shared/transactioncategory.py index bfef532ea..7a099a6b1 100644 --- a/lending/src/codat_lending/models/shared/transactioncategory.py +++ b/lending/src/codat_lending/models/shared/transactioncategory.py @@ -1,59 +1,107 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.utils import serialize_decimal, validate_decimal -from decimal import Decimal -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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TransactionCategoryTypedDict(TypedDict): - confidence: NotRequired[Decimal] - r"""Returns the aggregate confidence of the suggested category for the transaction. The value is between 0 and 100.""" - confidences: NotRequired[List[Decimal]] - r"""An ordered array of category level confidences where each element is the confidence of the corresponding item in the `levels` array.""" - levels: NotRequired[List[str]] - r"""The suggested category is an ordered array of category levels where each element (or level) is a subcategory of the previous element (or level).""" + 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_lending.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 TransactionCategory(BaseModel): - confidence: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""Returns the aggregate confidence of the suggested category for the transaction. The value is between 0 and 100.""" - - confidences: Optional[ - List[ - Annotated[ - Decimal, - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] - ] - ] = None - r"""An ordered array of category level confidences where each element is the confidence of the corresponding item in the `levels` array.""" - - levels: Optional[List[str]] = None - r"""The suggested category is an ordered array of category levels where each element (or level) is a subcategory of the previous element (or level).""" @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["confidence", "confidences", "levels"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} + """ + TransactionCategory + """ # noqa: E501 + confidence: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Returns the aggregate confidence of the suggested category for the transaction. The value is between 0 and 100.") + confidences: Optional[List[Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))]]] = Field(default=None, description="An ordered array of category level confidences where each element is the confidence of the corresponding item in the `levels` array.") + levels: Optional[List[str]] = Field(default=None, description="The suggested category is an ordered array of category levels where each element (or level) is a subcategory of the previous element (or level).") + __properties: ClassVar[List[str]] = ["confidence", "confidences", "levels"] + + 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 TransactionCategory 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 TransactionCategory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "confidence": obj.get("confidence"), + "confidences": obj.get("confidences"), + "levels": obj.get("levels") + }) + return _obj + + + + + +class TransactionCategoryTypedDict(TypedDict): + """TypedDict variant of TransactionCategory, for dict-literal request/response inputs.""" + confidence: NotRequired[Optional[Decimal]] + confidences: NotRequired[Optional[List[Decimal]]] + levels: NotRequired[Optional[List[str]]] diff --git a/lending/src/codat_lending/models/shared/transactioncategoryref.py b/lending/src/codat_lending/models/shared/transactioncategoryref.py index 2d830bc2c..97cd5a005 100644 --- a/lending/src/codat_lending/models/shared/transactioncategoryref.py +++ b/lending/src/codat_lending/models/shared/transactioncategoryref.py @@ -1,56 +1,108 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from codat_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TransactionCategoryRefTypedDict(TypedDict): - r"""An object of bank transaction category reference data.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - id: str - r"""The unique category reference id for the bank transaction.""" - name: NotRequired[Nullable[str]] - r"""The category name reference for the bank transaction.""" + Do not edit the class manually. +""" # noqa: E501 -class TransactionCategoryRef(BaseModel): - r"""An object of bank transaction category reference data.""" +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - id: str - r"""The unique category reference id for the bank transaction.""" +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 - name: OptionalNullable[str] = UNSET - r"""The category name reference for the bank transaction.""" +from codat_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class TransactionCategoryRef(BaseModel): @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["name"]) - nullable_fields = set(["name"]) + 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 = {'name'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + An object of bank transaction category reference data. + """ # noqa: E501 + id: str = Field(description="The unique category reference id for the bank transaction.") + name: OptionalNullable[str] = Field(default=UNSET, description="The category name reference for the bank transaction.") + __properties: ClassVar[List[str]] = ["id", "name"] + + 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 TransactionCategoryRef 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 TransactionCategoryRef 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") + }) + return _obj + + + + + +class TransactionCategoryRefTypedDict(TypedDict): + """TypedDict variant of TransactionCategoryRef, for dict-literal request/response inputs.""" + id: NotRequired[str] + name: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/transactioncategorystatus.py b/lending/src/codat_lending/models/shared/transactioncategorystatus.py index ce60e9454..1dc6b94ab 100644 --- a/lending/src/codat_lending/models/shared/transactioncategorystatus.py +++ b/lending/src/codat_lending/models/shared/transactioncategorystatus.py @@ -1,12 +1,39 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 TransactionCategoryStatus(str, Enum): - r"""The status of the transaction category.""" + """ + The status of the transaction category. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + ACTIVE = 'Active' + ARCHIVED = 'Archived' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TransactionCategoryStatus from a JSON string""" + return cls(json.loads(json_str)) + - UNKNOWN = "Unknown" - ACTIVE = "Active" - ARCHIVED = "Archived" diff --git a/lending/src/codat_lending/models/shared/transactioncode.py b/lending/src/codat_lending/models/shared/transactioncode.py index 5f19cb92b..2160fde00 100644 --- a/lending/src/codat_lending/models/shared/transactioncode.py +++ b/lending/src/codat_lending/models/shared/transactioncode.py @@ -1,24 +1,50 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 TransactionCode(str, Enum): - r"""Code to identify the underlying transaction.""" - - UNKNOWN = "Unknown" - FEE = "Fee" - PAYMENT = "Payment" - CASH = "Cash" - TRANSFER = "Transfer" - INTEREST = "Interest" - CASHBACK = "Cashback" - CHEQUE = "Cheque" - DIRECT_DEBIT = "DirectDebit" - PURCHASE = "Purchase" - STANDING_ORDER = "StandingOrder" - ADJUSTMENT = "Adjustment" - CREDIT = "Credit" - OTHER = "Other" - NOT_SUPPORTED = "NotSupported" + """ + Code to identify the underlying transaction. + """ + + """ + allowed enum values + """ + UNKNOWN = 'Unknown' + FEE = 'Fee' + PAYMENT = 'Payment' + CASH = 'Cash' + TRANSFER = 'Transfer' + INTEREST = 'Interest' + CASHBACK = 'Cashback' + CHEQUE = 'Cheque' + DIRECT_DEBIT = 'DirectDebit' + PURCHASE = 'Purchase' + STANDING_ORDER = 'StandingOrder' + ADJUSTMENT = 'Adjustment' + CREDIT = 'Credit' + OTHER = 'Other' + NOT_SUPPORTED = 'NotSupported' + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TransactionCode from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/lending/src/codat_lending/models/shared/transactionsourceref.py b/lending/src/codat_lending/models/shared/transactionsourceref.py index c838e8864..c37c223c0 100644 --- a/lending/src/codat_lending/models/shared/transactionsourceref.py +++ b/lending/src/codat_lending/models/shared/transactionsourceref.py @@ -1,21 +1,103 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 .transactionsourcetype import TransactionSourceType -from codat_lending.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 codat_lending.models.shared.transactionsourcetype import TransactionSourceType +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict -class TransactionSourceRefTypedDict(TypedDict): - id: str - r"""The unique identitifer of the record being referenced""" +class TransactionSourceRef(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} + """ + TransactionSourceRef + """ # noqa: E501 + id: str = Field(description="The unique identitifer of the record being referenced") type: TransactionSourceType - r"""The type of source the transaction arose.""" + __properties: ClassVar[List[str]] = ["id", "type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class TransactionSourceRef(BaseModel): - id: str - r"""The unique identitifer of the record being referenced""" + 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 TransactionSourceRef 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 TransactionSourceRef 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"), + "type": obj.get("type") + }) + return _obj + + + + + +class TransactionSourceRefTypedDict(TypedDict): + """TypedDict variant of TransactionSourceRef, for dict-literal request/response inputs.""" + id: NotRequired[str] type: TransactionSourceType - r"""The type of source the transaction arose.""" diff --git a/lending/src/codat_lending/models/shared/transactionsourcetype.py b/lending/src/codat_lending/models/shared/transactionsourcetype.py index 1d0ac4280..642a23fb0 100644 --- a/lending/src/codat_lending/models/shared/transactionsourcetype.py +++ b/lending/src/codat_lending/models/shared/transactionsourcetype.py @@ -1,14 +1,41 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 TransactionSourceType(str, Enum): - r"""The type of source the transaction arose.""" + """ + The type of source the transaction arose. + """ + + """ + allowed enum values + """ + FEE = 'Fee' + ORDER = 'Order' + PAYMENT = 'Payment' + SERVICE_CHARGE = 'ServiceCharge' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TransactionSourceType from a JSON string""" + return cls(json.loads(json_str)) + - FEE = "Fee" - ORDER = "Order" - PAYMENT = "Payment" - SERVICE_CHARGE = "ServiceCharge" - UNKNOWN = "Unknown" diff --git a/lending/src/codat_lending/models/shared/transactiontype.py b/lending/src/codat_lending/models/shared/transactiontype.py index a32f1be3a..d6b1ce45d 100644 --- a/lending/src/codat_lending/models/shared/transactiontype.py +++ b/lending/src/codat_lending/models/shared/transactiontype.py @@ -1,26 +1,44 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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 TransactionType(str, Enum): - r"""The type of the platform transaction: - - `Unknown` - - `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account. - - `Payment` — Credit and debit card payments. - - `PaymentFee` — Payment provider's fee on each card payment. - - `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller. - - `Payout` — Transfer of funds from the seller's merchant account to their bank account. - - `Refund` — Refunds to a customer's credit or debit card. - - `Transfer` — Secure transfer of funds to the seller's bank account. """ + The type of the platform transaction: - `Unknown` - `FailedPayout` — Failed transfer of funds from the seller's merchant account to their bank account. - `Payment` — Credit and debit card payments. - `PaymentFee` — Payment provider's fee on each card payment. - `PaymentFeeRefund` — Payment provider's fee that has been refunded to the seller. - `Payout` — Transfer of funds from the seller's merchant account to their bank account. - `Refund` — Refunds to a customer's credit or debit card. - `Transfer` — Secure transfer of funds to the seller's bank account. + """ + + """ + allowed enum values + """ + PAYMENT = 'Payment' + REFUND = 'Refund' + PAYOUT = 'Payout' + FAILED_PAYOUT = 'FailedPayout' + TRANSFER = 'Transfer' + PAYMENT_FEE = 'PaymentFee' + PAYMENT_FEE_REFUND = 'PaymentFeeRefund' + UNKNOWN = 'Unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TransactionType from a JSON string""" + return cls(json.loads(json_str)) + - PAYMENT = "Payment" - REFUND = "Refund" - PAYOUT = "Payout" - FAILED_PAYOUT = "FailedPayout" - TRANSFER = "Transfer" - PAYMENT_FEE = "PaymentFee" - PAYMENT_FEE_REFUND = "PaymentFeeRefund" - UNKNOWN = "Unknown" diff --git a/lending/src/codat_lending/models/shared/transferaccount.py b/lending/src/codat_lending/models/shared/transferaccount.py index 6fb1fc12a..a965934c1 100644 --- a/lending/src/codat_lending/models/shared/transferaccount.py +++ b/lending/src/codat_lending/models/shared/transferaccount.py @@ -1,85 +1,111 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 -from __future__ import annotations -from .accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict -from codat_lending.types import BaseModel, UNSET_SENTINEL -from codat_lending.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 +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -class TransferAccountTypedDict(TypedDict): - r"""Account details of the account sending or receiving the transfer.""" + The version of the OpenAPI document: 3.0.0 + Contact: support@codat.io + Generated by OpenAPI Generator (https://openapi-generator.tech) - account_ref: NotRequired[AccountingRecordRefTypedDict] - r"""Links the current record to the underlying record or data type that created it. + Do not edit the class manually. +""" # noqa: E501 - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ - amount: NotRequired[Decimal] - r"""The amount transferred between accounts.""" - 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 +from __future__ import annotations +from decimal import Decimal +from codat_lending.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_lending.models.shared.accountingrecordref import AccountingRecordRef, AccountingRecordRefTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. +class TransferAccount(BaseModel): - 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) + return {k: v for k, v in serialized.items() if v is not None} """ + Account details of the account sending or receiving the transfer. + """ # noqa: E501 + account_ref: Optional[AccountingRecordRef] = Field(default=None, description="The account that the transfer is moving from or to.", alias="accountRef") + 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.") + amount: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="The amount transferred between accounts.") + __properties: ClassVar[List[str]] = ["accountRef", "currency", "amount"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class TransferAccount(BaseModel): - r"""Account details of the account sending or receiving the transfer.""" - account_ref: Annotated[ - Optional[AccountingRecordRef], pydantic.Field(alias="accountRef") - ] = None - r"""Links the current record to the underlying record or data type that created it. + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - For example, if a journal entry is generated based on an invoice, this property allows you to connect the journal entry to the underlying invoice in our data model. - """ + 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()) - amount: Annotated[ - Optional[Decimal], - BeforeValidator(validate_decimal), - PlainSerializer(serialize_decimal(False)), - ] = None - r"""The amount transferred between accounts.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransferAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) - 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_. + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - ## Unknown currencies + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + * `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([ + ]) - There are only a very small number of edge cases where this currency code is returned by the Codat system. - """ + _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_ref + if self.account_ref: + _dict['accountRef'] = self.account_ref.to_dict() + return _dict - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["accountRef", "amount", "currency"]) - serialized = handler(self) - m = {} + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransferAccount 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({ + "accountRef": AccountingRecordRef.from_dict(obj["accountRef"]) if obj.get("accountRef") is not None else None, + "currency": obj.get("currency"), + "amount": obj.get("amount") + }) + return _obj - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - return m -try: - TransferAccount.model_rebuild() -except NameError: - pass + +class TransferAccountTypedDict(TypedDict): + """TypedDict variant of TransferAccount, for dict-literal request/response inputs.""" + account_ref: NotRequired[Optional[AccountingRecordRefTypedDict]] + currency: NotRequired[Optional[str]] + amount: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/shared/validation.py b/lending/src/codat_lending/models/shared/validation.py index 082d3f6ed..92b9accc1 100644 --- a/lending/src/codat_lending/models/shared/validation.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import List -from typing_extensions import NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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_lending.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/lending/src/codat_lending/models/shared/validationitem.py b/lending/src/codat_lending/models/shared/validationitem.py index b18ec8159..8414b627b 100644 --- a/lending/src/codat_lending/models/shared/validationitem.py +++ b/lending/src/codat_lending/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_lending.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -import pydantic -from pydantic import model_serializer -from typing_extensions import Annotated, NotRequired, TypedDict +""" + Lending + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | -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_lending.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/lending/src/codat_lending/models/shared/weblink.py b/lending/src/codat_lending/models/shared/weblink.py index d8c56347e..e4022f3e0 100644 --- a/lending/src/codat_lending/models/shared/weblink.py +++ b/lending/src/codat_lending/models/shared/weblink.py @@ -1,51 +1,113 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import BaseModel, UNSET_SENTINEL -from enum import Enum -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict +from codat_lending.models.web_link_type import WebLinkType +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 WebLinkType(str, Enum): - r"""The type of the weblink.""" +class WebLink(BaseModel): - WEBSITE = "Website" - SOCIAL = "Social" - UNKNOWN = "Unknown" + @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} + """ + Weblink associated with the company. + """ # noqa: E501 + type: Optional[WebLinkType] = Field(default=None, description="The type of the weblink.") + url: Optional[str] = Field(default=None, description="The full URL for the weblink.") + __properties: ClassVar[List[str]] = ["type", "url"] + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value -class WebLinkTypedDict(TypedDict): - r"""Weblink associated with the company.""" + if value not in set(['Website', 'Social', 'Unknown']): + raise ValueError("must be one of enum values ('Website', 'Social', 'Unknown')") + return value - type: NotRequired[WebLinkType] - r"""The type of the weblink.""" - url: NotRequired[str] - r"""The full URL for the weblink.""" + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) -class WebLink(BaseModel): - r"""Weblink associated with the company.""" + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - type: Optional[WebLinkType] = None - r"""The type of the weblink.""" + 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()) - url: Optional[str] = None - r"""The full URL for the weblink.""" + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WebLink from a JSON string""" + return cls.from_dict(json.loads(json_str)) - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["type", "url"]) - serialized = handler(self) - 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)`: + + * `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 WebLink from a dict""" + if obj is None: + return None - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val + _obj = cls.model_validate({ + "type": obj.get("type"), + "url": obj.get("url") + }) + return _obj - return m + + + + +class WebLinkTypedDict(TypedDict): + """TypedDict variant of WebLink, for dict-literal request/response inputs.""" + type: NotRequired[Optional[WebLinkType]] + url: NotRequired[Optional[str]] diff --git a/lending/src/codat_lending/models/shared/zero.py b/lending/src/codat_lending/models/shared/zero.py index 104a0ca5d..c5b20eb1c 100644 --- a/lending/src/codat_lending/models/shared/zero.py +++ b/lending/src/codat_lending/models/shared/zero.py @@ -1,70 +1,9 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - from __future__ import annotations -from codat_lending.types import BaseModel, 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 ZeroDataType(str, Enum): - r"""Allowed name of the 'dataType'.""" - - PURCHASE_ORDERS = "purchaseOrders" - BILLS = "bills" - - -class ZeroTypedDict(TypedDict): - r"""Links the current record line to the underlying record line that created it. - - For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. - """ - - data_type: NotRequired[ZeroDataType] - r"""Allowed name of the 'dataType'.""" - id: NotRequired[str] - r"""'id' of the underlying record.""" - line_number: NotRequired[str] - r"""Line number of the underlying record.""" - - -class Zero(BaseModel): - r"""Links the current record line to the underlying record line that created it. - - For example, if a bill is generated from a purchase order, this property allows you to connect the bill line item to the purchase order line item in our data model. - """ - - data_type: Annotated[Optional[ZeroDataType], pydantic.Field(alias="dataType")] = ( - None - ) - r"""Allowed name of the 'dataType'.""" - - id: Optional[str] = None - r"""'id' of the underlying record.""" - - line_number: Annotated[Optional[str], pydantic.Field(alias="lineNumber")] = None - r"""Line number of the underlying record.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["dataType", "id", "lineNumber"]) - 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: - Zero.model_rebuild() -except NameError: - pass + """Speakeasy-name compat for RecordLineReferenceDataType (matched by value set).""" + PURCHASE_ORDERS = 'purchaseOrders' + BILLS = 'bills' diff --git a/lending/src/codat_lending/models/source.py b/lending/src/codat_lending/models/source.py new file mode 100644 index 000000000..e47ce30c4 --- /dev/null +++ b/lending/src/codat_lending/models/source.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from enum import Enum + + +class Source(str, Enum): + """Source enum (lifted from inline OAS enum).""" + CODAT = 'codat' diff --git a/lending/src/codat_lending/models/source_account_status.py b/lending/src/codat_lending/models/source_account_status.py new file mode 100644 index 000000000..f34ef8351 --- /dev/null +++ b/lending/src/codat_lending/models/source_account_status.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from enum import Enum + + +class SourceAccountStatus(str, Enum): + """SourceAccountStatus enum (lifted from inline OAS enum).""" + PENDING = 'pending' + CONNECTED = 'connected' + CONNECTING = 'connecting' + DISCONNECTED = 'disconnected' + UNKNOWN = 'unknown' diff --git a/lending/src/codat_lending/models/source_account_v2.py b/lending/src/codat_lending/models/source_account_v2.py new file mode 100644 index 000000000..28625d554 --- /dev/null +++ b/lending/src/codat_lending/models/source_account_v2.py @@ -0,0 +1,181 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.utils.serializers import serialize_decimal, validate_decimal +from codat_lending.models.source_account_v2_status import SourceAccountV2Status +from codat_lending.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_lending.models.shared.accountinfo import AccountInfo, AccountInfoTypedDict +from codat_lending.models.shared.routinginfo import RoutingInfo, RoutingInfoTypedDict +from typing import Optional, Set +from typing_extensions import Self, NotRequired, TypedDict + +from codat_lending.models._compat.sourceaccountv2 import SourceAccountV2AccountType +from codat_lending.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/lending/src/codat_lending/models/source_account_v2_status.py b/lending/src/codat_lending/models/source_account_v2_status.py new file mode 100644 index 000000000..a071b6641 --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/source_account_v2_type.py b/lending/src/codat_lending/models/source_account_v2_type.py new file mode 100644 index 000000000..1317eb261 --- /dev/null +++ b/lending/src/codat_lending/models/source_account_v2_type.py @@ -0,0 +1,20 @@ +from __future__ import annotations + +from enum import Enum + + +class SourceAccountV2Type(str, Enum): + """SourceAccountV2Type 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/lending/src/codat_lending/models/source_type.py b/lending/src/codat_lending/models/source_type.py new file mode 100644 index 000000000..f78ddf03d --- /dev/null +++ b/lending/src/codat_lending/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/lending/src/codat_lending/models/start_upload_session_request_data_type.py b/lending/src/codat_lending/models/start_upload_session_request_data_type.py new file mode 100644 index 000000000..35c2b529d --- /dev/null +++ b/lending/src/codat_lending/models/start_upload_session_request_data_type.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from enum import Enum + + +class StartUploadSessionRequestDataType(str, Enum): + """StartUploadSessionRequestDataType enum (lifted from inline OAS enum).""" + BANKING_ACCOUNTS = 'banking-accounts' + BANKING_TRANSACTIONS = 'banking-transactions' diff --git a/lending/src/codat_lending/models/tax_rate_reference.py b/lending/src/codat_lending/models/tax_rate_reference.py new file mode 100644 index 000000000..d47be032f --- /dev/null +++ b/lending/src/codat_lending/models/tax_rate_reference.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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 TaxRateReference(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} + """ + Data types that reference a tax rate, for example invoice and bill line items, use a taxRateRef that includes the ID and name of the linked tax rate. Found on: - Bill line items - Bill Credit Note line items - Credit Note line items - Direct incomes line items - Invoice line items - Items + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="Unique identifier for the tax rate in the accounting software.") + name: Optional[str] = Field(default=None, description="Name of the tax rate in the accounting software.") + effective_tax_rate: Annotated[Optional[Decimal], BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(default=None, description="Applicable tax rate.", alias="effectiveTaxRate") + __properties: ClassVar[List[str]] = ["id", "name", "effectiveTaxRate"] + + 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 TaxRateReference 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 TaxRateReference 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"), + "effectiveTaxRate": obj.get("effectiveTaxRate") + }) + return _obj + + + + + +class TaxRateReferenceTypedDict(TypedDict): + """TypedDict variant of TaxRateReference, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + name: NotRequired[Optional[str]] + effective_tax_rate: NotRequired[Optional[Decimal]] diff --git a/lending/src/codat_lending/models/tracking_record_ref.py b/lending/src/codat_lending/models/tracking_record_ref.py new file mode 100644 index 000000000..e845269af --- /dev/null +++ b/lending/src/codat_lending/models/tracking_record_ref.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.models.journal_line_tracking_data_type import JournalLineTrackingDataType +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_lending.models._compat.trackingrecordref import TrackingRecordRefDataType +class TrackingRecordRef(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} + """ + Links to the customer or tracking category. + """ # noqa: E501 + id: Optional[str] = Field(default=None, description="'id' of the underlying record or data type.") + data_type: Optional[TrackingRecordRefDataType] = Field(default=None, description="Name of underlying data type.", alias="dataType") + __properties: ClassVar[List[str]] = ["id", "dataType"] + + @field_validator('data_type') + def data_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customers', 'suppliers', 'trackingCategories']): + raise ValueError("must be one of enum values ('customers', 'suppliers', 'trackingCategories')") + 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 TrackingRecordRef 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 TrackingRecordRef 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") + }) + return _obj + + + + + +class TrackingRecordRefTypedDict(TypedDict): + """TypedDict variant of TrackingRecordRef, for dict-literal request/response inputs.""" + id: NotRequired[Optional[str]] + data_type: NotRequired[Optional[TrackingRecordRefDataType]] diff --git a/lending/src/codat_lending/models/type.py b/lending/src/codat_lending/models/type.py new file mode 100644 index 000000000..c24d26b5a --- /dev/null +++ b/lending/src/codat_lending/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).""" + ABA = 'aba' + APCA = 'apca' + BANKCODE = 'bankcode' + BLZ = 'blz' + BSB = 'bsb' + CLABE = 'clabe' + IBAN = 'iban' + IFSC = 'ifsc' + NZ2 = 'nz2' + RTN = 'rtn' + SORTCODE = 'sortcode' + SWIFT = 'swift' + TRNO = 'trno' diff --git a/lending/src/codat_lending/models/update_connection.py b/lending/src/codat_lending/models/update_connection.py new file mode 100644 index 000000000..8950e0604 --- /dev/null +++ b/lending/src/codat_lending/models/update_connection.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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/lending/src/codat_lending/models/upload_bank_statement_data_request.py b/lending/src/codat_lending/models/upload_bank_statement_data_request.py new file mode 100644 index 000000000..fcad79854 --- /dev/null +++ b/lending/src/codat_lending/models/upload_bank_statement_data_request.py @@ -0,0 +1,164 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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, Dict, List, Optional +from codat_lending.models.shared.bankingaccount import BankingAccount, BankingAccountTypedDict +from codat_lending.models.shared.bankingtransactions import BankingTransactions, BankingTransactionsTypedDict +from pydantic import Field +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self, NotRequired, TypedDict + +UPLOADBANKSTATEMENTDATAREQUEST_ONE_OF_SCHEMAS = ["BankingAccount", "BankingTransactions", "object"] + +class UploadBankStatementDataRequest(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} + """ + UploadBankStatementDataRequest + """ + # data type: BankingAccount + oneof_schema_1_validator: Optional[BankingAccount] = None + # data type: BankingTransactions + oneof_schema_2_validator: Optional[BankingTransactions] = None + # data type: object + oneof_schema_3_validator: Optional[Any] = Field(default=None, description="The format should be identical to the file format receieved from the third-party banking source (e.g. Plaid or TrueLayer).") + actual_instance: Optional[Union[BankingAccount, BankingTransactions, object]] = None + one_of_schemas: Set[str] = { "BankingAccount", "BankingTransactions", "object" } + + 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 = UploadBankStatementDataRequest.model_construct() + error_messages = [] + match = 0 + # validate data type: BankingAccount + if not isinstance(v, BankingAccount): + error_messages.append(f"Error! Input type `{type(v)}` is not `BankingAccount`") + else: + match += 1 + # validate data type: BankingTransactions + if not isinstance(v, BankingTransactions): + error_messages.append(f"Error! Input type `{type(v)}` is not `BankingTransactions`") + else: + match += 1 + # validate data type: object (freeform: anything matches, when nothing typed did) + if match == 0: + instance.oneof_schema_3_validator = v + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in UploadBankStatementDataRequest with oneOf schemas: BankingAccount, BankingTransactions, object. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in UploadBankStatementDataRequest with oneOf schemas: BankingAccount, BankingTransactions, object. 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 BankingAccount + try: + instance.actual_instance = BankingAccount.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into BankingTransactions + try: + instance.actual_instance = BankingTransactions.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into object (freeform: anything matches, when nothing typed did) + if match == 0: + instance.oneof_schema_3_validator = json.loads(json_str) + instance.actual_instance = instance.oneof_schema_3_validator + match += 1 + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into UploadBankStatementDataRequest with oneOf schemas: BankingAccount, BankingTransactions, object. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into UploadBankStatementDataRequest with oneOf schemas: BankingAccount, BankingTransactions, object. 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], BankingAccount, BankingTransactions, object]]: + """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 UploadBankStatementDataRequestTypedDict(TypedDict): + """TypedDict variant of UploadBankStatementDataRequest, for dict-literal request/response inputs.""" + oneof_schema_1_validator: NotRequired[Optional[BankingAccountTypedDict]] + oneof_schema_2_validator: NotRequired[Optional[BankingTransactionsTypedDict]] + oneof_schema_3_validator: NotRequired[Optional[Dict[str, Any]]] + actual_instance: NotRequired[Optional[Union[BankingAccountTypedDict, BankingTransactionsTypedDict, object]]] + one_of_schemas: NotRequired[Set[str]] diff --git a/lending/src/codat_lending/models/valid_data_type_links.py b/lending/src/codat_lending/models/valid_data_type_links.py new file mode 100644 index 000000000..9d1e828ec --- /dev/null +++ b/lending/src/codat_lending/models/valid_data_type_links.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.types import OptionalNullable, UNSET, UNSET_SENTINEL +class ValidDataTypeLinks(BaseModel): + + @model_serializer(mode="wrap") + def _serialize_drop_none(self, handler): + serialized = handler(self) + _nullable = {'links', 'property'} + return { + k: v for k, v in serialized.items() + if v != UNSET_SENTINEL and (v is not None or k in _nullable) + } + """ + When querying Codat's data model, some data types return `validDatatypeLinks` metadata in the JSON response. This indicates where that object can be used as a reference—a _valid link_—when creating or updating other data. For example, `validDatatypeLinks` might indicate the following references: - Which tax rates are valid to use on the line item of a bill. - Which items can be used when creating an invoice. You can use `validDatatypeLinks` to present your SMB customers with only valid choices when selecting objects from a list, for example. ## `validDatatypeLinks` example The following example uses the `Accounting.Accounts` data type. It shows that, on the linked integration, this account is valid as the account on a payment or bill payment; and as the account referenced on the line item of a direct income or direct cost. Because there is no valid link to Invoices or Bills, using this account on those data types will result in an error. ```json validDatatypeLinks for an account { \"id\": \"bd9e85e0-0478-433d-ae9f-0b3c4f04bfe4\", \"nominalCode\": \"090\", \"name\": \"Business Bank Account\", #... \"validDatatypeLinks\": [ { \"property\": \"Id\", \"links\": [ \"Payment.AccountRef.Id\", \"BillPayment.AccountRef.Id\", \"DirectIncome.LineItems.AccountRef.Id\", \"DirectCost.LineItems.AccountRef.Id\" ] } ] } ``` ## Support for `validDatatypeLinks` Codat currently supports `validDatatypeLinks` for some data types on our Xero, QuickBooks Online, QuickBooks Desktop, Exact (NL), and Sage Business Cloud integrations. If you'd like us to extend support to more data types or integrations, suggest or vote for this on our Product Roadmap. + """ # noqa: E501 + property: OptionalNullable[str] = Field(default=UNSET, description="The property from the account that can be linked.", alias="property") + links: OptionalNullable[List[str]] = Field(default=UNSET, description="Supported `dataTypes` that the record can be linked to.") + __properties: ClassVar[List[str]] = ["property", "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 ValidDataTypeLinks 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 ValidDataTypeLinks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "property": obj.get("property"), + "links": obj.get("links") + }) + return _obj + + + + + +class ValidDataTypeLinksTypedDict(TypedDict): + """TypedDict variant of ValidDataTypeLinks, for dict-literal request/response inputs.""" + property: NotRequired[Optional[str]] + links: NotRequired[Optional[List[str]]] diff --git a/lending/src/codat_lending/models/web_link_type.py b/lending/src/codat_lending/models/web_link_type.py new file mode 100644 index 000000000..a61749585 --- /dev/null +++ b/lending/src/codat_lending/models/web_link_type.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +from enum import Enum + + +class WebLinkType(str, Enum): + """WebLinkType enum (lifted from inline OAS enum).""" + WEBSITE = 'Website' + SOCIAL = 'Social' + UNKNOWN = 'Unknown' diff --git a/lending/src/codat_lending/models/webhooks/__init__.py b/lending/src/codat_lending/models/webhooks/__init__.py index 34255c629..d68395d72 100644 --- a/lending/src/codat_lending/models/webhooks/__init__.py +++ b/lending/src/codat_lending/models/webhooks/__init__.py @@ -1,31 +1,4 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from typing import Any, TYPE_CHECKING - -from codat_lending.utils.dynamic_imports import lazy_getattr, lazy_dir - -if TYPE_CHECKING: - from .reports_creditmodel_generate_successful import ( - ReportsCreditModelGenerateSuccessfulReportGenerationWebhook, - ReportsCreditModelGenerateSuccessfulReportGenerationWebhookTypedDict, - ) - -__all__ = [ - "ReportsCreditModelGenerateSuccessfulReportGenerationWebhook", - "ReportsCreditModelGenerateSuccessfulReportGenerationWebhookTypedDict", -] - -_dynamic_imports: dict[str, str] = { - "ReportsCreditModelGenerateSuccessfulReportGenerationWebhook": ".reports_creditmodel_generate_successful", - "ReportsCreditModelGenerateSuccessfulReportGenerationWebhookTypedDict": ".reports_creditmodel_generate_successful", -} - - -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) +from codat_lending.models.webhooks.reports_categorizedbankstatement_generate_successful import ReportsCategorizedBankStatementGenerateSuccessfulReportGenerationWebhook, ReportsCategorizedBankStatementGenerateSuccessfulReportGenerationWebhookTypedDict +from codat_lending.models.webhooks.reports_categorizedbankstatement_generate_unsuccessful import ReportsCategorizedBankStatementGenerateUnsuccessfulReportGenerationWebhook, ReportsCategorizedBankStatementGenerateUnsuccessfulReportGenerationWebhookTypedDict +from codat_lending.models.webhooks.reports_creditmodel_generate_successful import ReportsCreditModelGenerateSuccessfulReportGenerationWebhook, ReportsCreditModelGenerateSuccessfulReportGenerationWebhookTypedDict +from codat_lending.models.webhooks.reports_creditmodel_generate_unsuccessful import ReportsCreditModelGenerateUnsuccessfulReportGenerationWebhook, ReportsCreditModelGenerateUnsuccessfulReportGenerationWebhookTypedDict diff --git a/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_successful.py b/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_successful.py new file mode 100644 index 000000000..6ab7bbdf6 --- /dev/null +++ b/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_successful.py @@ -0,0 +1,33 @@ +"""Webhook payload models Speakeasy names. Synthesized to match Speakeasy's surface.""" +from __future__ import annotations +from typing import Any, Optional +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ReportsCategorizedBankStatementGenerateSuccessfulReportGenerationWebhookTypedDict(TypedDict): + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + payload: NotRequired[Optional[Any]] + + +class ReportsCategorizedBankStatementGenerateSuccessfulReportGenerationWebhook(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} + + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) + + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + + event_type: Optional[str] = Field(default=None, alias="eventType") + generated_date: Optional[str] = Field(default=None, alias="generatedDate") + id: Optional[str] = None + payload: Optional[Any] = None + + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_unsuccessful.py b/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_unsuccessful.py new file mode 100644 index 000000000..8f88bbd51 --- /dev/null +++ b/lending/src/codat_lending/models/webhooks/reports_categorizedbankstatement_generate_unsuccessful.py @@ -0,0 +1,33 @@ +"""Webhook payload models Speakeasy names. Synthesized to match Speakeasy's surface.""" +from __future__ import annotations +from typing import Any, Optional +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ReportsCategorizedBankStatementGenerateUnsuccessfulReportGenerationWebhookTypedDict(TypedDict): + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + payload: NotRequired[Optional[Any]] + + +class ReportsCategorizedBankStatementGenerateUnsuccessfulReportGenerationWebhook(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} + + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) + + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + + event_type: Optional[str] = Field(default=None, alias="eventType") + generated_date: Optional[str] = Field(default=None, alias="generatedDate") + id: Optional[str] = None + payload: Optional[Any] = None + + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_successful.py b/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_successful.py index 0aa32df70..85d1c405d 100644 --- a/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_successful.py +++ b/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_successful.py @@ -1,98 +1,33 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - +"""Webhook payload models Speakeasy names. Synthesized to match Speakeasy's surface.""" from __future__ import annotations -from codat_lending.models.shared import ( - reportgenerationpayload as shared_reportgenerationpayload, -) -from codat_lending.types import BaseModel, UNSET_SENTINEL -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Any, Optional +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict class ReportsCreditModelGenerateSuccessfulReportGenerationWebhookTypedDict(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: - - ``` - 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: NotRequired[str] - r"""Unique identifier of the event.""" - payload: NotRequired[ - shared_reportgenerationpayload.ReportGenerationPayloadTypedDict - ] + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + payload: NotRequired[Optional[Any]] class ReportsCreditModelGenerateSuccessfulReportGenerationWebhook(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: - - ``` - 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: Optional[str] = None - r"""Unique identifier of the event.""" - - payload: Optional[shared_reportgenerationpayload.ReportGenerationPayload] = None - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["eventType", "generatedDate", "id", "payload"]) + def _serialize_drop_none(self, handler): serialized = handler(self) - m = {} + return {k: v for k, v in serialized.items() if v is not None} - 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): + return self.model_dump(by_alias=True, exclude_none=True) - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + event_type: Optional[str] = Field(default=None, alias="eventType") + generated_date: Optional[str] = Field(default=None, alias="generatedDate") + id: Optional[str] = None + payload: Optional[Any] = None -try: - ReportsCreditModelGenerateSuccessfulReportGenerationWebhook.model_rebuild() -except NameError: - pass + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_unsuccessful.py b/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_unsuccessful.py new file mode 100644 index 000000000..7ac805977 --- /dev/null +++ b/lending/src/codat_lending/models/webhooks/reports_creditmodel_generate_unsuccessful.py @@ -0,0 +1,33 @@ +"""Webhook payload models Speakeasy names. Synthesized to match Speakeasy's surface.""" +from __future__ import annotations +from typing import Any, Optional +from pydantic import BaseModel, ConfigDict, Field, model_serializer +from typing_extensions import NotRequired, TypedDict + + +class ReportsCreditModelGenerateUnsuccessfulReportGenerationWebhookTypedDict(TypedDict): + event_type: NotRequired[Optional[str]] + generated_date: NotRequired[Optional[str]] + id: NotRequired[Optional[str]] + payload: NotRequired[Optional[Any]] + + +class ReportsCreditModelGenerateUnsuccessfulReportGenerationWebhook(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} + + def to_dict(self): + return self.model_dump(by_alias=True, exclude_none=True) + + @classmethod + def from_dict(cls, obj): + return cls.model_validate(obj) if obj is not None else None + + event_type: Optional[str] = Field(default=None, alias="eventType") + generated_date: Optional[str] = Field(default=None, alias="generatedDate") + id: Optional[str] = None + payload: Optional[Any] = None + + model_config = ConfigDict(populate_by_name=True, protected_namespaces=()) diff --git a/lending/src/codat_lending/models/withholding_tax.py b/lending/src/codat_lending/models/withholding_tax.py new file mode 100644 index 000000000..7ef2ae04d --- /dev/null +++ b/lending/src/codat_lending/models/withholding_tax.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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 Any, ClassVar, Dict, List, Union +from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Optional, Set +from typing_extensions import Self + +class WithholdingTax(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} + """ + WithholdingTax + """ # noqa: E501 + name: str = Field(description="Name assigned to withheld tax.") + amount: Annotated[Decimal, BeforeValidator(validate_decimal), PlainSerializer(serialize_decimal(False))] = Field(description="Amount of tax withheld.") + __properties: ClassVar[List[str]] = ["name", "amount"] + + 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 WithholdingTax 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 WithholdingTax 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"), + "amount": obj.get("amount") + }) + return _obj + + + + + +class WithholdingTaxTypedDict(TypedDict): + """TypedDict variant of WithholdingTax, for dict-literal request/response inputs.""" + name: NotRequired[str] + amount: NotRequired[Decimal] diff --git a/lending/src/codat_lending/orders.py b/lending/src/codat_lending/orders.py index 419c36e7e..0efbc0730 100644 --- a/lending/src/codat_lending/orders.py +++ b/lending/src/codat_lending/orders.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.orders — re-export of the orders method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Orders(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceOrderRequest, - operations.GetCommerceOrderRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceOrder: - r"""Get order - - The *Get order* endpoint returns a single order for a given orderId. - - [Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceOrderRequest) - request = cast(operations.GetCommerceOrderRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-orders/{orderId}", - 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-commerce-order", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceOrder, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceOrderRequest, - operations.GetCommerceOrderRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceOrder: - r"""Get order - - The *Get order* endpoint returns a single order for a given orderId. - - [Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceOrderRequest) - request = cast(operations.GetCommerceOrderRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-orders/{orderId}", - 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-commerce-order", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceOrder, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceOrdersRequest, - operations.ListCommerceOrdersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceOrders: - r"""List orders - - The *List orders* endpoint returns a list of [orders](https://docs.codat.io/lending-api#/schemas/Order) for a given company's connection. - - [Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceOrdersRequest) - request = cast(operations.ListCommerceOrdersRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-orders", - 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-commerce-orders", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceOrders, 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.ListCommerceOrdersRequest, - operations.ListCommerceOrdersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceOrders: - r"""List orders - - The *List orders* endpoint returns a list of [orders](https://docs.codat.io/lending-api#/schemas/Order) for a given company's connection. - - [Orders](https://docs.codat.io/lending-api#/schemas/Order) contain the transaction details for all products sold by the company. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceOrdersRequest) - request = cast(operations.ListCommerceOrdersRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-orders", - 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-commerce-orders", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceOrders, 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_lending.api.orders import Orders diff --git a/lending/src/codat_lending/payment_methods.py b/lending/src/codat_lending/payment_methods.py index abf622687..fb1c497d1 100644 --- a/lending/src/codat_lending/payment_methods.py +++ b/lending/src/codat_lending/payment_methods.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.payment_methods — re-export of the payment_methods method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class PaymentMethods(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommercePaymentMethodRequest, - operations.GetCommercePaymentMethodRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePaymentMethod: - r"""Get payment method - - The *Get payment method* endpoint returns a single payment method for a given paymentMethodId. - - [Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommercePaymentMethodRequest - ) - request = cast(operations.GetCommercePaymentMethodRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId}", - 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-commerce-payment-method", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePaymentMethod, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommercePaymentMethodRequest, - operations.GetCommercePaymentMethodRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePaymentMethod: - r"""Get payment method - - The *Get payment method* endpoint returns a single payment method for a given paymentMethodId. - - [Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommercePaymentMethodRequest - ) - request = cast(operations.GetCommercePaymentMethodRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods/{paymentMethodId}", - 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-commerce-payment-method", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePaymentMethod, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommercePaymentMethodsRequest, - operations.ListCommercePaymentMethodsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePaymentMethods: - r"""List payment methods - - The *List payment methods* endpoint returns a list of [payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) for a given company's connection. - - [Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommercePaymentMethodsRequest - ) - request = cast(operations.ListCommercePaymentMethodsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods", - 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-commerce-payment-methods", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePaymentMethods, 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.ListCommercePaymentMethodsRequest, - operations.ListCommercePaymentMethodsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommercePaymentMethods: - r"""List payment methods - - The *List payment methods* endpoint returns a list of [payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) for a given company's connection. - - [Payment methods](https://docs.codat.io/lending-api#/schemas/PaymentMethod) represent the payment method(s) used to make payments. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommercePaymentMethodsRequest - ) - request = cast(operations.ListCommercePaymentMethodsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-paymentMethods", - 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-commerce-payment-methods", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommercePaymentMethods, 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_lending.api.payment_methods import PaymentMethods diff --git a/lending/src/codat_lending/payments.py b/lending/src/codat_lending/payments.py index 2d2b74545..9cd1a48e7 100644 --- a/lending/src/codat_lending/payments.py +++ b/lending/src/codat_lending/payments.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.payments — re-export of the payments method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Payments(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingPaymentRequest, - operations.GetAccountingPaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingPayment: - r"""Get payment - - The *Get payment* endpoint returns a single payment for a given paymentId. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingPaymentRequest) - request = cast(operations.GetAccountingPaymentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/payments/{paymentId}", - 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-accounting-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingPayment, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingPaymentRequest, - operations.GetAccountingPaymentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingPayment: - r"""Get payment - - The *Get payment* endpoint returns a single payment for a given paymentId. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingPaymentRequest) - request = cast(operations.GetAccountingPaymentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/payments/{paymentId}", - 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-accounting-payment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingPayment, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListAccountingPaymentsRequest, - operations.ListAccountingPaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingPayments: - r"""List payments - - The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingPaymentsRequest) - request = cast(operations.ListAccountingPaymentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingPayments, 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.ListAccountingPaymentsRequest, - operations.ListAccountingPaymentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingPayments: - r"""List payments - - The *List payments* endpoint returns a list of [payments](https://docs.codat.io/lending-api#/schemas/Payment) for a given company's connection. - - [Payments](https://docs.codat.io/lending-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingPaymentsRequest) - request = cast(operations.ListAccountingPaymentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/payments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-payments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingPayments, 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_lending.api.payments import Payments diff --git a/lending/src/codat_lending/product_categories.py b/lending/src/codat_lending/product_categories.py index 4bc7d780d..a776cff6e 100644 --- a/lending/src/codat_lending/product_categories.py +++ b/lending/src/codat_lending/product_categories.py @@ -1,435 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.product_categories — re-export of the product_categories method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ProductCategories(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceProductCategoryRequest, - operations.GetCommerceProductCategoryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProductCategory: - r"""Get product category - - The *Get product* endpoint returns a single product for a given productId. - - [Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceProductCategoryRequest - ) - request = cast(operations.GetCommerceProductCategoryRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-productCategories/{productId}", - 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-commerce-product-category", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProductCategory, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceProductCategoryRequest, - operations.GetCommerceProductCategoryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProductCategory: - r"""Get product category - - The *Get product* endpoint returns a single product for a given productId. - - [Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceProductCategoryRequest - ) - request = cast(operations.GetCommerceProductCategoryRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-productCategories/{productId}", - 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-commerce-product-category", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProductCategory, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceProductCategoriesRequest, - operations.ListCommerceProductCategoriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProductCategories: - r"""List product categories - - The *List product categories* endpoint returns a list of [product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) for a given company's connection. - - [Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceProductCategoriesRequest - ) - request = cast(operations.ListCommerceProductCategoriesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-productCategories", - 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-commerce-product-categories", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProductCategories, 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.ListCommerceProductCategoriesRequest, - operations.ListCommerceProductCategoriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProductCategories: - r"""List product categories - - The *List product categories* endpoint returns a list of [product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) for a given company's connection. - - [Product categories](https://docs.codat.io/lending-api#/schemas/ProductCategory) are used to classify a group of products together, either by type (e.g. \"Furniture\"), or sometimes by tax profile. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceProductCategoriesRequest - ) - request = cast(operations.ListCommerceProductCategoriesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-productCategories", - 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-commerce-product-categories", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProductCategories, 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_lending.api.product_categories import ProductCategories diff --git a/lending/src/codat_lending/products.py b/lending/src/codat_lending/products.py index 1ba52b521..5c9406ea1 100644 --- a/lending/src/codat_lending/products.py +++ b/lending/src/codat_lending/products.py @@ -1,427 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.products — re-export of the products method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Products(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetCommerceProductRequest, - operations.GetCommerceProductRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProduct: - r"""Get product - - The *Get product* endpoint returns a single product for a given productId. - - [Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceProductRequest) - request = cast(operations.GetCommerceProductRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId}", - 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-commerce-product", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProduct, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetCommerceProductRequest, - operations.GetCommerceProductRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProduct: - r"""Get product - - The *Get product* endpoint returns a single product for a given productId. - - [Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetCommerceProductRequest) - request = cast(operations.GetCommerceProductRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-products/{productId}", - 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-commerce-product", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProduct, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListCommerceProductsRequest, - operations.ListCommerceProductsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProducts: - r"""List products - - The *List products* endpoint returns a list of [products](https://docs.codat.io/lending-api#/schemas/Product) for a given company's connection. - - [Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceProductsRequest) - request = cast(operations.ListCommerceProductsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-products", - 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-commerce-products", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProducts, 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.ListCommerceProductsRequest, - operations.ListCommerceProductsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.CommerceProducts: - r"""List products - - The *List products* endpoint returns a list of [products](https://docs.codat.io/lending-api#/schemas/Product) for a given company's connection. - - [Products](https://docs.codat.io/lending-api#/schemas/Product) are items in the company's inventory that are available for sale. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListCommerceProductsRequest) - request = cast(operations.ListCommerceProductsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/commerce-products", - 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-commerce-products", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.CommerceProducts, 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_lending.api.products import Products diff --git a/lending/src/codat_lending/profit_and_loss.py b/lending/src/codat_lending/profit_and_loss.py index 2e4e1a186..5121b5cd4 100644 --- a/lending/src/codat_lending/profit_and_loss.py +++ b/lending/src/codat_lending/profit_and_loss.py @@ -1,419 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.profit_and_loss — re-export of the profit_and_loss method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class ProfitAndLoss(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetAccountingProfitAndLossRequest, - operations.GetAccountingProfitAndLossRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingProfitAndLossReport: - r"""Get profit and loss - - Gets the latest profit and loss 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.GetAccountingProfitAndLossRequest - ) - request = cast(operations.GetAccountingProfitAndLossRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/financials/profitAndLoss", - 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-accounting-profit-and-loss", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingProfitAndLossReport, http_res - ) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingProfitAndLossRequest, - operations.GetAccountingProfitAndLossRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingProfitAndLossReport: - r"""Get profit and loss - - Gets the latest profit and loss 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.GetAccountingProfitAndLossRequest - ) - request = cast(operations.GetAccountingProfitAndLossRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/financials/profitAndLoss", - 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-accounting-profit-and-loss", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingProfitAndLossReport, http_res - ) - if utils.match_response( - http_res, ["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) - - def get_categorized_accounts( - self, - *, - request: Union[ - operations.GetCategorizedProfitAndLossStatementRequest, - operations.GetCategorizedProfitAndLossStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedFinancialReport: - r"""Get categorized profit and loss statement - - The *Get categorized profit and loss statement* endpoint returns a list of categorized accounts that appear on a company’s Profit and Loss statement. It also includes a balance as of the financial statement date. - - Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - - :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.GetCategorizedProfitAndLossStatementRequest - ) - request = cast(operations.GetCategorizedProfitAndLossStatementRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/enhancedProfitAndLoss/accounts", - 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-categorized-profit-and-loss-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedFinancialReport, 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_categorized_accounts_async( - self, - *, - request: Union[ - operations.GetCategorizedProfitAndLossStatementRequest, - operations.GetCategorizedProfitAndLossStatementRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.EnhancedFinancialReport: - r"""Get categorized profit and loss statement - - The *Get categorized profit and loss statement* endpoint returns a list of categorized accounts that appear on a company’s Profit and Loss statement. It also includes a balance as of the financial statement date. - - Codat suggests a category for each account automatically, but you can [change it](https://docs.codat.io/lending/features/financial-statements-overview#recategorizing-accounts) to a more suitable one. - - :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.GetCategorizedProfitAndLossStatementRequest - ) - request = cast(operations.GetCategorizedProfitAndLossStatementRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/enhancedProfitAndLoss/accounts", - 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-categorized-profit-and-loss-statement", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.EnhancedFinancialReport, 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_lending.api.profit_and_loss import ProfitAndLoss diff --git a/lending/src/codat_lending/pull_operations.py b/lending/src/codat_lending/pull_operations.py index ba5ee3b88..6389be4db 100644 --- a/lending/src/codat_lending/pull_operations.py +++ b/lending/src/codat_lending/pull_operations.py @@ -1,403 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.pull_operations — re-export of the pull_operations method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class PullOperations(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetPullOperationRequest, - operations.GetPullOperationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Get pull operation - - Retrieve information about a single dataset or pull operation. - - :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.GetPullOperationRequest) - request = cast(operations.GetPullOperationRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/history/{datasetId}", - 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-pull-operation", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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.GetPullOperationRequest, - operations.GetPullOperationRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Get pull operation - - Retrieve information about a single dataset or pull operation. - - :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.GetPullOperationRequest) - request = cast(operations.GetPullOperationRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/history/{datasetId}", - 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-pull-operation", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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.ListPullOperationsRequest, - operations.ListPullOperationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperations: - r"""List pull operations - - Gets the pull operation history (datasets) for a given 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.ListPullOperationsRequest) - request = cast(operations.ListPullOperationsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/history", - 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-pull-operations", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperations, 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.ListPullOperationsRequest, - operations.ListPullOperationsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperations: - r"""List pull operations - - Gets the pull operation history (datasets) for a given 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.ListPullOperationsRequest) - request = cast(operations.ListPullOperationsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/history", - 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-pull-operations", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperations, 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_lending.api.pull_operations import PullOperations diff --git a/lending/src/codat_lending/py.typed b/lending/src/codat_lending/py.typed index 3e38f1a92..e69de29bb 100644 --- a/lending/src/codat_lending/py.typed +++ b/lending/src/codat_lending/py.typed @@ -1 +0,0 @@ -# Marker file for PEP 561. The package enables type hints. diff --git a/lending/src/codat_lending/refresh.py b/lending/src/codat_lending/refresh.py index b41176af1..90c8d1674 100644 --- a/lending/src/codat_lending/refresh.py +++ b/lending/src/codat_lending/refresh.py @@ -1,415 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.refresh — re-export of the refresh method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Refresh(BaseSDK): - def all_data_types( - self, - *, - request: Union[ - operations.RefreshAllDataTypesRequest, - operations.RefreshAllDataTypesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Refresh all data - - Refreshes all data types with `fetch on first link` set to `true` for a given company. - - This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - - [Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`. - - :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.RefreshAllDataTypesRequest) - request = cast(operations.RefreshAllDataTypesRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/data/all", - 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="refresh-all-data-types", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - 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 all_data_types_async( - self, - *, - request: Union[ - operations.RefreshAllDataTypesRequest, - operations.RefreshAllDataTypesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ): - r"""Refresh all data - - Refreshes all data types with `fetch on first link` set to `true` for a given company. - - This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - - [Read more](https://docs.codat.io/core-concepts/data-type-settings) about data type settings and `fetch on first link`. - - :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.RefreshAllDataTypesRequest) - request = cast(operations.RefreshAllDataTypesRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/data/all", - 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="refresh-all-data-types", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "204", "*"): - return - 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 data_type( - self, - *, - request: Union[ - operations.RefreshDataTypeRequest, - operations.RefreshDataTypeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Refresh data type - - Refreshes a given data type for a given company. - - This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - - :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.RefreshDataTypeRequest) - request = cast(operations.RefreshDataTypeRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/data/queue/{dataType}", - 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="refresh-data-type", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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 data_type_async( - self, - *, - request: Union[ - operations.RefreshDataTypeRequest, - operations.RefreshDataTypeRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.PullOperation: - r"""Refresh data type - - Refreshes a given data type for a given company. - - This is an asynchronous operation, and will bring updated data into Codat from the linked integration for you to view. - - :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.RefreshDataTypeRequest) - request = cast(operations.RefreshDataTypeRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/data/queue/{dataType}", - 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="refresh-data-type", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.PullOperation, 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_lending.api.refresh import Refresh diff --git a/lending/src/codat_lending/reports.py b/lending/src/codat_lending/reports.py index da830015d..71c28f7f4 100644 --- a/lending/src/codat_lending/reports.py +++ b/lending/src/codat_lending/reports.py @@ -1,815 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.reports — re-export of the reports method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Reports(BaseSDK): - def get_aged_creditors( - self, - *, - request: Union[ - operations.GetAccountingAgedCreditorsReportRequest, - operations.GetAccountingAgedCreditorsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAgedCreditorReport: - r"""Aged creditors report - - Returns aged creditors report for company that shows the total balance owed by a business to its suppliers over time. - - :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.GetAccountingAgedCreditorsReportRequest - ) - request = cast(operations.GetAccountingAgedCreditorsReportRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/agedCreditor", - 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-accounting-aged-creditors-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAgedCreditorReport, 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_aged_creditors_async( - self, - *, - request: Union[ - operations.GetAccountingAgedCreditorsReportRequest, - operations.GetAccountingAgedCreditorsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAgedCreditorReport: - r"""Aged creditors report - - Returns aged creditors report for company that shows the total balance owed by a business to its suppliers over time. - - :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.GetAccountingAgedCreditorsReportRequest - ) - request = cast(operations.GetAccountingAgedCreditorsReportRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/agedCreditor", - 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-accounting-aged-creditors-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingAgedCreditorReport, 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_aged_debtors( - self, - *, - request: Union[ - operations.GetAccountingAgedDebtorsReportRequest, - operations.GetAccountingAgedDebtorsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAgedDebtorReport: - r"""Aged debtors report - - Returns aged debtors report for company that shows the total outstanding balance due from customers to the business over time. - - :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.GetAccountingAgedDebtorsReportRequest - ) - request = cast(operations.GetAccountingAgedDebtorsReportRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/agedDebtor", - 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-accounting-aged-debtors-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAgedDebtorReport, 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_aged_debtors_async( - self, - *, - request: Union[ - operations.GetAccountingAgedDebtorsReportRequest, - operations.GetAccountingAgedDebtorsReportRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAgedDebtorReport: - r"""Aged debtors report - - Returns aged debtors report for company that shows the total outstanding balance due from customers to the business over time. - - :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.GetAccountingAgedDebtorsReportRequest - ) - request = cast(operations.GetAccountingAgedDebtorsReportRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/agedDebtor", - 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-accounting-aged-debtors-report", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAgedDebtorReport, 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 is_aged_creditors_available( - self, - *, - request: Union[ - operations.IsAgedCreditorsReportAvailableRequest, - operations.IsAgedCreditorsReportAvailableRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bool: - r"""Aged creditors report available - - Indicates whether the aged creditor report is available for the 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.IsAgedCreditorsReportAvailableRequest - ) - request = cast(operations.IsAgedCreditorsReportAvailableRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/agedCreditor/available", - 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="is-aged-creditors-report-available", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(bool, 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 is_aged_creditors_available_async( - self, - *, - request: Union[ - operations.IsAgedCreditorsReportAvailableRequest, - operations.IsAgedCreditorsReportAvailableRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bool: - r"""Aged creditors report available - - Indicates whether the aged creditor report is available for the 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.IsAgedCreditorsReportAvailableRequest - ) - request = cast(operations.IsAgedCreditorsReportAvailableRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/agedCreditor/available", - 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="is-aged-creditors-report-available", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(bool, 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 is_aged_debtors_available( - self, - *, - request: Union[ - operations.IsAgedDebtorsReportAvailableRequest, - operations.IsAgedDebtorsReportAvailableRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bool: - r"""Aged debtors report available - - Indicates whether the aged debtors report is available for the 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.IsAgedDebtorsReportAvailableRequest - ) - request = cast(operations.IsAgedDebtorsReportAvailableRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/reports/agedDebtor/available", - 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="is-aged-debtors-report-available", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(bool, 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 is_aged_debtors_available_async( - self, - *, - request: Union[ - operations.IsAgedDebtorsReportAvailableRequest, - operations.IsAgedDebtorsReportAvailableRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> bool: - r"""Aged debtors report available - - Indicates whether the aged debtors report is available for the 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.IsAgedDebtorsReportAvailableRequest - ) - request = cast(operations.IsAgedDebtorsReportAvailableRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/reports/agedDebtor/available", - 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="is-aged-debtors-report-available", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(bool, 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_lending.api.reports import Reports diff --git a/lending/src/codat_lending/rest.py b/lending/src/codat_lending/rest.py new file mode 100644 index 000000000..67f7e1c66 --- /dev/null +++ b/lending/src/codat_lending/rest.py @@ -0,0 +1,258 @@ +# coding: utf-8 + +""" + Lending + + Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. [Explore solution](https://docs.codat.io/lending/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. | | Bank statements | Retrieve banking data from linked bank accounts. | | Sales | Retrieve standardized sales data from a linked commerce software. | | Financial statements | Financial data and reports from a linked accounting software. | | Liabilities | Debt and other liabilities. | | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | | Transactions | Data from a linked accounting software representing transactions. | | Company info | View company information fetched from the source platform. | | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | | Excel reports | Download reports in Excel format. | | Manage data | Control how data is retrieved from an integration. | | File upload | Endpoints to manage uploaded files. | | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | + + 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_lending.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/lending/src/codat_lending/sales.py b/lending/src/codat_lending/sales.py index 3edf245a8..a6d27ce12 100644 --- a/lending/src/codat_lending/sales.py +++ b/lending/src/codat_lending/sales.py @@ -1,62 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.sales — re-export of the sales method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.codatlending_customers import CodatLendingCustomers -from codat_lending.codatlending_reports import CodatLendingReports -from codat_lending.codatlending_sales_payments import CodatLendingSalesPayments -from codat_lending.codatlending_transactions import CodatLendingTransactions -from codat_lending.disputes import Disputes -from codat_lending.locations import Locations -from codat_lending.metrics import Metrics -from codat_lending.orders import Orders -from codat_lending.payment_methods import PaymentMethods -from codat_lending.product_categories import ProductCategories -from codat_lending.products import Products -from typing import Optional - - -class Sales(BaseSDK): - customers: CodatLendingCustomers - disputes: Disputes - locations: Locations - orders: Orders - payment_methods: PaymentMethods - payments: CodatLendingSalesPayments - product_categories: ProductCategories - products: Products - transactions: CodatLendingTransactions - metrics: Metrics - reports: CodatLendingReports - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.customers = CodatLendingCustomers( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.disputes = Disputes(self.sdk_configuration, parent_ref=self.parent_ref) - self.locations = Locations(self.sdk_configuration, parent_ref=self.parent_ref) - self.orders = Orders(self.sdk_configuration, parent_ref=self.parent_ref) - self.payment_methods = PaymentMethods( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.payments = CodatLendingSalesPayments( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.product_categories = ProductCategories( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.products = Products(self.sdk_configuration, parent_ref=self.parent_ref) - self.transactions = CodatLendingTransactions( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.metrics = Metrics(self.sdk_configuration, parent_ref=self.parent_ref) - self.reports = CodatLendingReports( - self.sdk_configuration, parent_ref=self.parent_ref - ) +from codat_lending.api.sales import Sales diff --git a/lending/src/codat_lending/sdk.py b/lending/src/codat_lending/sdk.py index 545aeae0f..145b3154a 100644 --- a/lending/src/codat_lending/sdk.py +++ b/lending/src/codat_lending/sdk.py @@ -1,134 +1,116 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""Top-level composed client for Lending. -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_lending import utils -from codat_lending._hooks import SDKHooks -from codat_lending.models import shared -from codat_lending.types import OptionalNullable, UNSET -import httpx -import importlib -import sys -from typing import Callable, Dict, Optional, TYPE_CHECKING, Union, cast -import weakref +Generated by pipeline/postprocess_generated.py — do not edit by hand. +""" -if TYPE_CHECKING: - from codat_lending.accounts_payable import AccountsPayable - from codat_lending.accounts_receivable import AccountsReceivable - from codat_lending.bank_statements import BankStatements - from codat_lending.banking import Banking - from codat_lending.codatlending_accounting_bank_data import ( - CodatLendingAccountingBankData, - ) - from codat_lending.companies import Companies - from codat_lending.company_info import CompanyInfo - from codat_lending.connections import Connections - from codat_lending.data_integrity import DataIntegrity - from codat_lending.excel_reports import ExcelReports - from codat_lending.file_upload import FileUpload - from codat_lending.financial_statements import FinancialStatements - from codat_lending.liabilities import Liabilities - from codat_lending.loan_writeback import LoanWriteback - from codat_lending.manage_data import ManageData - from codat_lending.manage_reports import ManageReports - from codat_lending.sales import Sales - from codat_lending.transactions import Transactions - - -class CodatLending(BaseSDK): - r"""Lending: Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. +from __future__ import annotations - The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. +from typing import TYPE_CHECKING, Any, Callable, Dict, Mapping, Optional, Union - [Explore solution](https://docs.codat.io/lending/overview) | [See OpenAPI spec](https://github.com/codatio/oas) +from codat_lending.api_client import ApiClient +from codat_lending.configuration import Configuration +from codat_lending._hooks import SDKHooks, attach_hooks_to_api_client +from codat_lending.types import UNSET, OptionalNullable +from codat_lending.utils.retries import RetryConfig - - ## Endpoints - - | Endpoints | Description | - | :- |:- | - | Companies | Create and manage your SMB users' companies. | - | Connections | Create new and manage existing data connections for a company. | - | Bank statements | Retrieve banking data from linked bank accounts. | - | Sales | Retrieve standardized sales data from a linked commerce software. | - | Financial statements | Financial data and reports from a linked accounting software. | - | Liabilities | Debt and other liabilities. | - | Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | - | Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | - | Transactions | Data from a linked accounting software representing transactions. | - | Company info | View company information fetched from the source platform. | - | Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | - | Excel reports | Download reports in Excel format. | - | Manage data | Control how data is retrieved from an integration. | - | File upload | Endpoints to manage uploaded files. | - | Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | - - """ +if TYPE_CHECKING: + from codat_lending.httpclient import AsyncHttpClient, HttpClient + +from codat_lending.api.accounting_bank_data import AccountingBankData +from codat_lending.api.accounts_payable import AccountsPayable +from codat_lending.api.accounts_receivable import AccountsReceivable +from codat_lending.api.banking import Banking +from codat_lending.api.financial_statements import FinancialStatements +from codat_lending.api.loan_writeback import LoanWriteback +from codat_lending.api.manage_data import ManageData +from codat_lending.api.sales import Sales +from codat_lending.api.transactions_group import TransactionsGroup +from codat_lending.api.companies import Companies +from codat_lending.api.connections import Connections +from codat_lending.api.bank_statements import BankStatements +from codat_lending.api.liabilities import Liabilities +from codat_lending.api.company_info import CompanyInfo +from codat_lending.api.data_integrity import DataIntegrity +from codat_lending.api.excel_reports import ExcelReports +from codat_lending.api.file_upload import FileUpload +from codat_lending.api.manage_reports import ManageReports +from codat_lending.api.financial_summary import FinancialSummary + + +_DEFAULT_TIMEOUT_MS = 5000 + + +class CodatLending: + r"""Lending: Our Lending solution helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently. +The Lending solution is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers. + +[Explore solution](https://docs.codat.io/lending/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. | +| Bank statements | Retrieve banking data from linked bank accounts. | +| Sales | Retrieve standardized sales data from a linked commerce software. | +| Financial statements | Financial data and reports from a linked accounting software. | +| Liabilities | Debt and other liabilities. | +| Accounts payable | Data from a linked accounting software representing money the business owes money to its suppliers. | +| Accounts receivable | Data from a linked accounting software representing money owed to the business for sold goods or services. | +| Transactions | Data from a linked accounting software representing transactions. | +| Company info | View company information fetched from the source platform. | +| Data integrity | Match mutable accounting data with immutable banking data to increase confidence in financial data. | +| Excel reports | Download reports in Excel format. | +| Manage data | Control how data is retrieved from an integration. | +| File upload | Endpoints to manage uploaded files. | +| Loan writeback | Implement the [loan writeback](https://docs.codat.io/lending/guides/loan-writeback/introduction) procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle. | +""" + + accounting_bank_data: "AccountingBankData" + r"""""" + accounts_payable: "AccountsPayable" + r"""""" + accounts_receivable: "AccountsReceivable" + r"""""" + banking: "Banking" + r"""""" + financial_statements: "FinancialStatements" + r"""""" + loan_writeback: "LoanWriteback" + r"""""" + manage_data: "ManageData" + r"""""" + sales: "Sales" + r"""""" + transactions: "TransactionsGroup" + r"""""" companies: "Companies" r"""Create and manage your SMB users' companies.""" connections: "Connections" r"""Create new and manage existing data connections for a company.""" - loan_writeback: "LoanWriteback" bank_statements: "BankStatements" r"""Retrieve banking data from linked bank accounts.""" - transactions: "Transactions" - accounting_bank_data: "CodatLendingAccountingBankData" - r"""Access bank transactions from an accounting software.""" - banking: "Banking" - accounts_payable: "AccountsPayable" - sales: "Sales" - company_info: "CompanyInfo" - r"""View company information fetched from the source platform.""" - accounts_receivable: "AccountsReceivable" - file_upload: "FileUpload" - r"""Endpoints to manage uploaded files.""" - financial_statements: "FinancialStatements" - manage_data: "ManageData" - manage_reports: "ManageReports" - r"""Generate and review generated reports for a company.""" liabilities: "Liabilities" r"""Debt and other liabilities.""" + company_info: "CompanyInfo" + r"""View company information fetched from the source platform.""" data_integrity: "DataIntegrity" r"""Match mutable accounting data with immutable banking data to increase confidence in financial data.""" excel_reports: "ExcelReports" r"""Download reports in Excel format.""" - _sub_sdk_map = { - "companies": ("codat_lending.companies", "Companies"), - "connections": ("codat_lending.connections", "Connections"), - "loan_writeback": ("codat_lending.loan_writeback", "LoanWriteback"), - "bank_statements": ("codat_lending.bank_statements", "BankStatements"), - "transactions": ("codat_lending.transactions", "Transactions"), - "accounting_bank_data": ( - "codat_lending.codatlending_accounting_bank_data", - "CodatLendingAccountingBankData", - ), - "banking": ("codat_lending.banking", "Banking"), - "accounts_payable": ("codat_lending.accounts_payable", "AccountsPayable"), - "sales": ("codat_lending.sales", "Sales"), - "company_info": ("codat_lending.company_info", "CompanyInfo"), - "accounts_receivable": ( - "codat_lending.accounts_receivable", - "AccountsReceivable", - ), - "file_upload": ("codat_lending.file_upload", "FileUpload"), - "financial_statements": ( - "codat_lending.financial_statements", - "FinancialStatements", - ), - "manage_data": ("codat_lending.manage_data", "ManageData"), - "manage_reports": ("codat_lending.manage_reports", "ManageReports"), - "liabilities": ("codat_lending.liabilities", "Liabilities"), - "data_integrity": ("codat_lending.data_integrity", "DataIntegrity"), - "excel_reports": ("codat_lending.excel_reports", "ExcelReports"), - } + file_upload: "FileUpload" + r"""Endpoints to manage uploaded files.""" + manage_reports: "ManageReports" + r"""Generate and review generated reports for a company.""" + financial_summary: "FinancialSummary" + r"""View financial summary information for a company, including credit model reports and accounting score.""" 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, @@ -136,139 +118,112 @@ 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_lending._httpx_transport import HttpxRestClient + self._api_client.rest_client = HttpxRestClient(client) + try: + from codat_lending._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.accounting_bank_data = AccountingBankData(api_client=self._api_client) + self.accounts_payable = AccountsPayable(api_client=self._api_client) + self.accounts_receivable = AccountsReceivable(api_client=self._api_client) + self.banking = Banking(api_client=self._api_client) + self.financial_statements = FinancialStatements(api_client=self._api_client) + self.loan_writeback = LoanWriteback(api_client=self._api_client) + self.manage_data = ManageData(api_client=self._api_client) + self.sales = Sales(api_client=self._api_client) + self.transactions = TransactionsGroup(api_client=self._api_client) + self.companies = Companies(api_client=self._api_client) + self.connections = Connections(api_client=self._api_client) + self.bank_statements = BankStatements(api_client=self._api_client) + self.liabilities = Liabilities(api_client=self._api_client) + self.company_info = CompanyInfo(api_client=self._api_client) + self.data_integrity = DataIntegrity(api_client=self._api_client) + self.excel_reports = ExcelReports(api_client=self._api_client) + self.file_upload = FileUpload(api_client=self._api_client) + self.manage_reports = ManageReports(api_client=self._api_client) + self.financial_summary = FinancialSummary(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.accounting_bank_data, + self.accounts_payable, + self.accounts_receivable, + self.banking, + self.financial_statements, + self.loan_writeback, + self.manage_data, + self.sales, + self.transactions, + self.companies, + self.connections, + self.bank_statements, + self.liabilities, + self.company_info, + self.data_integrity, + self.excel_reports, + self.file_upload, + self.manage_reports, + self.financial_summary, + ): + _attach_sdk_defaults(_grp) - def __enter__(self): + def __enter__(self) -> "CodatLending": + 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) -> "CodatLending": + 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/lending/src/codat_lending/sdkconfiguration.py b/lending/src/codat_lending/sdkconfiguration.py deleted file mode 100644 index e0877bb09..000000000 --- a/lending/src/codat_lending/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_lending.models import shared -from codat_lending.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/lending/src/codat_lending/source_accounts.py b/lending/src/codat_lending/source_accounts.py index 9e956c2a6..f53f595e7 100644 --- a/lending/src/codat_lending/source_accounts.py +++ b/lending/src/codat_lending/source_accounts.py @@ -1,715 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.source_accounts — re-export of the source_accounts method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, List, Mapping, Optional, Union, cast - - -class SourceAccounts(BaseSDK): - 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 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_mapping( - 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.BankFeedBankAccountMappingResponse: - 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_bank_account_mapping if request is not None else None, - False, - True, - "json", - Optional[shared.BankFeedBankAccountMapping], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankFeedBankAccountMappingResponse, 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_mapping_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.BankFeedBankAccountMappingResponse: - 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_bank_account_mapping if request is not None else None, - False, - True, - "json", - Optional[shared.BankFeedBankAccountMapping], - ), - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankFeedBankAccountMappingResponse, 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_mappings( - 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 account mappings - - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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 list_mappings_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 account mappings - - 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, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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_lending.api.source_accounts import SourceAccounts diff --git a/lending/src/codat_lending/suppliers.py b/lending/src/codat_lending/suppliers.py index 55586b773..8d13aa253 100644 --- a/lending/src/codat_lending/suppliers.py +++ b/lending/src/codat_lending/suppliers.py @@ -1,1066 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.suppliers — re-export of the suppliers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class Suppliers(BaseSDK): - def download_attachment( - self, - *, - request: Union[ - operations.DownloadAccountingSupplierAttachmentRequest, - operations.DownloadAccountingSupplierAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download supplier attachment - - The *Download supplier attachment* endpoint downloads a specific attachment for a given `supplierId` and `attachmentId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.DownloadAccountingSupplierAttachmentRequest - ) - request = cast(operations.DownloadAccountingSupplierAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-supplier-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = utils.stream_to_text(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = utils.stream_to_text(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - async def download_attachment_async( - self, - *, - request: Union[ - operations.DownloadAccountingSupplierAttachmentRequest, - operations.DownloadAccountingSupplierAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> httpx.Response: - r"""Download supplier attachment - - The *Download supplier attachment* endpoint downloads a specific attachment for a given `supplierId` and `attachmentId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.DownloadAccountingSupplierAttachmentRequest - ) - request = cast(operations.DownloadAccountingSupplierAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments/{attachmentId}/download", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/octet-stream", - 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="download-accounting-supplier-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=True, - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/octet-stream"): - return http_res - if utils.match_response( - http_res, ["401", "402", "403", "404", "429"], "application/json" - ): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - if utils.match_response(http_res, ["500", "503"], "application/json"): - http_res_text = await utils.stream_to_text_async(http_res) - response_data = unmarshal_json_response( - errors.ErrorMessageData, http_res, http_res_text - ) - raise errors.ErrorMessage(response_data, http_res, http_res_text) - 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) - - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.SDKError("Unexpected response received", http_res, http_res_text) - - def get( - self, - *, - request: Union[ - operations.GetAccountingSupplierRequest, - operations.GetAccountingSupplierRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingSupplier: - r"""Get supplier - - The *Get supplier* endpoint returns a single supplier for a given supplierId. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingSupplierRequest) - request = cast(operations.GetAccountingSupplierRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/suppliers/{supplierId}", - 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-accounting-supplier", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingSupplier, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetAccountingSupplierRequest, - operations.GetAccountingSupplierRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingSupplier: - r"""Get supplier - - The *Get supplier* endpoint returns a single supplier for a given supplierId. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetAccountingSupplierRequest) - request = cast(operations.GetAccountingSupplierRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/suppliers/{supplierId}", - 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-accounting-supplier", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingSupplier, http_res) - if utils.match_response( - http_res, ["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) - - def get_attachment( - self, - *, - request: Union[ - operations.GetAccountingSupplierAttachmentRequest, - operations.GetAccountingSupplierAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get supplier attachment - - The *Get supplier attachment* endpoint returns a specific attachment for a given `supplierId` and `attachmentId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.GetAccountingSupplierAttachmentRequest - ) - request = cast(operations.GetAccountingSupplierAttachmentRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments/{attachmentId}", - 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-accounting-supplier-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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_attachment_async( - self, - *, - request: Union[ - operations.GetAccountingSupplierAttachmentRequest, - operations.GetAccountingSupplierAttachmentRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingAttachment: - r"""Get supplier attachment - - The *Get supplier attachment* endpoint returns a specific attachment for a given `supplierId` and `attachmentId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.GetAccountingSupplierAttachmentRequest - ) - request = cast(operations.GetAccountingSupplierAttachmentRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments/{attachmentId}", - 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-accounting-supplier-attachment", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingAttachment, 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.ListAccountingSuppliersRequest, - operations.ListAccountingSuppliersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingSuppliers: - r"""List suppliers - - The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingSuppliersRequest - ) - request = cast(operations.ListAccountingSuppliersRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/data/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-suppliers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingSuppliers, 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.ListAccountingSuppliersRequest, - operations.ListAccountingSuppliersRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingSuppliers: - r"""List suppliers - - The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) for a given company's connection. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListAccountingSuppliersRequest - ) - request = cast(operations.ListAccountingSuppliersRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/data/suppliers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-suppliers", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.AccountingSuppliers, 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) - - def list_attachments( - self, - *, - request: Union[ - operations.ListAccountingSupplierAttachmentsRequest, - operations.ListAccountingSupplierAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List supplier attachments - - The *List supplier attachments* endpoint returns a list of attachments available to download for given `supplierId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.ListAccountingSupplierAttachmentsRequest - ) - request = cast(operations.ListAccountingSupplierAttachmentsRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-supplier-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_attachments_async( - self, - *, - request: Union[ - operations.ListAccountingSupplierAttachmentsRequest, - operations.ListAccountingSupplierAttachmentsRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.Attachments: - r"""List supplier attachments - - The *List supplier attachments* endpoint returns a list of attachments available to download for given `supplierId`. - - [Suppliers](https://docs.codat.io/lending-api#/schemas/Supplier) are people or organizations that provide something, such as a product or service. - - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :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.ListAccountingSupplierAttachmentsRequest - ) - request = cast(operations.ListAccountingSupplierAttachmentsRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/suppliers/{supplierId}/attachments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - 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-accounting-supplier-attachments", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.Attachments, http_res) - if utils.match_response( - http_res, ["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_lending.api.suppliers import Suppliers diff --git a/lending/src/codat_lending/transaction_categories.py b/lending/src/codat_lending/transaction_categories.py index ed165dc53..c76f0fc67 100644 --- a/lending/src/codat_lending/transaction_categories.py +++ b/lending/src/codat_lending/transaction_categories.py @@ -1,439 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.transaction_categories — re-export of the transaction_categories method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class TransactionCategories(BaseSDK): - def get( - self, - *, - request: Union[ - operations.GetBankingTransactionCategoryRequest, - operations.GetBankingTransactionCategoryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactionCategory: - r"""Get transaction category - - The *Get transaction category* endpoint returns a single transaction category for a given transactionCategoryId. - - [Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetBankingTransactionCategoryRequest - ) - request = cast(operations.GetBankingTransactionCategoryRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactionCategories/{transactionCategoryId}", - 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-banking-transaction-category", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransactionCategory, http_res) - if utils.match_response( - http_res, ["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 get_async( - self, - *, - request: Union[ - operations.GetBankingTransactionCategoryRequest, - operations.GetBankingTransactionCategoryRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactionCategory: - r"""Get transaction category - - The *Get transaction category* endpoint returns a single transaction category for a given transactionCategoryId. - - [Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.GetBankingTransactionCategoryRequest - ) - request = cast(operations.GetBankingTransactionCategoryRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactionCategories/{transactionCategoryId}", - 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-banking-transaction-category", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response(shared.BankingTransactionCategory, http_res) - if utils.match_response( - http_res, ["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) - - def list( - self, - *, - request: Union[ - operations.ListBankingTransactionCategoriesRequest, - operations.ListBankingTransactionCategoriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactionCategories: - r"""List transaction categories - - The *List transaction categories* endpoint returns a list of [transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) for a given company's connection. - - [Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingTransactionCategoriesRequest - ) - request = cast(operations.ListBankingTransactionCategoriesRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactionCategories", - 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-banking-transaction-categories", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankingTransactionCategories, 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.ListBankingTransactionCategoriesRequest, - operations.ListBankingTransactionCategoriesRequestTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.BankingTransactionCategories: - r"""List transaction categories - - The *List transaction categories* endpoint returns a list of [transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) for a given company's connection. - - [Transaction categories](https://docs.codat.io/lending-api#/schemas/TransactionCategory) are associated with a transaction to provide greater contextual meaning to transaction activity. - - Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-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.ListBankingTransactionCategoriesRequest - ) - request = cast(operations.ListBankingTransactionCategoriesRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/data/banking-transactionCategories", - 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-banking-transaction-categories", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.BankingTransactionCategories, 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_lending.api.transaction_categories import TransactionCategories diff --git a/lending/src/codat_lending/transactions.py b/lending/src/codat_lending/transactions.py index c4b07e631..0cc35f203 100644 --- a/lending/src/codat_lending/transactions.py +++ b/lending/src/codat_lending/transactions.py @@ -1,40 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.transactions — re-export of the transactions method group.""" -from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration -from codat_lending.account_transactions import AccountTransactions -from codat_lending.codatlending_direct_costs import CodatLendingDirectCosts -from codat_lending.codatlending_transfers import CodatLendingTransfers -from codat_lending.journal_entries import JournalEntries -from codat_lending.journals import Journals -from typing import Optional - - -class Transactions(BaseSDK): - account_transactions: AccountTransactions - direct_costs: CodatLendingDirectCosts - transfers: CodatLendingTransfers - journal_entries: JournalEntries - journals: Journals - - def __init__( - self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None - ) -> None: - BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.account_transactions = AccountTransactions( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.direct_costs = CodatLendingDirectCosts( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.transfers = CodatLendingTransfers( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.journal_entries = JournalEntries( - self.sdk_configuration, parent_ref=self.parent_ref - ) - self.journals = Journals(self.sdk_configuration, parent_ref=self.parent_ref) +from codat_lending.api.transactions import Transactions diff --git a/lending/src/codat_lending/transfers.py b/lending/src/codat_lending/transfers.py index 175f512e6..e93d5e8b7 100644 --- a/lending/src/codat_lending/transfers.py +++ b/lending/src/codat_lending/transfers.py @@ -1,449 +1,3 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.transfers — re-export of the transfers method group.""" -from .basesdk import BaseSDK -from codat_lending import utils -from codat_lending._hooks import HookContext -from codat_lending.models import errors, operations, shared -from codat_lending.types import BaseModel, OptionalNullable, UNSET -from codat_lending.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Mapping, Optional, Union, cast - - -class Transfers(BaseSDK): - def create( - self, - *, - request: Union[ - operations.CreateTransferRequest, operations.CreateTransferRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateTransferResponse: - r"""Create transfer - - The *Create transfer* endpoint creates a new [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create transfer model](https://docs.codat.io/lending-api#/operations/get-create-transfers-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.CreateTransferRequest) - request = cast(operations.CreateTransferRequest, request) - - req = self._build_request( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/transfers", - 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.accounting_transfer if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingTransfer], - ), - 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-transfer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateTransferResponse, 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.CreateTransferRequest, operations.CreateTransferRequestTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> shared.AccountingCreateTransferResponse: - r"""Create transfer - - The *Create transfer* endpoint creates a new [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company's connection. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal account. - - **Integration-specific behavior** - - Required data may vary by integration. To see what data to post, first call [Get create transfer model](https://docs.codat.io/lending-api#/operations/get-create-transfers-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.CreateTransferRequest) - request = cast(operations.CreateTransferRequest, request) - - req = self._build_request_async( - method="POST", - path="/companies/{companyId}/connections/{connectionId}/push/transfers", - 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.accounting_transfer if request is not None else None, - True, - True, - "json", - OptionalNullable[shared.AccountingTransfer], - ), - 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-transfer", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - shared.AccountingCreateTransferResponse, 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.GetCreateTransfersModelRequest, - operations.GetCreateTransfersModelRequestTypedDict, - ], - 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 transfer model - - The *Get create transfer model* endpoint returns the expected data for the request payload when creating a [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company and integration. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal 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.GetCreateTransfersModelRequest - ) - request = cast(operations.GetCreateTransfersModelRequest, request) - - req = self._build_request( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/transfers", - 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-transfers-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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.GetCreateTransfersModelRequest, - operations.GetCreateTransfersModelRequestTypedDict, - ], - 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 transfer model - - The *Get create transfer model* endpoint returns the expected data for the request payload when creating a [transfer](https://docs.codat.io/lending-api#/schemas/Transfer) for a given company and integration. - - [Transfers](https://docs.codat.io/lending-api#/schemas/Transfer) record the movement of money between two bank accounts, or between a bank account and a nominal 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.GetCreateTransfersModelRequest - ) - request = cast(operations.GetCreateTransfersModelRequest, request) - - req = self._build_request_async( - method="GET", - path="/companies/{companyId}/connections/{connectionId}/options/transfers", - 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-transfers-model", - oauth2_scopes=None, - security_source=self.sdk_configuration.security, - ), - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - 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) +from codat_lending.api.transfers import Transfers diff --git a/lending/src/codat_lending/types/__init__.py b/lending/src/codat_lending/types/__init__.py index fc76fe0c5..a5e7b8709 100644 --- a/lending/src/codat_lending/types/__init__.py +++ b/lending/src/codat_lending/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/lending/src/codat_lending/types/basemodel.py b/lending/src/codat_lending/types/basemodel.py deleted file mode 100644 index a9a640a1a..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/__init__.py b/lending/src/codat_lending/utils/__init__.py index 0498cb8da..e4bbf5812 100644 --- a/lending/src/codat_lending/utils/__init__.py +++ b/lending/src/codat_lending/utils/__init__.py @@ -1,175 +1,5 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" +"""codat_lending.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/lending/src/codat_lending/utils/annotations.py b/lending/src/codat_lending/utils/annotations.py deleted file mode 100644 index 12e0aa4f1..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/datetimes.py b/lending/src/codat_lending/utils/datetimes.py deleted file mode 100644 index a6c52cd61..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/dynamic_imports.py b/lending/src/codat_lending/utils/dynamic_imports.py deleted file mode 100644 index 673edf82a..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/enums.py b/lending/src/codat_lending/utils/enums.py deleted file mode 100644 index 3324e1bc2..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/eventstreaming.py b/lending/src/codat_lending/utils/eventstreaming.py deleted file mode 100644 index 3bdcd6d3d..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/forms.py b/lending/src/codat_lending/utils/forms.py deleted file mode 100644 index f961e76be..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/headers.py b/lending/src/codat_lending/utils/headers.py deleted file mode 100644 index 37864cbbb..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/logger.py b/lending/src/codat_lending/utils/logger.py deleted file mode 100644 index b661aff65..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/metadata.py b/lending/src/codat_lending/utils/metadata.py deleted file mode 100644 index 5abddd588..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/queryparams.py b/lending/src/codat_lending/utils/queryparams.py deleted file mode 100644 index c04e0db82..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/requestbodies.py b/lending/src/codat_lending/utils/requestbodies.py deleted file mode 100644 index 1de32b6d2..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/retries.py b/lending/src/codat_lending/utils/retries.py index af07d4e94..28b22e85e 100644 --- a/lending/src/codat_lending/utils/retries.py +++ b/lending/src/codat_lending/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/lending/src/codat_lending/utils/security.py b/lending/src/codat_lending/utils/security.py deleted file mode 100644 index 42d8d78e9..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/serializers.py b/lending/src/codat_lending/utils/serializers.py index d2149f8b9..84df82c03 100644 --- a/lending/src/codat_lending/utils/serializers.py +++ b/lending/src/codat_lending/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_lending.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/lending/src/codat_lending/utils/unmarshal_json_response.py b/lending/src/codat_lending/utils/unmarshal_json_response.py deleted file mode 100644 index ce1dceaf6..000000000 --- a/lending/src/codat_lending/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_lending.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/lending/src/codat_lending/utils/url.py b/lending/src/codat_lending/utils/url.py deleted file mode 100644 index c78ccbae4..000000000 --- a/lending/src/codat_lending/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/lending/src/codat_lending/utils/values.py b/lending/src/codat_lending/utils/values.py deleted file mode 100644 index dae01a443..000000000 --- a/lending/src/codat_lending/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)