@codat/lending 0.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/README.md +312 -1
  2. package/dist/internal/utils/requestbody.d.ts +1 -1
  3. package/dist/internal/utils/retries.d.ts +2 -2
  4. package/dist/internal/utils/security.d.ts +5 -2
  5. package/dist/internal/utils/security.js +28 -28
  6. package/dist/sdk/accountingbankdata.d.ts +2 -26
  7. package/dist/sdk/accountingbankdata.js +24 -146
  8. package/dist/sdk/accountingbankdataaccounts.d.ts +34 -0
  9. package/dist/sdk/accountingbankdataaccounts.js +262 -0
  10. package/dist/sdk/accountspayable.d.ts +8 -170
  11. package/dist/sdk/accountspayable.js +53 -983
  12. package/dist/sdk/accountspayablebillcreditnotes.d.ts +34 -0
  13. package/dist/sdk/accountspayablebillcreditnotes.js +262 -0
  14. package/dist/sdk/accountspayablebillpayments.d.ts +34 -0
  15. package/dist/sdk/accountspayablebillpayments.js +262 -0
  16. package/dist/sdk/accountspayablebills.d.ts +46 -0
  17. package/dist/sdk/accountspayablebills.js +348 -0
  18. package/dist/sdk/accountspayablesuppliers.d.ts +74 -0
  19. package/dist/sdk/accountspayablesuppliers.js +530 -0
  20. package/dist/sdk/accountsreceivable.d.ts +12 -284
  21. package/dist/sdk/accountsreceivable.js +13 -1677
  22. package/dist/sdk/accountsreceivablecreditnotes.d.ts +34 -0
  23. package/dist/sdk/accountsreceivablecreditnotes.js +262 -0
  24. package/dist/sdk/accountsreceivablecustomers.d.ts +74 -0
  25. package/dist/sdk/accountsreceivablecustomers.js +530 -0
  26. package/dist/sdk/accountsreceivabledirectincomes.d.ts +74 -0
  27. package/dist/sdk/{financials.js → accountsreceivabledirectincomes.js} +183 -211
  28. package/dist/sdk/accountsreceivableinvoices.d.ts +93 -0
  29. package/dist/sdk/{cashflow.js → accountsreceivableinvoices.js} +250 -189
  30. package/dist/sdk/accountsreceivablepayments.d.ts +34 -0
  31. package/dist/sdk/accountsreceivablepayments.js +262 -0
  32. package/dist/sdk/accountsreceivablereports.d.ts +36 -0
  33. package/dist/sdk/accountsreceivablereports.js +399 -0
  34. package/dist/sdk/banking.d.ts +15 -0
  35. package/dist/sdk/banking.js +23 -0
  36. package/dist/sdk/bankingaccountbalances.d.ts +20 -0
  37. package/dist/sdk/bankingaccountbalances.js +174 -0
  38. package/dist/sdk/bankingaccounts.d.ts +34 -0
  39. package/dist/sdk/bankingaccounts.js +254 -0
  40. package/dist/sdk/bankingcategorizedstatement.d.ts +19 -0
  41. package/dist/sdk/bankingcategorizedstatement.js +173 -0
  42. package/dist/sdk/bankingtransactioncategories.d.ts +34 -0
  43. package/dist/sdk/bankingtransactioncategories.js +254 -0
  44. package/dist/sdk/bankingtransactions.d.ts +34 -0
  45. package/dist/sdk/bankingtransactions.js +254 -0
  46. package/dist/sdk/companies.js +110 -25
  47. package/dist/sdk/companyinfo.d.ts +4 -4
  48. package/dist/sdk/companyinfo.js +52 -18
  49. package/dist/sdk/connections.js +110 -25
  50. package/dist/sdk/dataintegrity.js +66 -15
  51. package/dist/sdk/excelreports.d.ts +10 -2
  52. package/dist/sdk/excelreports.js +76 -17
  53. package/dist/sdk/fileupload.js +66 -15
  54. package/dist/sdk/financialstatements.d.ts +13 -0
  55. package/dist/sdk/financialstatements.js +21 -0
  56. package/dist/sdk/financialstatementsaccounts.d.ts +33 -0
  57. package/dist/sdk/financialstatementsaccounts.js +261 -0
  58. package/dist/sdk/financialstatementsbalancesheet.d.ts +24 -0
  59. package/dist/sdk/financialstatementsbalancesheet.js +253 -0
  60. package/dist/sdk/financialstatementscashflow.d.ts +15 -0
  61. package/dist/sdk/financialstatementscashflow.js +169 -0
  62. package/dist/sdk/financialstatementsprofitandloss.d.ts +24 -0
  63. package/dist/sdk/financialstatementsprofitandloss.js +253 -0
  64. package/dist/sdk/liabilities.d.ts +4 -4
  65. package/dist/sdk/liabilities.js +48 -14
  66. package/dist/sdk/managedata.d.ts +5 -38
  67. package/dist/sdk/managedata.js +27 -267
  68. package/dist/sdk/managedatapulloperations.d.ts +22 -0
  69. package/dist/sdk/managedatapulloperations.js +250 -0
  70. package/dist/sdk/managedatarefresh.d.ts +28 -0
  71. package/dist/sdk/managedatarefresh.js +250 -0
  72. package/dist/sdk/models/operations/{getaccountingcompanyinfo.d.ts → getaccountingprofile.d.ts} +2 -2
  73. package/dist/sdk/models/operations/{getaccountingcompanyinfo.js → getaccountingprofile.js} +17 -17
  74. package/dist/sdk/models/operations/{getenhancedprofitandlossaccounts.d.ts → getcategorizedbalancesheetstatement.d.ts} +2 -2
  75. package/dist/sdk/models/operations/{getenhancedbalancesheetaccounts.js → getcategorizedbalancesheetstatement.js} +19 -19
  76. package/dist/sdk/models/operations/{getenhancedcashflowtransactions.d.ts → getcategorizedbankstatement.d.ts} +2 -2
  77. package/dist/sdk/models/operations/{getenhancedcashflowtransactions.js → getcategorizedbankstatement.js} +20 -20
  78. package/dist/sdk/models/operations/{getenhancedbalancesheetaccounts.d.ts → getcategorizedprofitandlossstatement.d.ts} +2 -2
  79. package/dist/sdk/models/operations/{getenhancedprofitandlossaccounts.js → getcategorizedprofitandlossstatement.js} +19 -19
  80. package/dist/sdk/models/operations/{getcommercecompanyinfo.d.ts → getcommerceprofile.d.ts} +2 -2
  81. package/dist/sdk/models/operations/{getcommercecompanyinfo.js → getcommerceprofile.js} +18 -18
  82. package/dist/sdk/models/operations/{getcommercerefundsmetrics.d.ts → getcommercerefundsreport.d.ts} +2 -2
  83. package/dist/sdk/models/operations/{getcommercerefundsmetrics.js → getcommercerefundsreport.js} +23 -23
  84. package/dist/sdk/models/operations/index.d.ts +8 -8
  85. package/dist/sdk/models/operations/index.js +8 -8
  86. package/dist/sdk/models/operations/{isageddebtorreportavailable.d.ts → isageddebtorsreportavailable.d.ts} +3 -3
  87. package/dist/sdk/models/operations/{isageddebtorreportavailable.js → isageddebtorsreportavailable.js} +16 -16
  88. package/dist/sdk/models/operations/{getenhancedinvoicesreport.d.ts → listreconciledinvoices.d.ts} +2 -2
  89. package/dist/sdk/models/operations/{getenhancedinvoicesreport.js → listreconciledinvoices.js} +20 -20
  90. package/dist/sdk/models/operations/unlinkconnection.d.ts +6 -3
  91. package/dist/sdk/models/operations/unlinkconnection.js +8 -8
  92. package/dist/sdk/models/shared/accountbalance.d.ts +1 -1
  93. package/dist/sdk/models/shared/accountbalance.js +1 -1
  94. package/dist/sdk/models/shared/accountingaccounts.d.ts +0 -3
  95. package/dist/sdk/models/shared/accountingaccounts.js +0 -3
  96. package/dist/sdk/models/shared/accountingaccounttransactions.d.ts +0 -3
  97. package/dist/sdk/models/shared/accountingaccounttransactions.js +0 -3
  98. package/dist/sdk/models/shared/accountingbankaccounts.d.ts +0 -3
  99. package/dist/sdk/models/shared/accountingbankaccounts.js +0 -3
  100. package/dist/sdk/models/shared/accountingbanktransactions.d.ts +0 -3
  101. package/dist/sdk/models/shared/accountingbanktransactions.js +0 -3
  102. package/dist/sdk/models/shared/accountingbill.d.ts +1 -1
  103. package/dist/sdk/models/shared/accountingbillcreditnote.d.ts +1 -1
  104. package/dist/sdk/models/shared/accountingbillcreditnotes.d.ts +0 -3
  105. package/dist/sdk/models/shared/accountingbillcreditnotes.js +0 -3
  106. package/dist/sdk/models/shared/accountingbillpayment.d.ts +1 -1
  107. package/dist/sdk/models/shared/accountingbillpayments.d.ts +0 -3
  108. package/dist/sdk/models/shared/accountingbillpayments.js +0 -3
  109. package/dist/sdk/models/shared/accountingbills.d.ts +0 -3
  110. package/dist/sdk/models/shared/accountingbills.js +0 -3
  111. package/dist/sdk/models/shared/accountingcompanyinfo.d.ts +32 -2
  112. package/dist/sdk/models/shared/accountingcompanyinfo.js +47 -4
  113. package/dist/sdk/models/shared/accountingcreditnote.d.ts +1 -1
  114. package/dist/sdk/models/shared/accountingcreditnotes.d.ts +0 -3
  115. package/dist/sdk/models/shared/accountingcreditnotes.js +0 -3
  116. package/dist/sdk/models/shared/accountingcustomer.d.ts +3 -3
  117. package/dist/sdk/models/shared/accountingcustomer.js +3 -3
  118. package/dist/sdk/models/shared/accountingcustomers.d.ts +0 -3
  119. package/dist/sdk/models/shared/accountingcustomers.js +0 -3
  120. package/dist/sdk/models/shared/accountingdirectcost.d.ts +1 -1
  121. package/dist/sdk/models/shared/accountingdirectcosts.d.ts +0 -3
  122. package/dist/sdk/models/shared/accountingdirectcosts.js +0 -3
  123. package/dist/sdk/models/shared/accountingdirectincome.d.ts +1 -1
  124. package/dist/sdk/models/shared/accountingdirectincomes.d.ts +0 -3
  125. package/dist/sdk/models/shared/accountingdirectincomes.js +0 -3
  126. package/dist/sdk/models/shared/accountinginvoice.d.ts +1 -1
  127. package/dist/sdk/models/shared/accountinginvoices.d.ts +0 -3
  128. package/dist/sdk/models/shared/accountinginvoices.js +0 -3
  129. package/dist/sdk/models/shared/accountingjournalentries.d.ts +0 -3
  130. package/dist/sdk/models/shared/accountingjournalentries.js +0 -3
  131. package/dist/sdk/models/shared/accountingjournalentry.d.ts +1 -1
  132. package/dist/sdk/models/shared/accountingjournals.d.ts +0 -3
  133. package/dist/sdk/models/shared/accountingjournals.js +0 -3
  134. package/dist/sdk/models/shared/accountingpayment.d.ts +1 -1
  135. package/dist/sdk/models/shared/accountingpayments.d.ts +0 -3
  136. package/dist/sdk/models/shared/accountingpayments.js +0 -3
  137. package/dist/sdk/models/shared/accountingsupplier.d.ts +3 -3
  138. package/dist/sdk/models/shared/accountingsupplier.js +3 -3
  139. package/dist/sdk/models/shared/accountingsuppliers.d.ts +0 -3
  140. package/dist/sdk/models/shared/accountingsuppliers.js +0 -3
  141. package/dist/sdk/models/shared/accountingtransfer.d.ts +1 -1
  142. package/dist/sdk/models/shared/accountingtransfers.d.ts +0 -3
  143. package/dist/sdk/models/shared/accountingtransfers.js +0 -3
  144. package/dist/sdk/models/shared/{accountingaddress.d.ts → addressesitems.d.ts} +1 -1
  145. package/dist/sdk/models/shared/{accountingaddress.js → addressesitems.js} +13 -13
  146. package/dist/sdk/models/shared/attachments.d.ts +0 -3
  147. package/dist/sdk/models/shared/attachments.js +0 -3
  148. package/dist/sdk/models/shared/bankingaccountbalances.d.ts +0 -3
  149. package/dist/sdk/models/shared/bankingaccountbalances.js +0 -3
  150. package/dist/sdk/models/shared/bankingaccounts.d.ts +0 -3
  151. package/dist/sdk/models/shared/bankingaccounts.js +0 -3
  152. package/dist/sdk/models/shared/bankingtransactioncategories.d.ts +0 -3
  153. package/dist/sdk/models/shared/bankingtransactioncategories.js +0 -3
  154. package/dist/sdk/models/shared/bankingtransactions.d.ts +0 -3
  155. package/dist/sdk/models/shared/bankingtransactions.js +0 -3
  156. package/dist/sdk/models/shared/commercecustomers.d.ts +0 -3
  157. package/dist/sdk/models/shared/commercecustomers.js +0 -3
  158. package/dist/sdk/models/shared/commercedispute.d.ts +1 -1
  159. package/dist/sdk/models/shared/commercedispute.js +1 -1
  160. package/dist/sdk/models/shared/commercedisputes.d.ts +0 -3
  161. package/dist/sdk/models/shared/commercedisputes.js +0 -3
  162. package/dist/sdk/models/shared/commercelocations.d.ts +0 -3
  163. package/dist/sdk/models/shared/commercelocations.js +0 -3
  164. package/dist/sdk/models/shared/commerceorder.d.ts +2 -2
  165. package/dist/sdk/models/shared/commerceorder.js +1 -1
  166. package/dist/sdk/models/shared/commerceorders.d.ts +0 -3
  167. package/dist/sdk/models/shared/commerceorders.js +0 -3
  168. package/dist/sdk/models/shared/commercepaymentmethods.d.ts +0 -3
  169. package/dist/sdk/models/shared/commercepaymentmethods.js +0 -3
  170. package/dist/sdk/models/shared/commercepayments.d.ts +0 -3
  171. package/dist/sdk/models/shared/commercepayments.js +0 -3
  172. package/dist/sdk/models/shared/commerceproductcategories.d.ts +0 -3
  173. package/dist/sdk/models/shared/commerceproductcategories.js +0 -3
  174. package/dist/sdk/models/shared/commerceproducts.d.ts +0 -3
  175. package/dist/sdk/models/shared/commerceproducts.js +0 -3
  176. package/dist/sdk/models/shared/commercetransactions.d.ts +0 -3
  177. package/dist/sdk/models/shared/commercetransactions.js +0 -3
  178. package/dist/sdk/models/shared/companies.d.ts +0 -3
  179. package/dist/sdk/models/shared/companies.js +0 -3
  180. package/dist/sdk/models/shared/connections.d.ts +0 -3
  181. package/dist/sdk/models/shared/connections.js +0 -3
  182. package/dist/sdk/models/shared/contact.d.ts +2 -2
  183. package/dist/sdk/models/shared/contact.js +3 -3
  184. package/dist/sdk/models/shared/dataintegritydatatype.d.ts +0 -3
  185. package/dist/sdk/models/shared/dataintegritydatatype.js +0 -3
  186. package/dist/sdk/models/shared/dataintegritydetails.d.ts +0 -3
  187. package/dist/sdk/models/shared/dataintegritydetails.js +0 -3
  188. package/dist/sdk/models/shared/dataintegritystatuses.d.ts +0 -3
  189. package/dist/sdk/models/shared/dataintegritystatuses.js +0 -3
  190. package/dist/sdk/models/shared/dataintegritysummaries.d.ts +0 -3
  191. package/dist/sdk/models/shared/dataintegritysummaries.js +0 -3
  192. package/dist/sdk/models/shared/enhancedfinancialreport.d.ts +0 -3
  193. package/dist/sdk/models/shared/enhancedfinancialreport.js +0 -3
  194. package/dist/sdk/models/shared/errormessage.d.ts +0 -3
  195. package/dist/sdk/models/shared/errormessage.js +0 -3
  196. package/dist/sdk/models/shared/excelstatus.d.ts +0 -3
  197. package/dist/sdk/models/shared/excelstatus.js +0 -3
  198. package/dist/sdk/models/shared/index.d.ts +1 -1
  199. package/dist/sdk/models/shared/index.js +1 -1
  200. package/dist/sdk/models/shared/loansummary.d.ts +0 -3
  201. package/dist/sdk/models/shared/loansummary.js +0 -3
  202. package/dist/sdk/models/shared/loantransactions.d.ts +0 -3
  203. package/dist/sdk/models/shared/loantransactions.js +0 -3
  204. package/dist/sdk/models/shared/periodunit.d.ts +0 -3
  205. package/dist/sdk/models/shared/periodunit.js +0 -3
  206. package/dist/sdk/models/shared/pulloperations.d.ts +0 -3
  207. package/dist/sdk/models/shared/pulloperations.js +0 -3
  208. package/dist/sdk/models/shared/supplementaldata.d.ts +1 -1
  209. package/dist/sdk/models/shared/supplementaldata.js +1 -1
  210. package/dist/sdk/sales.d.ts +22 -372
  211. package/dist/sdk/sales.js +22 -1767
  212. package/dist/sdk/salescustomers.d.ts +34 -0
  213. package/dist/sdk/salescustomers.js +262 -0
  214. package/dist/sdk/salesdisputes.d.ts +34 -0
  215. package/dist/sdk/salesdisputes.js +262 -0
  216. package/dist/sdk/saleslocations.d.ts +34 -0
  217. package/dist/sdk/saleslocations.js +261 -0
  218. package/dist/sdk/salesmetrics.d.ts +102 -0
  219. package/dist/sdk/salesmetrics.js +406 -0
  220. package/dist/sdk/salesorders.d.ts +34 -0
  221. package/dist/sdk/salesorders.js +262 -0
  222. package/dist/sdk/salespaymentmethods.d.ts +34 -0
  223. package/dist/sdk/salespaymentmethods.js +262 -0
  224. package/dist/sdk/salespayments.d.ts +34 -0
  225. package/dist/sdk/salespayments.js +262 -0
  226. package/dist/sdk/salesproductcategories.d.ts +34 -0
  227. package/dist/sdk/salesproductcategories.js +262 -0
  228. package/dist/sdk/salesproducts.d.ts +34 -0
  229. package/dist/sdk/salesproducts.js +262 -0
  230. package/dist/sdk/salesreports.d.ts +69 -0
  231. package/dist/sdk/salesreports.js +298 -0
  232. package/dist/sdk/salestransactions.d.ts +34 -0
  233. package/dist/sdk/salestransactions.js +262 -0
  234. package/dist/sdk/sdk.d.ts +38 -30
  235. package/dist/sdk/sdk.js +33 -45
  236. package/dist/sdk/transactions.d.ts +10 -176
  237. package/dist/sdk/transactions.js +11 -1000
  238. package/dist/sdk/transactionsaccounttransactions.d.ts +34 -0
  239. package/dist/sdk/transactionsaccounttransactions.js +262 -0
  240. package/dist/sdk/transactionsdirectcosts.d.ts +74 -0
  241. package/dist/sdk/transactionsdirectcosts.js +530 -0
  242. package/dist/sdk/transactionsjournalentries.d.ts +34 -0
  243. package/dist/sdk/transactionsjournalentries.js +262 -0
  244. package/dist/sdk/transactionsjournals.d.ts +34 -0
  245. package/dist/sdk/transactionsjournals.js +262 -0
  246. package/dist/sdk/transactionstransfers.d.ts +34 -0
  247. package/dist/sdk/transactionstransfers.js +262 -0
  248. package/docs/models/operations/{getaccountingcompanyinforequest.md → getaccountingprofilerequest.md} +1 -1
  249. package/docs/models/operations/{getaccountingcompanyinforesponse.md → getaccountingprofileresponse.md} +1 -1
  250. package/docs/models/operations/{getenhancedbalancesheetaccountsrequest.md → getcategorizedbalancesheetstatementrequest.md} +1 -1
  251. package/docs/models/operations/{getenhancedprofitandlossaccountsresponse.md → getcategorizedbalancesheetstatementresponse.md} +1 -1
  252. package/docs/models/operations/{getenhancedcashflowtransactionsrequest.md → getcategorizedbankstatementrequest.md} +1 -1
  253. package/docs/models/operations/{getenhancedcashflowtransactionsresponse.md → getcategorizedbankstatementresponse.md} +1 -1
  254. package/docs/models/operations/{getenhancedprofitandlossaccountsrequest.md → getcategorizedprofitandlossstatementrequest.md} +1 -1
  255. package/docs/models/operations/{getenhancedbalancesheetaccountsresponse.md → getcategorizedprofitandlossstatementresponse.md} +1 -1
  256. package/docs/models/operations/{getcommercecompanyinforequest.md → getcommerceprofilerequest.md} +1 -1
  257. package/docs/models/operations/{getcommercecompanyinforesponse.md → getcommerceprofileresponse.md} +1 -1
  258. package/docs/models/operations/{getcommercerefundsmetricsrequest.md → getcommercerefundsreportrequest.md} +1 -1
  259. package/docs/models/operations/{getcommercerefundsmetricsresponse.md → getcommercerefundsreportresponse.md} +1 -1
  260. package/docs/models/operations/{isageddebtorreportavailablerequest.md → isageddebtorsreportavailablerequest.md} +1 -1
  261. package/docs/models/operations/{isageddebtorreportavailableresponse.md → isageddebtorsreportavailableresponse.md} +2 -2
  262. package/docs/models/operations/{getenhancedinvoicesreportrequest.md → listreconciledinvoicesrequest.md} +1 -1
  263. package/docs/models/operations/{getenhancedinvoicesreportresponse.md → listreconciledinvoicesresponse.md} +1 -1
  264. package/docs/models/operations/unlinkconnectionrequest.md +5 -5
  265. package/docs/models/operations/unlinkconnectionupdateconnection.md +8 -0
  266. package/docs/models/shared/accountbalance.md +1 -1
  267. package/docs/models/shared/accountingaccounts.md +0 -2
  268. package/docs/models/shared/accountingaccounttransactions.md +0 -2
  269. package/docs/models/shared/accountingbankaccounts.md +0 -2
  270. package/docs/models/shared/accountingbanktransactions.md +0 -2
  271. package/docs/models/shared/accountingbill.md +1 -1
  272. package/docs/models/shared/accountingbillcreditnote.md +1 -1
  273. package/docs/models/shared/accountingbillcreditnotes.md +0 -2
  274. package/docs/models/shared/accountingbillpayment.md +1 -1
  275. package/docs/models/shared/accountingbillpayments.md +0 -2
  276. package/docs/models/shared/accountingbills.md +0 -2
  277. package/docs/models/shared/accountingcompanyinfo.md +1 -1
  278. package/docs/models/shared/accountingcompanyinfoaccountingaddress.md +14 -0
  279. package/docs/models/shared/accountingcreditnote.md +1 -1
  280. package/docs/models/shared/accountingcreditnotes.md +0 -2
  281. package/docs/models/shared/accountingcustomer.md +2 -2
  282. package/docs/models/shared/accountingcustomers.md +0 -2
  283. package/docs/models/shared/accountingdirectcost.md +1 -1
  284. package/docs/models/shared/accountingdirectcosts.md +0 -2
  285. package/docs/models/shared/accountingdirectincome.md +1 -1
  286. package/docs/models/shared/accountingdirectincomes.md +0 -2
  287. package/docs/models/shared/accountinginvoice.md +1 -1
  288. package/docs/models/shared/accountinginvoices.md +0 -2
  289. package/docs/models/shared/accountingjournalentries.md +0 -2
  290. package/docs/models/shared/accountingjournalentry.md +1 -1
  291. package/docs/models/shared/accountingjournals.md +0 -2
  292. package/docs/models/shared/accountingpayment.md +1 -1
  293. package/docs/models/shared/accountingpayments.md +0 -2
  294. package/docs/models/shared/accountingsupplier.md +16 -16
  295. package/docs/models/shared/accountingsuppliers.md +0 -2
  296. package/docs/models/shared/accountingtransfer.md +1 -1
  297. package/docs/models/shared/accountingtransfers.md +0 -2
  298. package/docs/models/shared/{accountingaddress.md → addressesitems.md} +1 -1
  299. package/docs/models/shared/attachments.md +0 -2
  300. package/docs/models/shared/bankingaccountbalances.md +0 -2
  301. package/docs/models/shared/bankingaccounts.md +0 -2
  302. package/docs/models/shared/bankingtransactioncategories.md +0 -2
  303. package/docs/models/shared/bankingtransactions.md +0 -2
  304. package/docs/models/shared/commercecustomers.md +0 -2
  305. package/docs/models/shared/commercedispute.md +1 -1
  306. package/docs/models/shared/commercedisputes.md +0 -2
  307. package/docs/models/shared/commercelocations.md +0 -2
  308. package/docs/models/shared/commerceorder.md +1 -1
  309. package/docs/models/shared/commerceorders.md +0 -2
  310. package/docs/models/shared/commerceordersupplementaldata.md +1 -1
  311. package/docs/models/shared/commercepaymentmethods.md +0 -2
  312. package/docs/models/shared/commercepayments.md +0 -2
  313. package/docs/models/shared/commerceproductcategories.md +0 -2
  314. package/docs/models/shared/commerceproducts.md +0 -2
  315. package/docs/models/shared/commercetransactions.md +0 -2
  316. package/docs/models/shared/companies.md +0 -2
  317. package/docs/models/shared/connections.md +0 -2
  318. package/docs/models/shared/contact.md +1 -1
  319. package/docs/models/shared/dataintegritydatatype.md +0 -2
  320. package/docs/models/shared/dataintegritydetails.md +0 -2
  321. package/docs/models/shared/dataintegritystatuses.md +0 -2
  322. package/docs/models/shared/dataintegritysummaries.md +0 -2
  323. package/docs/models/shared/enhancedfinancialreport.md +0 -2
  324. package/docs/models/shared/errormessage.md +0 -2
  325. package/docs/models/shared/excelstatus.md +0 -2
  326. package/docs/models/shared/loansummary.md +0 -2
  327. package/docs/models/shared/loantransactions.md +0 -2
  328. package/docs/models/shared/periodunit.md +0 -2
  329. package/docs/models/shared/pulloperations.md +0 -2
  330. package/docs/models/shared/supplementaldata.md +1 -1
  331. package/docs/sdks/accountingbankdata/README.md +2 -101
  332. package/docs/sdks/accountingbankdataaccounts/README.md +103 -0
  333. package/docs/sdks/accountspayable/README.md +2 -664
  334. package/docs/sdks/accountspayablebillcreditnotes/README.md +101 -0
  335. package/docs/sdks/accountspayablebillpayments/README.md +101 -0
  336. package/docs/sdks/accountspayablebills/README.md +148 -0
  337. package/docs/sdks/accountspayablesuppliers/README.md +244 -0
  338. package/docs/sdks/accountsreceivable/README.md +0 -1089
  339. package/docs/sdks/accountsreceivablecreditnotes/README.md +101 -0
  340. package/docs/sdks/accountsreceivablecustomers/README.md +244 -0
  341. package/docs/sdks/accountsreceivabledirectincomes/README.md +247 -0
  342. package/docs/sdks/{financials → accountsreceivableinvoices}/README.md +123 -111
  343. package/docs/sdks/accountsreceivablepayments/README.md +101 -0
  344. package/docs/sdks/accountsreceivablereports/README.md +172 -0
  345. package/docs/sdks/banking/README.md +4 -0
  346. package/docs/sdks/bankingaccountbalances/README.md +54 -0
  347. package/docs/sdks/bankingaccounts/README.md +103 -0
  348. package/docs/sdks/bankingcategorizedstatement/README.md +51 -0
  349. package/docs/sdks/bankingtransactioncategories/README.md +103 -0
  350. package/docs/sdks/bankingtransactions/README.md +103 -0
  351. package/docs/sdks/codatlending/README.md +24 -4
  352. package/docs/sdks/companies/README.md +1 -1
  353. package/docs/sdks/companyinfo/README.md +22 -22
  354. package/docs/sdks/connections/README.md +4 -3
  355. package/docs/sdks/dataintegrity/README.md +5 -5
  356. package/docs/sdks/excelreports/README.md +12 -4
  357. package/docs/sdks/fileupload/README.md +2 -2
  358. package/docs/sdks/financialstatements/README.md +4 -0
  359. package/docs/sdks/financialstatementsaccounts/README.md +100 -0
  360. package/docs/sdks/financialstatementsbalancesheet/README.md +91 -0
  361. package/docs/sdks/financialstatementscashflow/README.md +47 -0
  362. package/docs/sdks/financialstatementsprofitandloss/README.md +91 -0
  363. package/docs/sdks/liabilities/README.md +4 -4
  364. package/docs/sdks/managedata/README.md +3 -181
  365. package/docs/sdks/managedatapulloperations/README.md +89 -0
  366. package/docs/sdks/managedatarefresh/README.md +93 -0
  367. package/docs/sdks/sales/README.md +0 -1223
  368. package/docs/sdks/salescustomers/README.md +103 -0
  369. package/docs/sdks/salesdisputes/README.md +103 -0
  370. package/docs/sdks/saleslocations/README.md +99 -0
  371. package/docs/sdks/salesmetrics/README.md +218 -0
  372. package/docs/sdks/salesorders/README.md +103 -0
  373. package/docs/sdks/salespaymentmethods/README.md +103 -0
  374. package/docs/sdks/salespayments/README.md +103 -0
  375. package/docs/sdks/salesproductcategories/README.md +103 -0
  376. package/docs/sdks/salesproducts/README.md +103 -0
  377. package/docs/sdks/salesreports/README.md +145 -0
  378. package/docs/sdks/salestransactions/README.md +103 -0
  379. package/docs/sdks/transactions/README.md +0 -638
  380. package/docs/sdks/transactionsaccounttransactions/README.md +103 -0
  381. package/docs/sdks/transactionsdirectcosts/README.md +246 -0
  382. package/docs/sdks/transactionsjournalentries/README.md +101 -0
  383. package/docs/sdks/transactionsjournals/README.md +101 -0
  384. package/docs/sdks/transactionstransfers/README.md +103 -0
  385. package/package.json +1 -1
  386. package/dist/sdk/cashflow.d.ts +0 -112
  387. package/dist/sdk/financials.d.ts +0 -75
  388. package/docs/models/operations/unlinkconnectionrequestbody.md +0 -8
  389. package/docs/sdks/cashflow/README.md +0 -402
@@ -2,1688 +2,24 @@
2
2
  /*
3
3
  * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
4
  */
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- var desc = Object.getOwnPropertyDescriptor(m, k);
19
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
- desc = { enumerable: true, get: function() { return m[k]; } };
21
- }
22
- Object.defineProperty(o, k2, desc);
23
- }) : (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- o[k2] = m[k];
26
- }));
27
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
- Object.defineProperty(o, "default", { enumerable: true, value: v });
29
- }) : function(o, v) {
30
- o["default"] = v;
31
- });
32
- var __importStar = (this && this.__importStar) || function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
- return new (P || (P = Promise))(function (resolve, reject) {
42
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
- step((generator = generator.apply(thisArg, _arguments || [])).next());
46
- });
47
- };
48
- var __generator = (this && this.__generator) || function (thisArg, body) {
49
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
50
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
- function verb(n) { return function (v) { return step([n, v]); }; }
52
- function step(op) {
53
- if (f) throw new TypeError("Generator is already executing.");
54
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
55
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
56
- if (y = 0, t) op = [op[0] & 2, t.value];
57
- switch (op[0]) {
58
- case 0: case 1: t = op; break;
59
- case 4: _.label++; return { value: op[1], done: false };
60
- case 5: _.label++; y = op[1]; op = [0]; continue;
61
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
62
- default:
63
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
64
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
65
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
66
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67
- if (t[2]) _.ops.pop();
68
- _.trys.pop(); continue;
69
- }
70
- op = body.call(thisArg, _);
71
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
72
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
73
- }
74
- };
75
5
  Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.AccountsReceivable = exports.DownloadInvoiceAttachmentAcceptEnum = exports.DownloadDirectIncomeAttachmentAcceptEnum = exports.DownloadCustomerAttachmentAcceptEnum = void 0;
77
- var utils = __importStar(require("../internal/utils"));
78
- var errors = __importStar(require("./models/errors"));
79
- var operations = __importStar(require("./models/operations"));
80
- var shared = __importStar(require("./models/shared"));
81
- /**
82
- * Data from a linked accounting platform representing money owed to the business for sold goods or services.
83
- */
84
- var DownloadCustomerAttachmentAcceptEnum;
85
- (function (DownloadCustomerAttachmentAcceptEnum) {
86
- DownloadCustomerAttachmentAcceptEnum["applicationJson"] = "application/json";
87
- DownloadCustomerAttachmentAcceptEnum["applicationOctetStream"] = "application/octet-stream";
88
- })(DownloadCustomerAttachmentAcceptEnum = exports.DownloadCustomerAttachmentAcceptEnum || (exports.DownloadCustomerAttachmentAcceptEnum = {}));
89
- var DownloadDirectIncomeAttachmentAcceptEnum;
90
- (function (DownloadDirectIncomeAttachmentAcceptEnum) {
91
- DownloadDirectIncomeAttachmentAcceptEnum["applicationJson"] = "application/json";
92
- DownloadDirectIncomeAttachmentAcceptEnum["applicationOctetStream"] = "application/octet-stream";
93
- })(DownloadDirectIncomeAttachmentAcceptEnum = exports.DownloadDirectIncomeAttachmentAcceptEnum || (exports.DownloadDirectIncomeAttachmentAcceptEnum = {}));
94
- var DownloadInvoiceAttachmentAcceptEnum;
95
- (function (DownloadInvoiceAttachmentAcceptEnum) {
96
- DownloadInvoiceAttachmentAcceptEnum["applicationJson"] = "application/json";
97
- DownloadInvoiceAttachmentAcceptEnum["applicationOctetStream"] = "application/octet-stream";
98
- })(DownloadInvoiceAttachmentAcceptEnum = exports.DownloadInvoiceAttachmentAcceptEnum || (exports.DownloadInvoiceAttachmentAcceptEnum = {}));
6
+ exports.AccountsReceivable = void 0;
7
+ var accountsreceivablecreditnotes_1 = require("./accountsreceivablecreditnotes");
8
+ var accountsreceivablecustomers_1 = require("./accountsreceivablecustomers");
9
+ var accountsreceivabledirectincomes_1 = require("./accountsreceivabledirectincomes");
10
+ var accountsreceivableinvoices_1 = require("./accountsreceivableinvoices");
11
+ var accountsreceivablepayments_1 = require("./accountsreceivablepayments");
12
+ var accountsreceivablereports_1 = require("./accountsreceivablereports");
99
13
  var AccountsReceivable = /** @class */ (function () {
100
14
  function AccountsReceivable(sdkConfig) {
101
15
  this.sdkConfiguration = sdkConfig;
16
+ this.creditNotes = new accountsreceivablecreditnotes_1.AccountsReceivableCreditNotes(this.sdkConfiguration);
17
+ this.customers = new accountsreceivablecustomers_1.AccountsReceivableCustomers(this.sdkConfiguration);
18
+ this.directIncomes = new accountsreceivabledirectincomes_1.AccountsReceivableDirectIncomes(this.sdkConfiguration);
19
+ this.invoices = new accountsreceivableinvoices_1.AccountsReceivableInvoices(this.sdkConfiguration);
20
+ this.payments = new accountsreceivablepayments_1.AccountsReceivablePayments(this.sdkConfiguration);
21
+ this.reports = new accountsreceivablereports_1.AccountsReceivableReports(this.sdkConfiguration);
102
22
  }
103
- /**
104
- * Download customer attachment
105
- *
106
- * @remarks
107
- * The *Download customer attachment* endpoint downloads a specific attachment for a given `customerId` and `attachmentId`.
108
- *
109
- * [Customers](https://docs.codat.io/accounting-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB.
110
- *
111
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support downloading a customer attachment.
112
- *
113
- */
114
- AccountsReceivable.prototype.downloadCustomerAttachment = function (req, retries, config, acceptHeaderOverride) {
115
- var _a, _b;
116
- return __awaiter(this, void 0, void 0, function () {
117
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
118
- return __generator(this, function (_c) {
119
- switch (_c.label) {
120
- case 0:
121
- if (!(req instanceof utils.SpeakeasyBase)) {
122
- req = new operations.DownloadAccountingCustomerAttachmentRequest(req);
123
- }
124
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
125
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}/download", req);
126
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
127
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
128
- if (acceptHeaderOverride !== undefined) {
129
- headers["Accept"] = acceptHeaderOverride.toString();
130
- }
131
- else {
132
- headers["Accept"] = "application/json;q=1, application/octet-stream;q=0";
133
- }
134
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
135
- retryConfig = retries;
136
- if (!retryConfig) {
137
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
138
- }
139
- return [4 /*yield*/, utils.Retry(function () {
140
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
141
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
142
- case 1:
143
- httpRes = _c.sent();
144
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
145
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
146
- throw new Error("status code not found in response: ".concat(httpRes));
147
- }
148
- res = new operations.DownloadAccountingCustomerAttachmentResponse({
149
- statusCode: httpRes.status,
150
- contentType: contentType,
151
- rawResponse: httpRes,
152
- });
153
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
154
- switch (true) {
155
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
156
- if (utils.matchContentType(contentType, "application/octet-stream")) {
157
- res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
158
- }
159
- else {
160
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
161
- }
162
- break;
163
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
164
- if (utils.matchContentType(contentType, "application/json")) {
165
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
166
- }
167
- else {
168
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
169
- }
170
- break;
171
- }
172
- return [2 /*return*/, res];
173
- }
174
- });
175
- });
176
- };
177
- /**
178
- * Download direct income attachment
179
- *
180
- * @remarks
181
- * The *Download direct income attachment* endpoint downloads a specific attachment for a given `directIncomeId` and `attachmentId`.
182
- *
183
- * [Direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) are sales of items directly to a customer where payment is received at the point of the sale.
184
- *
185
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=directIncomes) for integrations that support downloading a direct income attachment.
186
- *
187
- */
188
- AccountsReceivable.prototype.downloadDirectIncomeAttachment = function (req, retries, config, acceptHeaderOverride) {
189
- var _a, _b;
190
- return __awaiter(this, void 0, void 0, function () {
191
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
192
- return __generator(this, function (_c) {
193
- switch (_c.label) {
194
- case 0:
195
- if (!(req instanceof utils.SpeakeasyBase)) {
196
- req = new operations.DownloadAccountingDirectIncomeAttachmentRequest(req);
197
- }
198
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
199
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}/download", req);
200
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
201
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
202
- if (acceptHeaderOverride !== undefined) {
203
- headers["Accept"] = acceptHeaderOverride.toString();
204
- }
205
- else {
206
- headers["Accept"] = "application/json;q=1, application/octet-stream;q=0";
207
- }
208
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
209
- retryConfig = retries;
210
- if (!retryConfig) {
211
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
212
- }
213
- return [4 /*yield*/, utils.Retry(function () {
214
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
215
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
216
- case 1:
217
- httpRes = _c.sent();
218
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
219
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
220
- throw new Error("status code not found in response: ".concat(httpRes));
221
- }
222
- res = new operations.DownloadAccountingDirectIncomeAttachmentResponse({
223
- statusCode: httpRes.status,
224
- contentType: contentType,
225
- rawResponse: httpRes,
226
- });
227
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
228
- switch (true) {
229
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
230
- if (utils.matchContentType(contentType, "application/octet-stream")) {
231
- res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
232
- }
233
- else {
234
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
235
- }
236
- break;
237
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
238
- if (utils.matchContentType(contentType, "application/json")) {
239
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
240
- }
241
- else {
242
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
243
- }
244
- break;
245
- }
246
- return [2 /*return*/, res];
247
- }
248
- });
249
- });
250
- };
251
- /**
252
- * Download invoice attachment
253
- *
254
- * @remarks
255
- * The *Download invoice attachment* endpoint downloads a specific attachment for a given `invoiceId` and `attachmentId`.
256
- *
257
- * [Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.
258
- *
259
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=invoices) for integrations that support downloading an invoice attachment.
260
- *
261
- */
262
- AccountsReceivable.prototype.downloadInvoiceAttachment = function (req, retries, config, acceptHeaderOverride) {
263
- var _a, _b;
264
- return __awaiter(this, void 0, void 0, function () {
265
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
266
- return __generator(this, function (_c) {
267
- switch (_c.label) {
268
- case 0:
269
- if (!(req instanceof utils.SpeakeasyBase)) {
270
- req = new operations.DownloadAccountingInvoiceAttachmentRequest(req);
271
- }
272
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
273
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}/download", req);
274
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
275
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
276
- if (acceptHeaderOverride !== undefined) {
277
- headers["Accept"] = acceptHeaderOverride.toString();
278
- }
279
- else {
280
- headers["Accept"] = "application/json;q=1, application/octet-stream;q=0";
281
- }
282
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
283
- retryConfig = retries;
284
- if (!retryConfig) {
285
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
286
- }
287
- return [4 /*yield*/, utils.Retry(function () {
288
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
289
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
290
- case 1:
291
- httpRes = _c.sent();
292
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
293
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
294
- throw new Error("status code not found in response: ".concat(httpRes));
295
- }
296
- res = new operations.DownloadAccountingInvoiceAttachmentResponse({
297
- statusCode: httpRes.status,
298
- contentType: contentType,
299
- rawResponse: httpRes,
300
- });
301
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
302
- switch (true) {
303
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
304
- if (utils.matchContentType(contentType, "application/octet-stream")) {
305
- res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
306
- }
307
- else {
308
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
309
- }
310
- break;
311
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
312
- if (utils.matchContentType(contentType, "application/json")) {
313
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
314
- }
315
- else {
316
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
317
- }
318
- break;
319
- }
320
- return [2 /*return*/, res];
321
- }
322
- });
323
- });
324
- };
325
- /**
326
- * Get invoice as PDF
327
- *
328
- * @remarks
329
- * Download invoice as a pdf.
330
- */
331
- AccountsReceivable.prototype.downloadInvoicePdf = function (req, retries, config) {
332
- var _a, _b;
333
- return __awaiter(this, void 0, void 0, function () {
334
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res;
335
- return __generator(this, function (_c) {
336
- switch (_c.label) {
337
- case 0:
338
- if (!(req instanceof utils.SpeakeasyBase)) {
339
- req = new operations.DownloadAccountingInvoicePdfRequest(req);
340
- }
341
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
342
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/invoices/{invoiceId}/pdf", req);
343
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
344
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
345
- headers["Accept"] = "application/octet-stream";
346
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
347
- retryConfig = retries;
348
- if (!retryConfig) {
349
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
350
- }
351
- return [4 /*yield*/, utils.Retry(function () {
352
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
353
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
354
- case 1:
355
- httpRes = _c.sent();
356
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
357
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
358
- throw new Error("status code not found in response: ".concat(httpRes));
359
- }
360
- res = new operations.DownloadAccountingInvoicePdfResponse({
361
- statusCode: httpRes.status,
362
- contentType: contentType,
363
- rawResponse: httpRes,
364
- });
365
- switch (true) {
366
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
367
- if (utils.matchContentType(contentType, "application/octet-stream")) {
368
- res.data = httpRes === null || httpRes === void 0 ? void 0 : httpRes.data;
369
- }
370
- else {
371
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, httpRes === null || httpRes === void 0 ? void 0 : httpRes.data, httpRes);
372
- }
373
- break;
374
- }
375
- return [2 /*return*/, res];
376
- }
377
- });
378
- });
379
- };
380
- /**
381
- * Aged debtors report
382
- *
383
- * @remarks
384
- * Returns aged debtors report for company that shows the total outstanding balance due from customers to the business over time.
385
- */
386
- AccountsReceivable.prototype.getAgedDebtorsReport = function (req, retries, config) {
387
- var _a, _b;
388
- return __awaiter(this, void 0, void 0, function () {
389
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
390
- return __generator(this, function (_c) {
391
- switch (_c.label) {
392
- case 0:
393
- if (!(req instanceof utils.SpeakeasyBase)) {
394
- req = new operations.GetAccountingAgedDebtorsReportRequest(req);
395
- }
396
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
397
- url = utils.generateURL(baseURL, "/companies/{companyId}/reports/agedDebtor", req);
398
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
399
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
400
- queryParams = utils.serializeQueryParams(req);
401
- headers["Accept"] = "application/json";
402
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
403
- retryConfig = retries;
404
- if (!retryConfig) {
405
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
406
- }
407
- return [4 /*yield*/, utils.Retry(function () {
408
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
409
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
410
- case 1:
411
- httpRes = _c.sent();
412
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
413
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
414
- throw new Error("status code not found in response: ".concat(httpRes));
415
- }
416
- res = new operations.GetAccountingAgedDebtorsReportResponse({
417
- statusCode: httpRes.status,
418
- contentType: contentType,
419
- rawResponse: httpRes,
420
- });
421
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
422
- switch (true) {
423
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
424
- if (utils.matchContentType(contentType, "application/json")) {
425
- res.accountingAgedDebtorReport = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingAgedDebtorReport);
426
- }
427
- else {
428
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
429
- }
430
- break;
431
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
432
- if (utils.matchContentType(contentType, "application/json")) {
433
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
434
- }
435
- else {
436
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
437
- }
438
- break;
439
- }
440
- return [2 /*return*/, res];
441
- }
442
- });
443
- });
444
- };
445
- /**
446
- * Get credit note
447
- *
448
- * @remarks
449
- * The *Get credit note* endpoint returns a single credit note for a given creditNoteId.
450
- *
451
- * [Credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase.
452
- *
453
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=creditNotes) for integrations that support getting a specific credit note.
454
- *
455
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
456
- *
457
- */
458
- AccountsReceivable.prototype.getCreditNote = function (req, retries, config) {
459
- var _a, _b;
460
- return __awaiter(this, void 0, void 0, function () {
461
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
462
- return __generator(this, function (_c) {
463
- switch (_c.label) {
464
- case 0:
465
- if (!(req instanceof utils.SpeakeasyBase)) {
466
- req = new operations.GetAccountingCreditNoteRequest(req);
467
- }
468
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
469
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/creditNotes/{creditNoteId}", req);
470
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
471
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
472
- headers["Accept"] = "application/json";
473
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
474
- retryConfig = retries;
475
- if (!retryConfig) {
476
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
477
- }
478
- return [4 /*yield*/, utils.Retry(function () {
479
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
480
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
481
- case 1:
482
- httpRes = _c.sent();
483
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
484
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
485
- throw new Error("status code not found in response: ".concat(httpRes));
486
- }
487
- res = new operations.GetAccountingCreditNoteResponse({
488
- statusCode: httpRes.status,
489
- contentType: contentType,
490
- rawResponse: httpRes,
491
- });
492
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
493
- switch (true) {
494
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
495
- if (utils.matchContentType(contentType, "application/json")) {
496
- res.accountingCreditNote = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreditNote);
497
- }
498
- else {
499
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
500
- }
501
- break;
502
- case [401, 404, 409, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
503
- if (utils.matchContentType(contentType, "application/json")) {
504
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
505
- }
506
- else {
507
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
508
- }
509
- break;
510
- }
511
- return [2 /*return*/, res];
512
- }
513
- });
514
- });
515
- };
516
- /**
517
- * Get customer
518
- *
519
- * @remarks
520
- * The *Get customer* endpoint returns a single customer for a given customerId.
521
- *
522
- * [Customers](https://docs.codat.io/accounting-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB.
523
- *
524
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support getting a specific customer.
525
- *
526
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
527
- *
528
- */
529
- AccountsReceivable.prototype.getCustomer = function (req, retries, config) {
530
- var _a, _b;
531
- return __awaiter(this, void 0, void 0, function () {
532
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
533
- return __generator(this, function (_c) {
534
- switch (_c.label) {
535
- case 0:
536
- if (!(req instanceof utils.SpeakeasyBase)) {
537
- req = new operations.GetAccountingCustomerRequest(req);
538
- }
539
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
540
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/customers/{customerId}", req);
541
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
542
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
543
- headers["Accept"] = "application/json";
544
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
545
- retryConfig = retries;
546
- if (!retryConfig) {
547
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
548
- }
549
- return [4 /*yield*/, utils.Retry(function () {
550
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
551
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
552
- case 1:
553
- httpRes = _c.sent();
554
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
555
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
556
- throw new Error("status code not found in response: ".concat(httpRes));
557
- }
558
- res = new operations.GetAccountingCustomerResponse({
559
- statusCode: httpRes.status,
560
- contentType: contentType,
561
- rawResponse: httpRes,
562
- });
563
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
564
- switch (true) {
565
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
566
- if (utils.matchContentType(contentType, "application/json")) {
567
- res.accountingCustomer = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCustomer);
568
- }
569
- else {
570
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
571
- }
572
- break;
573
- case [401, 404, 409, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
574
- if (utils.matchContentType(contentType, "application/json")) {
575
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
576
- }
577
- else {
578
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
579
- }
580
- break;
581
- }
582
- return [2 /*return*/, res];
583
- }
584
- });
585
- });
586
- };
587
- /**
588
- * Get customer attachment
589
- *
590
- * @remarks
591
- * The *Get customer attachment* endpoint returns a specific attachment for a given `customerId` and `attachmentId`.
592
- *
593
- * [Customers](https://docs.codat.io/accounting-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB.
594
- *
595
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support getting a customer attachment.
596
- *
597
- */
598
- AccountsReceivable.prototype.getCustomerAttachment = function (req, retries, config) {
599
- var _a, _b;
600
- return __awaiter(this, void 0, void 0, function () {
601
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
602
- return __generator(this, function (_c) {
603
- switch (_c.label) {
604
- case 0:
605
- if (!(req instanceof utils.SpeakeasyBase)) {
606
- req = new operations.GetAccountingCustomerAttachmentRequest(req);
607
- }
608
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
609
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments/{attachmentId}", req);
610
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
611
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
612
- headers["Accept"] = "application/json";
613
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
614
- retryConfig = retries;
615
- if (!retryConfig) {
616
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
617
- }
618
- return [4 /*yield*/, utils.Retry(function () {
619
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
620
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
621
- case 1:
622
- httpRes = _c.sent();
623
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
624
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
625
- throw new Error("status code not found in response: ".concat(httpRes));
626
- }
627
- res = new operations.GetAccountingCustomerAttachmentResponse({
628
- statusCode: httpRes.status,
629
- contentType: contentType,
630
- rawResponse: httpRes,
631
- });
632
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
633
- switch (true) {
634
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
635
- if (utils.matchContentType(contentType, "application/json")) {
636
- res.accountingAttachment = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingAttachment);
637
- }
638
- else {
639
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
640
- }
641
- break;
642
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
643
- if (utils.matchContentType(contentType, "application/json")) {
644
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
645
- }
646
- else {
647
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
648
- }
649
- break;
650
- }
651
- return [2 /*return*/, res];
652
- }
653
- });
654
- });
655
- };
656
- /**
657
- * Get direct income
658
- *
659
- * @remarks
660
- * The *Get direct income* endpoint returns a single direct income for a given directIncomeId.
661
- *
662
- * [Direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) are sales of items directly to a customer where payment is received at the point of the sale.
663
- *
664
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=directIncomes) for integrations that support getting a specific direct income.
665
- *
666
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
667
- *
668
- */
669
- AccountsReceivable.prototype.getDirectIncome = function (req, retries, config) {
670
- var _a, _b;
671
- return __awaiter(this, void 0, void 0, function () {
672
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
673
- return __generator(this, function (_c) {
674
- switch (_c.label) {
675
- case 0:
676
- if (!(req instanceof utils.SpeakeasyBase)) {
677
- req = new operations.GetAccountingDirectIncomeRequest(req);
678
- }
679
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
680
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}", req);
681
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
682
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
683
- headers["Accept"] = "application/json";
684
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
685
- retryConfig = retries;
686
- if (!retryConfig) {
687
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
688
- }
689
- return [4 /*yield*/, utils.Retry(function () {
690
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
691
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
692
- case 1:
693
- httpRes = _c.sent();
694
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
695
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
696
- throw new Error("status code not found in response: ".concat(httpRes));
697
- }
698
- res = new operations.GetAccountingDirectIncomeResponse({
699
- statusCode: httpRes.status,
700
- contentType: contentType,
701
- rawResponse: httpRes,
702
- });
703
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
704
- switch (true) {
705
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
706
- if (utils.matchContentType(contentType, "application/json")) {
707
- res.accountingDirectIncome = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingDirectIncome);
708
- }
709
- else {
710
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
711
- }
712
- break;
713
- case [401, 404, 409, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
714
- if (utils.matchContentType(contentType, "application/json")) {
715
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
716
- }
717
- else {
718
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
719
- }
720
- break;
721
- }
722
- return [2 /*return*/, res];
723
- }
724
- });
725
- });
726
- };
727
- /**
728
- * Get direct income attachment
729
- *
730
- * @remarks
731
- * The *Get direct income attachment* endpoint returns a specific attachment for a given `directIncomeId` and `attachmentId`.
732
- *
733
- * [Direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) are sales of items directly to a customer where payment is received at the point of the sale.
734
- *
735
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=directIncomes) for integrations that support getting a direct income attachment.
736
- *
737
- */
738
- AccountsReceivable.prototype.getDirectIncomeAttachment = function (req, retries, config) {
739
- var _a, _b;
740
- return __awaiter(this, void 0, void 0, function () {
741
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
742
- return __generator(this, function (_c) {
743
- switch (_c.label) {
744
- case 0:
745
- if (!(req instanceof utils.SpeakeasyBase)) {
746
- req = new operations.GetAccountingDirectIncomeAttachmentRequest(req);
747
- }
748
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
749
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments/{attachmentId}", req);
750
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
751
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
752
- queryParams = utils.serializeQueryParams(req);
753
- headers["Accept"] = "application/json";
754
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
755
- retryConfig = retries;
756
- if (!retryConfig) {
757
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
758
- }
759
- return [4 /*yield*/, utils.Retry(function () {
760
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
761
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
762
- case 1:
763
- httpRes = _c.sent();
764
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
765
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
766
- throw new Error("status code not found in response: ".concat(httpRes));
767
- }
768
- res = new operations.GetAccountingDirectIncomeAttachmentResponse({
769
- statusCode: httpRes.status,
770
- contentType: contentType,
771
- rawResponse: httpRes,
772
- });
773
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
774
- switch (true) {
775
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
776
- if (utils.matchContentType(contentType, "application/json")) {
777
- res.accountingAttachment = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingAttachment);
778
- }
779
- else {
780
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
781
- }
782
- break;
783
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
784
- if (utils.matchContentType(contentType, "application/json")) {
785
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
786
- }
787
- else {
788
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
789
- }
790
- break;
791
- }
792
- return [2 /*return*/, res];
793
- }
794
- });
795
- });
796
- };
797
- /**
798
- * Get enhanced invoices report
799
- *
800
- * @remarks
801
- * Gets a list of invoices linked to the corresponding banking transaction
802
- */
803
- AccountsReceivable.prototype.getEnhancedInvoicesReport = function (req, retries, config) {
804
- var _a, _b;
805
- return __awaiter(this, void 0, void 0, function () {
806
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
807
- return __generator(this, function (_c) {
808
- switch (_c.label) {
809
- case 0:
810
- if (!(req instanceof utils.SpeakeasyBase)) {
811
- req = new operations.GetEnhancedInvoicesReportRequest(req);
812
- }
813
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
814
- url = utils.generateURL(baseURL, "/companies/{companyId}/reports/enhancedInvoices", req);
815
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
816
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
817
- queryParams = utils.serializeQueryParams(req);
818
- headers["Accept"] = "application/json";
819
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
820
- retryConfig = retries;
821
- if (!retryConfig) {
822
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
823
- }
824
- return [4 /*yield*/, utils.Retry(function () {
825
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
826
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
827
- case 1:
828
- httpRes = _c.sent();
829
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
830
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
831
- throw new Error("status code not found in response: ".concat(httpRes));
832
- }
833
- res = new operations.GetEnhancedInvoicesReportResponse({
834
- statusCode: httpRes.status,
835
- contentType: contentType,
836
- rawResponse: httpRes,
837
- });
838
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
839
- switch (true) {
840
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
841
- if (utils.matchContentType(contentType, "application/json")) {
842
- res.enhancedInvoicesReport = utils.objectToClass(JSON.parse(decodedRes), shared.EnhancedInvoicesReport);
843
- }
844
- else {
845
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
846
- }
847
- break;
848
- case [401, 404].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
849
- if (utils.matchContentType(contentType, "application/json")) {
850
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
851
- }
852
- else {
853
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
854
- }
855
- break;
856
- }
857
- return [2 /*return*/, res];
858
- }
859
- });
860
- });
861
- };
862
- /**
863
- * Get invoice
864
- *
865
- * @remarks
866
- * The *Get invoice* endpoint returns a single invoice for a given invoiceId.
867
- *
868
- * [Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.
869
- *
870
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=invoices) for integrations that support getting a specific invoice.
871
- *
872
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
873
- *
874
- */
875
- AccountsReceivable.prototype.getInvoice = function (req, retries, config) {
876
- var _a, _b;
877
- return __awaiter(this, void 0, void 0, function () {
878
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
879
- return __generator(this, function (_c) {
880
- switch (_c.label) {
881
- case 0:
882
- if (!(req instanceof utils.SpeakeasyBase)) {
883
- req = new operations.GetAccountingInvoiceRequest(req);
884
- }
885
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
886
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/invoices/{invoiceId}", req);
887
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
888
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
889
- headers["Accept"] = "application/json";
890
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
891
- retryConfig = retries;
892
- if (!retryConfig) {
893
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
894
- }
895
- return [4 /*yield*/, utils.Retry(function () {
896
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
897
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
898
- case 1:
899
- httpRes = _c.sent();
900
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
901
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
902
- throw new Error("status code not found in response: ".concat(httpRes));
903
- }
904
- res = new operations.GetAccountingInvoiceResponse({
905
- statusCode: httpRes.status,
906
- contentType: contentType,
907
- rawResponse: httpRes,
908
- });
909
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
910
- switch (true) {
911
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
912
- if (utils.matchContentType(contentType, "application/json")) {
913
- res.accountingInvoice = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingInvoice);
914
- }
915
- else {
916
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
917
- }
918
- break;
919
- case [401, 404, 409, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
920
- if (utils.matchContentType(contentType, "application/json")) {
921
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
922
- }
923
- else {
924
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
925
- }
926
- break;
927
- }
928
- return [2 /*return*/, res];
929
- }
930
- });
931
- });
932
- };
933
- /**
934
- * Get invoice attachment
935
- *
936
- * @remarks
937
- * The *Get invoice attachment* endpoint returns a specific attachment for a given `invoiceId` and `attachmentId`.
938
- *
939
- * [Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.
940
- *
941
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=invoices) for integrations that support getting an invoice attachment.
942
- *
943
- */
944
- AccountsReceivable.prototype.getInvoiceAttachment = function (req, retries, config) {
945
- var _a, _b;
946
- return __awaiter(this, void 0, void 0, function () {
947
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
948
- return __generator(this, function (_c) {
949
- switch (_c.label) {
950
- case 0:
951
- if (!(req instanceof utils.SpeakeasyBase)) {
952
- req = new operations.GetAccountingInvoiceAttachmentRequest(req);
953
- }
954
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
955
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments/{attachmentId}", req);
956
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
957
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
958
- headers["Accept"] = "application/json";
959
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
960
- retryConfig = retries;
961
- if (!retryConfig) {
962
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
963
- }
964
- return [4 /*yield*/, utils.Retry(function () {
965
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
966
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
967
- case 1:
968
- httpRes = _c.sent();
969
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
970
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
971
- throw new Error("status code not found in response: ".concat(httpRes));
972
- }
973
- res = new operations.GetAccountingInvoiceAttachmentResponse({
974
- statusCode: httpRes.status,
975
- contentType: contentType,
976
- rawResponse: httpRes,
977
- });
978
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
979
- switch (true) {
980
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
981
- if (utils.matchContentType(contentType, "application/json")) {
982
- res.accountingAttachment = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingAttachment);
983
- }
984
- else {
985
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
986
- }
987
- break;
988
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
989
- if (utils.matchContentType(contentType, "application/json")) {
990
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
991
- }
992
- else {
993
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
994
- }
995
- break;
996
- }
997
- return [2 /*return*/, res];
998
- }
999
- });
1000
- });
1001
- };
1002
- /**
1003
- * Get payment
1004
- *
1005
- * @remarks
1006
- * The *Get payment* endpoint returns a single payment for a given paymentId.
1007
- *
1008
- * [Payments](https://docs.codat.io/accounting-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account.
1009
- *
1010
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=payments) for integrations that support getting a specific payment.
1011
- *
1012
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1013
- *
1014
- */
1015
- AccountsReceivable.prototype.getPayment = function (req, retries, config) {
1016
- var _a, _b;
1017
- return __awaiter(this, void 0, void 0, function () {
1018
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
1019
- return __generator(this, function (_c) {
1020
- switch (_c.label) {
1021
- case 0:
1022
- if (!(req instanceof utils.SpeakeasyBase)) {
1023
- req = new operations.GetAccountingPaymentRequest(req);
1024
- }
1025
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1026
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/payments/{paymentId}", req);
1027
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1028
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1029
- headers["Accept"] = "application/json";
1030
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1031
- retryConfig = retries;
1032
- if (!retryConfig) {
1033
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1034
- }
1035
- return [4 /*yield*/, utils.Retry(function () {
1036
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1037
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1038
- case 1:
1039
- httpRes = _c.sent();
1040
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1041
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1042
- throw new Error("status code not found in response: ".concat(httpRes));
1043
- }
1044
- res = new operations.GetAccountingPaymentResponse({
1045
- statusCode: httpRes.status,
1046
- contentType: contentType,
1047
- rawResponse: httpRes,
1048
- });
1049
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1050
- switch (true) {
1051
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1052
- if (utils.matchContentType(contentType, "application/json")) {
1053
- res.accountingPayment = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingPayment);
1054
- }
1055
- else {
1056
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1057
- }
1058
- break;
1059
- case [401, 404, 409, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1060
- if (utils.matchContentType(contentType, "application/json")) {
1061
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1062
- }
1063
- else {
1064
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1065
- }
1066
- break;
1067
- }
1068
- return [2 /*return*/, res];
1069
- }
1070
- });
1071
- });
1072
- };
1073
- /**
1074
- * Aged debtors report available
1075
- *
1076
- * @remarks
1077
- * Indicates whether the aged debtor report is available for the company.
1078
- */
1079
- AccountsReceivable.prototype.isAgedDebtorReportAvailable = function (req, retries, config) {
1080
- var _a, _b;
1081
- return __awaiter(this, void 0, void 0, function () {
1082
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
1083
- return __generator(this, function (_c) {
1084
- switch (_c.label) {
1085
- case 0:
1086
- if (!(req instanceof utils.SpeakeasyBase)) {
1087
- req = new operations.IsAgedDebtorReportAvailableRequest(req);
1088
- }
1089
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1090
- url = utils.generateURL(baseURL, "/companies/{companyId}/reports/agedDebtor/available", req);
1091
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1092
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1093
- headers["Accept"] = "application/json";
1094
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1095
- retryConfig = retries;
1096
- if (!retryConfig) {
1097
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1098
- }
1099
- return [4 /*yield*/, utils.Retry(function () {
1100
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1101
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1102
- case 1:
1103
- httpRes = _c.sent();
1104
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1105
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1106
- throw new Error("status code not found in response: ".concat(httpRes));
1107
- }
1108
- res = new operations.IsAgedDebtorReportAvailableResponse({
1109
- statusCode: httpRes.status,
1110
- contentType: contentType,
1111
- rawResponse: httpRes,
1112
- });
1113
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1114
- switch (true) {
1115
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1116
- if (utils.matchContentType(contentType, "application/json")) {
1117
- res.isAgedDebtorReportAvailable200ApplicationJSONBoolean =
1118
- JSON.parse(decodedRes);
1119
- }
1120
- else {
1121
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1122
- }
1123
- break;
1124
- }
1125
- return [2 /*return*/, res];
1126
- }
1127
- });
1128
- });
1129
- };
1130
- /**
1131
- * List credit notes
1132
- *
1133
- * @remarks
1134
- * The *List credit notes* endpoint returns a list of [credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote) for a given company's connection.
1135
- *
1136
- * [Credit notes](https://docs.codat.io/accounting-api#/schemas/CreditNote) are issued to a customer to indicate debt, typically with reference to a previously issued invoice and/or purchase.
1137
- *
1138
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1139
- *
1140
- */
1141
- AccountsReceivable.prototype.listCreditNotes = function (req, retries, config) {
1142
- var _a, _b;
1143
- return __awaiter(this, void 0, void 0, function () {
1144
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
1145
- return __generator(this, function (_c) {
1146
- switch (_c.label) {
1147
- case 0:
1148
- if (!(req instanceof utils.SpeakeasyBase)) {
1149
- req = new operations.ListAccountingCreditNotesRequest(req);
1150
- }
1151
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1152
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/creditNotes", req);
1153
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1154
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1155
- queryParams = utils.serializeQueryParams(req);
1156
- headers["Accept"] = "application/json";
1157
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1158
- retryConfig = retries;
1159
- if (!retryConfig) {
1160
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1161
- }
1162
- return [4 /*yield*/, utils.Retry(function () {
1163
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1164
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1165
- case 1:
1166
- httpRes = _c.sent();
1167
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1168
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1169
- throw new Error("status code not found in response: ".concat(httpRes));
1170
- }
1171
- res = new operations.ListAccountingCreditNotesResponse({
1172
- statusCode: httpRes.status,
1173
- contentType: contentType,
1174
- rawResponse: httpRes,
1175
- });
1176
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1177
- switch (true) {
1178
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1179
- if (utils.matchContentType(contentType, "application/json")) {
1180
- res.accountingCreditNotes = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCreditNotes);
1181
- }
1182
- else {
1183
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1184
- }
1185
- break;
1186
- case [400, 401, 404, 409].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1187
- if (utils.matchContentType(contentType, "application/json")) {
1188
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1189
- }
1190
- else {
1191
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1192
- }
1193
- break;
1194
- }
1195
- return [2 /*return*/, res];
1196
- }
1197
- });
1198
- });
1199
- };
1200
- /**
1201
- * List customer attachments
1202
- *
1203
- * @remarks
1204
- * The *List customer attachments* endpoint returns a list of attachments avialable to download for given `customerId`.
1205
- *
1206
- * [Customers](https://docs.codat.io/accounting-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB.
1207
- *
1208
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=customers) for integrations that support listing customer attachments.
1209
- *
1210
- */
1211
- AccountsReceivable.prototype.listCustomerAttachments = function (req, retries, config) {
1212
- var _a, _b;
1213
- return __awaiter(this, void 0, void 0, function () {
1214
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
1215
- return __generator(this, function (_c) {
1216
- switch (_c.label) {
1217
- case 0:
1218
- if (!(req instanceof utils.SpeakeasyBase)) {
1219
- req = new operations.ListAccountingCustomerAttachmentsRequest(req);
1220
- }
1221
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1222
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/customers/{customerId}/attachments", req);
1223
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1224
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1225
- headers["Accept"] = "application/json";
1226
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1227
- retryConfig = retries;
1228
- if (!retryConfig) {
1229
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1230
- }
1231
- return [4 /*yield*/, utils.Retry(function () {
1232
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1233
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1234
- case 1:
1235
- httpRes = _c.sent();
1236
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1237
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1238
- throw new Error("status code not found in response: ".concat(httpRes));
1239
- }
1240
- res = new operations.ListAccountingCustomerAttachmentsResponse({
1241
- statusCode: httpRes.status,
1242
- contentType: contentType,
1243
- rawResponse: httpRes,
1244
- });
1245
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1246
- switch (true) {
1247
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1248
- if (utils.matchContentType(contentType, "application/json")) {
1249
- res.attachments = utils.objectToClass(JSON.parse(decodedRes), shared.Attachments);
1250
- }
1251
- else {
1252
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1253
- }
1254
- break;
1255
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1256
- if (utils.matchContentType(contentType, "application/json")) {
1257
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1258
- }
1259
- else {
1260
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1261
- }
1262
- break;
1263
- }
1264
- return [2 /*return*/, res];
1265
- }
1266
- });
1267
- });
1268
- };
1269
- /**
1270
- * List customers
1271
- *
1272
- * @remarks
1273
- * The *List customers* endpoint returns a list of [customers](https://docs.codat.io/accounting-api#/schemas/Customer) for a given company's connection.
1274
- *
1275
- * [Customers](https://docs.codat.io/accounting-api#/schemas/Customer) are people or organizations that buy goods or services from the SMB.
1276
- *
1277
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1278
- *
1279
- */
1280
- AccountsReceivable.prototype.listCustomers = function (req, retries, config) {
1281
- var _a, _b;
1282
- return __awaiter(this, void 0, void 0, function () {
1283
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
1284
- return __generator(this, function (_c) {
1285
- switch (_c.label) {
1286
- case 0:
1287
- if (!(req instanceof utils.SpeakeasyBase)) {
1288
- req = new operations.ListAccountingCustomersRequest(req);
1289
- }
1290
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1291
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/customers", req);
1292
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1293
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1294
- queryParams = utils.serializeQueryParams(req);
1295
- headers["Accept"] = "application/json";
1296
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1297
- retryConfig = retries;
1298
- if (!retryConfig) {
1299
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1300
- }
1301
- return [4 /*yield*/, utils.Retry(function () {
1302
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1303
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1304
- case 1:
1305
- httpRes = _c.sent();
1306
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1307
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1308
- throw new Error("status code not found in response: ".concat(httpRes));
1309
- }
1310
- res = new operations.ListAccountingCustomersResponse({
1311
- statusCode: httpRes.status,
1312
- contentType: contentType,
1313
- rawResponse: httpRes,
1314
- });
1315
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1316
- switch (true) {
1317
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1318
- if (utils.matchContentType(contentType, "application/json")) {
1319
- res.accountingCustomers = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingCustomers);
1320
- }
1321
- else {
1322
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1323
- }
1324
- break;
1325
- case [400, 401, 404, 409].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1326
- if (utils.matchContentType(contentType, "application/json")) {
1327
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1328
- }
1329
- else {
1330
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1331
- }
1332
- break;
1333
- }
1334
- return [2 /*return*/, res];
1335
- }
1336
- });
1337
- });
1338
- };
1339
- /**
1340
- * List direct income attachments
1341
- *
1342
- * @remarks
1343
- * The *List direct income attachments* endpoint returns a list of attachments available to download for given `directIncomeId`.
1344
- *
1345
- * [Direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) are sales of items directly to a customer where payment is received at the point of the sale.
1346
- *
1347
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=directIncomes) for integrations that support listing direct income attachments.
1348
- *
1349
- */
1350
- AccountsReceivable.prototype.listDirectIncomeAttachments = function (req, retries, config) {
1351
- var _a, _b;
1352
- return __awaiter(this, void 0, void 0, function () {
1353
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
1354
- return __generator(this, function (_c) {
1355
- switch (_c.label) {
1356
- case 0:
1357
- if (!(req instanceof utils.SpeakeasyBase)) {
1358
- req = new operations.ListAccountingDirectIncomeAttachmentsRequest(req);
1359
- }
1360
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1361
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/directIncomes/{directIncomeId}/attachments", req);
1362
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1363
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1364
- headers["Accept"] = "application/json";
1365
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1366
- retryConfig = retries;
1367
- if (!retryConfig) {
1368
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1369
- }
1370
- return [4 /*yield*/, utils.Retry(function () {
1371
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1372
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1373
- case 1:
1374
- httpRes = _c.sent();
1375
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1376
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1377
- throw new Error("status code not found in response: ".concat(httpRes));
1378
- }
1379
- res = new operations.ListAccountingDirectIncomeAttachmentsResponse({
1380
- statusCode: httpRes.status,
1381
- contentType: contentType,
1382
- rawResponse: httpRes,
1383
- });
1384
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1385
- switch (true) {
1386
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1387
- if (utils.matchContentType(contentType, "application/json")) {
1388
- res.attachments = utils.objectToClass(JSON.parse(decodedRes), shared.Attachments);
1389
- }
1390
- else {
1391
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1392
- }
1393
- break;
1394
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1395
- if (utils.matchContentType(contentType, "application/json")) {
1396
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1397
- }
1398
- else {
1399
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1400
- }
1401
- break;
1402
- }
1403
- return [2 /*return*/, res];
1404
- }
1405
- });
1406
- });
1407
- };
1408
- /**
1409
- * List direct incomes
1410
- *
1411
- * @remarks
1412
- * The *List direct incomes* endpoint returns a list of [direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) for a given company's connection.
1413
- *
1414
- * [Direct incomes](https://docs.codat.io/accounting-api#/schemas/DirectIncome) are sales of items directly to a customer where payment is received at the point of the sale.
1415
- *
1416
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1417
- *
1418
- */
1419
- AccountsReceivable.prototype.listDirectIncomes = function (req, retries, config) {
1420
- var _a, _b;
1421
- return __awaiter(this, void 0, void 0, function () {
1422
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
1423
- return __generator(this, function (_c) {
1424
- switch (_c.label) {
1425
- case 0:
1426
- if (!(req instanceof utils.SpeakeasyBase)) {
1427
- req = new operations.ListAccountingDirectIncomesRequest(req);
1428
- }
1429
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1430
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/directIncomes", req);
1431
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1432
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1433
- queryParams = utils.serializeQueryParams(req);
1434
- headers["Accept"] = "application/json";
1435
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1436
- retryConfig = retries;
1437
- if (!retryConfig) {
1438
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1439
- }
1440
- return [4 /*yield*/, utils.Retry(function () {
1441
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1442
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1443
- case 1:
1444
- httpRes = _c.sent();
1445
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1446
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1447
- throw new Error("status code not found in response: ".concat(httpRes));
1448
- }
1449
- res = new operations.ListAccountingDirectIncomesResponse({
1450
- statusCode: httpRes.status,
1451
- contentType: contentType,
1452
- rawResponse: httpRes,
1453
- });
1454
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1455
- switch (true) {
1456
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1457
- if (utils.matchContentType(contentType, "application/json")) {
1458
- res.accountingDirectIncomes = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingDirectIncomes);
1459
- }
1460
- else {
1461
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1462
- }
1463
- break;
1464
- case [400, 401, 404, 409].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1465
- if (utils.matchContentType(contentType, "application/json")) {
1466
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1467
- }
1468
- else {
1469
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1470
- }
1471
- break;
1472
- }
1473
- return [2 /*return*/, res];
1474
- }
1475
- });
1476
- });
1477
- };
1478
- /**
1479
- * List invoice attachments
1480
- *
1481
- * @remarks
1482
- * The *List invoice attachments* endpoint returns a list of attachments available to download for given `invoiceId`.
1483
- *
1484
- * [Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.
1485
- *
1486
- * Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=invoices) for integrations that support listing invoice attachments.
1487
- *
1488
- */
1489
- AccountsReceivable.prototype.listInvoiceAttachments = function (req, retries, config) {
1490
- var _a, _b;
1491
- return __awaiter(this, void 0, void 0, function () {
1492
- var baseURL, url, client, headers, retryConfig, httpRes, contentType, res, decodedRes;
1493
- return __generator(this, function (_c) {
1494
- switch (_c.label) {
1495
- case 0:
1496
- if (!(req instanceof utils.SpeakeasyBase)) {
1497
- req = new operations.ListAccountingInvoiceAttachmentsRequest(req);
1498
- }
1499
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1500
- url = utils.generateURL(baseURL, "/companies/{companyId}/connections/{connectionId}/data/invoices/{invoiceId}/attachments", req);
1501
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1502
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1503
- headers["Accept"] = "application/json";
1504
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1505
- retryConfig = retries;
1506
- if (!retryConfig) {
1507
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1508
- }
1509
- return [4 /*yield*/, utils.Retry(function () {
1510
- return client.request(__assign({ validateStatus: function () { return true; }, url: url, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1511
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1512
- case 1:
1513
- httpRes = _c.sent();
1514
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1515
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1516
- throw new Error("status code not found in response: ".concat(httpRes));
1517
- }
1518
- res = new operations.ListAccountingInvoiceAttachmentsResponse({
1519
- statusCode: httpRes.status,
1520
- contentType: contentType,
1521
- rawResponse: httpRes,
1522
- });
1523
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1524
- switch (true) {
1525
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1526
- if (utils.matchContentType(contentType, "application/json")) {
1527
- res.attachments = utils.objectToClass(JSON.parse(decodedRes), shared.Attachments);
1528
- }
1529
- else {
1530
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1531
- }
1532
- break;
1533
- case [401, 404, 429].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1534
- if (utils.matchContentType(contentType, "application/json")) {
1535
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1536
- }
1537
- else {
1538
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1539
- }
1540
- break;
1541
- }
1542
- return [2 /*return*/, res];
1543
- }
1544
- });
1545
- });
1546
- };
1547
- /**
1548
- * List invoices
1549
- *
1550
- * @remarks
1551
- * The *List invoices* endpoint returns a list of [invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) for a given company's connection.
1552
- *
1553
- * [Invoices](https://docs.codat.io/accounting-api#/schemas/Invoice) are itemized records of goods sold or services provided to a customer.
1554
- *
1555
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1556
- *
1557
- */
1558
- AccountsReceivable.prototype.listInvoices = function (req, retries, config) {
1559
- var _a, _b;
1560
- return __awaiter(this, void 0, void 0, function () {
1561
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
1562
- return __generator(this, function (_c) {
1563
- switch (_c.label) {
1564
- case 0:
1565
- if (!(req instanceof utils.SpeakeasyBase)) {
1566
- req = new operations.ListAccountingInvoicesRequest(req);
1567
- }
1568
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1569
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/invoices", req);
1570
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1571
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1572
- queryParams = utils.serializeQueryParams(req);
1573
- headers["Accept"] = "application/json";
1574
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1575
- retryConfig = retries;
1576
- if (!retryConfig) {
1577
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1578
- }
1579
- return [4 /*yield*/, utils.Retry(function () {
1580
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1581
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1582
- case 1:
1583
- httpRes = _c.sent();
1584
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1585
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1586
- throw new Error("status code not found in response: ".concat(httpRes));
1587
- }
1588
- res = new operations.ListAccountingInvoicesResponse({
1589
- statusCode: httpRes.status,
1590
- contentType: contentType,
1591
- rawResponse: httpRes,
1592
- });
1593
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1594
- switch (true) {
1595
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1596
- if (utils.matchContentType(contentType, "application/json")) {
1597
- res.accountingInvoices = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingInvoices);
1598
- }
1599
- else {
1600
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1601
- }
1602
- break;
1603
- case [400, 401, 404, 409].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1604
- if (utils.matchContentType(contentType, "application/json")) {
1605
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1606
- }
1607
- else {
1608
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1609
- }
1610
- break;
1611
- }
1612
- return [2 /*return*/, res];
1613
- }
1614
- });
1615
- });
1616
- };
1617
- /**
1618
- * List payments
1619
- *
1620
- * @remarks
1621
- * The *List payments* endpoint returns a list of [payments](https://docs.codat.io/accounting-api#/schemas/Payment) for a given company's connection.
1622
- *
1623
- * [Payments](https://docs.codat.io/accounting-api#/schemas/Payment) represent an allocation of money within any customer accounts receivable account.
1624
- *
1625
- * Before using this endpoint, you must have [retrieved data for the company](https://docs.codat.io/lending-api#/operations/refresh-company-data).
1626
- *
1627
- */
1628
- AccountsReceivable.prototype.listPayments = function (req, retries, config) {
1629
- var _a, _b;
1630
- return __awaiter(this, void 0, void 0, function () {
1631
- var baseURL, url, client, headers, queryParams, retryConfig, httpRes, contentType, res, decodedRes;
1632
- return __generator(this, function (_c) {
1633
- switch (_c.label) {
1634
- case 0:
1635
- if (!(req instanceof utils.SpeakeasyBase)) {
1636
- req = new operations.ListAccountingPaymentsRequest(req);
1637
- }
1638
- baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
1639
- url = utils.generateURL(baseURL, "/companies/{companyId}/data/payments", req);
1640
- client = this.sdkConfiguration.securityClient || this.sdkConfiguration.defaultClient;
1641
- headers = __assign({}, config === null || config === void 0 ? void 0 : config.headers);
1642
- queryParams = utils.serializeQueryParams(req);
1643
- headers["Accept"] = "application/json";
1644
- headers["user-agent"] = "speakeasy-sdk/".concat(this.sdkConfiguration.language, " ").concat(this.sdkConfiguration.sdkVersion, " ").concat(this.sdkConfiguration.genVersion, " ").concat(this.sdkConfiguration.openapiDocVersion);
1645
- retryConfig = retries;
1646
- if (!retryConfig) {
1647
- retryConfig = new utils.RetryConfig("backoff", new utils.BackoffStrategy(500, 60000, 1.5, 3600000), true);
1648
- }
1649
- return [4 /*yield*/, utils.Retry(function () {
1650
- return client.request(__assign({ validateStatus: function () { return true; }, url: url + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config));
1651
- }, new utils.Retries(retryConfig, ["408", "429", "5XX"]))];
1652
- case 1:
1653
- httpRes = _c.sent();
1654
- contentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
1655
- if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
1656
- throw new Error("status code not found in response: ".concat(httpRes));
1657
- }
1658
- res = new operations.ListAccountingPaymentsResponse({
1659
- statusCode: httpRes.status,
1660
- contentType: contentType,
1661
- rawResponse: httpRes,
1662
- });
1663
- decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
1664
- switch (true) {
1665
- case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
1666
- if (utils.matchContentType(contentType, "application/json")) {
1667
- res.accountingPayments = utils.objectToClass(JSON.parse(decodedRes), shared.AccountingPayments);
1668
- }
1669
- else {
1670
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1671
- }
1672
- break;
1673
- case [400, 401, 404, 409].includes(httpRes === null || httpRes === void 0 ? void 0 : httpRes.status):
1674
- if (utils.matchContentType(contentType, "application/json")) {
1675
- res.errorMessage = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorMessage);
1676
- }
1677
- else {
1678
- throw new errors.SDKError("unknown content-type received: " + contentType, httpRes.status, decodedRes, httpRes);
1679
- }
1680
- break;
1681
- }
1682
- return [2 /*return*/, res];
1683
- }
1684
- });
1685
- });
1686
- };
1687
23
  return AccountsReceivable;
1688
24
  }());
1689
25
  exports.AccountsReceivable = AccountsReceivable;