From a91ab8d77741a1f95282abef926ee250abba3072 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Sat, 14 Sep 2024 08:57:25 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.396.9 --- .speakeasy/workflow.lock | 14 + .speakeasy/workflow.yaml | 2 + sync-for-expenses/.speakeasy/gen.lock | 2462 ++++++++++++++--- sync-for-expenses/.speakeasy/gen.yaml | 4 +- sync-for-expenses/CONTRIBUTING.md | 26 + sync-for-expenses/README.md | 183 +- sync-for-expenses/RELEASES.md | 12 +- sync-for-expenses/USAGE.md | 7 +- sync-for-expenses/accounts.go | 295 +- sync-for-expenses/adjustments.go | 283 ++ sync-for-expenses/attachments.go | 152 +- sync-for-expenses/bankaccounts.go | 533 ++++ sync-for-expenses/codatsyncexpenses.go | 100 +- sync-for-expenses/companies.go | 720 +++-- sync-for-expenses/configuration.go | 446 +-- sync-for-expenses/connections.go | 865 ++++-- sync-for-expenses/customers.go | 585 +++- .../createadjustmenttransactionrequest.md | 9 + .../createadjustmenttransactionresponse.md | 11 + .../operations/createbankaccountrequest.md | 12 + .../operations/createbankaccountresponse.md | 11 + .../operations/createcompanyresponse.md | 12 +- .../createexpensetransactionrequest.md | 8 +- ...tereimbursableexpensetransactionrequest.md | 8 +- .../createtransfertransactionrequest.md | 10 +- .../createtransfertransactionresponse.md | 12 +- .../models/operations/getcompanyresponse.md | 12 +- .../getcreatebankaccountsmodelrequest.md | 9 + .../getcreatebankaccountsmodelresponse.md | 11 + .../operations/getdatastatusdatastatuses.md | 52 + .../operations/getdatastatusresponse.md | 12 +- .../models/operations/initiatesyncrequest.md | 9 - .../models/operations/initiatesyncresponse.md | 11 - .../models/operations/listcompaniesrequest.md | 2 +- .../operations/listconnectionsrequest.md | 2 +- .../models/operations/listcustomersrequest.md | 2 +- .../operations/listpulloperationsrequest.md | 2 +- .../operations/listpushoperationsrequest.md | 2 +- .../models/operations/listsuppliersrequest.md | 2 +- .../docs/pkg/models/operations/option.md | 4 +- .../operations/updatecompanyresponse.md | 12 +- .../operations/updatecustomerrequest.md | 2 +- ...tereimbursableexpensetransactionrequest.md | 10 +- .../operations/updatesupplierrequest.md | 2 +- .../pkg/models/shared/accountingaccount.md | 2 +- .../models/shared/accountingbankaccount.md | 43 + .../pkg/models/shared/accountingcustomer.md | 4 +- .../pkg/models/shared/accountingsupplier.md | 4 +- .../pkg/models/shared/accountmappinginfo.md | 7 +- .../pkg/models/shared/accountprototype.md | 2 +- .../docs/pkg/models/shared/accountref.md | 11 - .../pkg/models/shared/accountreference.md | 10 + .../shared/adjustmenttransactionline.md | 12 + .../shared/adjustmenttransactionrequest.md | 13 + ...ms.md => adjustmenttransactionresponse.md} | 4 +- .../docs/pkg/models/shared/bankaccount.md | 39 +- .../pkg/models/shared/bankaccountdetails.md | 8 + .../pkg/models/shared/bankaccountstatus.md | 13 + .../docs/pkg/models/shared/bankaccounttype.md | 14 + .../models/shared/clientratelimitwebhook.md | 11 + .../shared/clientratelimitwebhookpayload.md | 10 + .../docs/pkg/models/shared/codatfile.md | 2 +- .../docs/pkg/models/shared/company.md | 5 +- .../pkg/models/shared/companyconfiguration.md | 10 +- .../pkg/models/shared/companyrequestbody.md | 2 +- .../pkg/models/shared/companysyncstatus.md | 2 +- .../docs/pkg/models/shared/connection.md | 2 +- .../shared/createbankaccountresponse.md | 21 + ...reatebankaccountresponsebankaccounttype.md | 14 + .../pkg/models/shared/createexpenserequest.md | 8 - .../models/shared/createexpenseresponse.md | 2 +- .../createreimbursableexpenserequest.md | 8 - .../models/shared/createtransferrequest.md | 11 - .../docs/pkg/models/shared/customer.md | 4 +- .../docs/pkg/models/shared/customerdetails.md | 2 +- .../docs/pkg/models/shared/data.md | 9 - .../pkg/models/shared/dataconnectionerror.md | 8 +- .../docs/pkg/models/shared/datasetstatus.md | 30 + .../docs/pkg/models/shared/datastatus.md | 2 +- .../docs/pkg/models/shared/errorstatus.md | 11 + .../{contactref.md => expensecontactref.md} | 4 +- .../pkg/models/shared/expensetransaction.md | 26 +- .../models/shared/expensetransactionline.md | 17 +- .../models/shared/expensetransactiontype.md | 16 +- .../docs/pkg/models/shared/from.md | 9 + .../docs/pkg/models/shared/initiatesync.md | 8 - .../docs/pkg/models/shared/invoiceto.md | 10 +- .../pkg/models/shared/invoicetodatatype.md | 10 - .../docs/pkg/models/shared/invoicetotype.md | 10 + .../docs/pkg/models/shared/itemref.md | 8 + .../docs/pkg/models/shared/pulloperation.md | 4 +- .../shared/reimbursableexpensetransaction.md | 24 +- .../reimbursableexpensetransactionline.md | 18 +- ...eference.md => reimbursementcontactref.md} | 4 +- .../docs/pkg/models/shared/status.md | 4 +- .../pkg/models/shared/supplementaldata.md | 8 +- .../docs/pkg/models/shared/supplier.md | 4 +- .../docs/pkg/models/shared/supplierdetails.md | 2 +- .../docs/pkg/models/shared/syncinitiated.md | 8 - .../pkg/models/shared/syncstartedwebhook.md | 17 - .../docs/pkg/models/shared/tags.md | 9 + .../pkg/models/shared/taxratemappinginfo.md | 16 +- ...taxratemappinginfovalidtransactiontypes.md | 15 - .../docs/pkg/models/shared/to.md | 9 + .../shared/trackingcategorymappinginfo.md | 13 +- .../trackingrefadjustmenttransaction.md | 9 + ...rackingrefadjustmenttransactiondatatype.md | 12 + .../docs/pkg/models/shared/transferdetails.md | 9 - .../shared/transfertransactionrequest.md | 11 + ...nsfertransactionrequestaccountreference.md | 10 + ...onse.md => transfertransactionresponse.md} | 2 +- ...pdatecustomerresponseaccountingcustomer.md | 4 +- .../pkg/models/shared/updateexpenserequest.md | 22 +- .../models/shared/updateexpenserequesttype.md | 13 + ...tereimbursableexpensetransactionrequest.md | 15 + ...pdatesupplierresponseaccountingsupplier.md | 4 +- .../models/shared/validtransactiontypes.md | 16 +- .../clientratelimitreachedresponse1.md | 10 + ...se.md => clientratelimitresetresponse1.md} | 2 +- .../docs/sdks/accounts/README.md | 26 +- .../docs/sdks/adjustments/README.md | 118 + .../docs/sdks/attachments/README.md | 15 +- .../docs/sdks/bankaccounts/README.md | 147 + .../docs/sdks/codatsyncexpenses/README.md | 30 +- .../docs/sdks/companies/README.md | 50 +- .../docs/sdks/configuration/README.md | 74 +- .../docs/sdks/connections/README.md | 45 +- .../docs/sdks/customers/README.md | 64 +- .../docs/sdks/expenses/README.md | 74 +- .../docs/sdks/managedata/README.md | 33 +- .../docs/sdks/mappingoptions/README.md | 63 + .../docs/sdks/pushoperations/README.md | 14 +- .../docs/sdks/reimbursements/README.md | 57 +- .../docs/sdks/suppliers/README.md | 81 +- sync-for-expenses/docs/sdks/sync/README.md | 76 +- .../docs/sdks/transactionstatus/README.md | 13 +- .../docs/sdks/transfers/README.md | 38 +- sync-for-expenses/expenses.go | 334 ++- sync-for-expenses/internal/hooks/hooks.go | 2 +- sync-for-expenses/managedata.go | 724 +++-- sync-for-expenses/mappingoptions.go | 267 ++ .../pkg/models/operations/createaccount.go | 2 +- .../operations/createadjustmenttransaction.go | 67 + .../models/operations/createbankaccount.go | 106 + .../pkg/models/operations/createcompany.go | 2 +- .../pkg/models/operations/createconnection.go | 2 +- .../pkg/models/operations/createcustomer.go | 2 +- .../operations/createexpensetransaction.go | 8 +- .../createpartnerexpenseconnection.go | 2 +- .../createreimbursableexpensetransaction.go | 8 +- .../pkg/models/operations/createsupplier.go | 2 +- .../operations/createtransfertransaction.go | 26 +- .../pkg/models/operations/deletecompany.go | 2 +- .../pkg/models/operations/deleteconnection.go | 2 +- .../pkg/models/operations/getcompany.go | 2 +- .../operations/getcompanyconfiguration.go | 2 +- .../pkg/models/operations/getconnection.go | 2 +- .../operations/getcreatebankaccountsmodel.go | 68 + .../getcreatechartofaccountsmodel.go | 2 +- .../pkg/models/operations/getcustomer.go | 2 +- .../pkg/models/operations/getdatastatus.go | 397 ++- .../operations/getlastsuccessfulsync.go | 2 +- .../pkg/models/operations/getlatestsync.go | 2 +- .../models/operations/getmappingoptions.go | 2 +- .../pkg/models/operations/getpulloperation.go | 2 +- .../pkg/models/operations/getpushoperation.go | 2 +- .../pkg/models/operations/getsupplier.go | 2 +- .../pkg/models/operations/getsyncbyid.go | 2 +- .../models/operations/getsynctransaction.go | 2 +- .../pkg/models/operations/initiatesync.go | 67 - .../pkg/models/operations/listcompanies.go | 2 +- .../pkg/models/operations/listconnections.go | 2 +- .../pkg/models/operations/listcustomers.go | 2 +- .../models/operations/listpulloperations.go | 2 +- .../models/operations/listpushoperations.go | 2 +- .../pkg/models/operations/listsuppliers.go | 2 +- .../pkg/models/operations/listsyncs.go | 2 +- .../models/operations/listsynctransactions.go | 2 +- .../pkg/models/operations/options.go | 38 +- .../models/operations/refreshalldatatypes.go | 2 +- .../pkg/models/operations/refreshdatatype.go | 2 +- .../operations/setcompanyconfiguration.go | 2 +- .../pkg/models/operations/unlinkconnection.go | 2 +- .../pkg/models/operations/updatecompany.go | 2 +- .../pkg/models/operations/updatecustomer.go | 4 +- .../operations/updateexpensetransaction.go | 2 +- .../updatereimbursableexpensetransaction.go | 8 +- .../pkg/models/operations/updatesupplier.go | 4 +- .../operations/uploadexpenseattachment.go | 2 +- .../pkg/models/sdkerrors/errormessage.go | 2 +- .../pkg/models/sdkerrors/sdkerror.go | 2 +- .../models/shared/accountingaddresstype.go | 3 +- .../pkg/models/shared/accountmappinginfo.go | 77 +- .../pkg/models/shared/accountprototype.go | 4 +- .../pkg/models/shared/accountref.go | 25 - .../pkg/models/shared/accountstatus.go | 3 +- .../pkg/models/shared/accounttype.go | 3 +- .../shared/adjustmenttransactionline.go | 65 + .../shared/adjustmenttransactionrequest.go | 125 + .../shared/adjustmenttransactionresponse.go | 15 + .../pkg/models/shared/attachment.go | 2 +- .../pkg/models/shared/attachmentupload.go | 2 +- .../pkg/models/shared/bankaccount.go | 232 +- .../pkg/models/shared/bankaccountdetails.go | 15 + .../pkg/models/shared/bankaccountstatus.go | 41 + .../shared/clientratelimitreachedwebhook.go | 2 +- .../clientratelimitreachedwebhookdata.go | 2 +- .../shared/clientratelimitresetwebhook.go | 2 +- .../shared/clientratelimitresetwebhookdata.go | 2 +- .../models/shared/clientratelimitwebhook.go | 59 + .../shared/clientratelimitwebhookpayload.go | 51 + .../pkg/models/shared/codatfile.go | 9 +- .../pkg/models/shared/companies.go | 2 +- .../pkg/models/shared/company.go | 41 +- .../pkg/models/shared/companyconfiguration.go | 12 +- .../pkg/models/shared/companyrequestbody.go | 18 +- .../pkg/models/shared/companysyncstatus.go | 2 +- .../pkg/models/shared/connection.go | 7 +- .../pkg/models/shared/connections.go | 2 +- .../pkg/models/shared/contact.go | 2 +- .../models/shared/createaccountresponse.go | 4 +- .../shared/createbankaccountresponse.go | 411 +++ .../models/shared/createcustomerresponse.go | 6 +- .../pkg/models/shared/createexpenserequest.go | 14 - .../models/shared/createexpenseresponse.go | 10 +- .../createreimbursableexpenserequest.go | 14 - .../createreimbursableexpenseresponse.go | 2 +- .../models/shared/createsupplierresponse.go | 6 +- .../models/shared/createtransferrequest.go | 39 - .../models/shared/createtransferresponse.go | 15 - .../pkg/models/shared/customer.go | 6 +- .../pkg/models/shared/customerdetails.go | 4 +- .../pkg/models/shared/customers.go | 2 +- .../pkg/models/shared/customerstatus.go | 3 +- .../pkg/models/shared/dataconnectionerror.go | 76 +- .../pkg/models/shared/dataconnectionstatus.go | 3 +- .../pkg/models/shared/datastatus.go | 11 +- .../pkg/models/shared/datatype.go | 3 +- .../pkg/models/shared/errorvalidation.go | 2 +- .../pkg/models/shared/errorvalidationitem.go | 2 +- .../{contactref.go => expensecontactref.go} | 21 +- .../pkg/models/shared/expensetransaction.go | 43 +- .../models/shared/expensetransactionline.go | 18 +- .../pkg/models/shared/groupitems.go | 15 - sync-for-expenses/pkg/models/shared/halref.go | 2 +- .../pkg/models/shared/initiatesync.go | 14 - .../pkg/models/shared/integrationtype.go | 3 +- .../pkg/models/shared/invoiceto.go | 33 +- .../pkg/models/shared/itemref.go | 15 + sync-for-expenses/pkg/models/shared/items.go | 2 +- sync-for-expenses/pkg/models/shared/links.go | 2 +- .../pkg/models/shared/mappingoptions.go | 2 +- .../pkg/models/shared/metadata.go | 2 +- .../pkg/models/shared/phonenumbertype.go | 3 +- .../pkg/models/shared/pulloperation.go | 73 +- .../pkg/models/shared/pulloperations.go | 2 +- .../pkg/models/shared/pushchangetype.go | 3 +- .../pkg/models/shared/pushfieldvalidation.go | 2 +- .../pkg/models/shared/pushoperation.go | 2 +- .../pkg/models/shared/pushoperationchange.go | 2 +- .../pkg/models/shared/pushoperationref.go | 2 +- .../pkg/models/shared/pushoperations.go | 2 +- .../pkg/models/shared/pushoperationstatus.go | 3 +- .../pkg/models/shared/pushoption.go | 2 +- .../pkg/models/shared/pushoptionchoice.go | 2 +- .../pkg/models/shared/pushoptionproperty.go | 2 +- .../pkg/models/shared/pushoptiontype.go | 3 +- .../pkg/models/shared/pushvalidationinfo.go | 2 +- .../pkg/models/shared/recordref.go | 2 +- .../shared/reimbursableexpensetransaction.go | 71 +- .../reimbursableexpensetransactionline.go | 27 +- .../models/shared/reimbursementcontactref.go | 15 + .../pkg/models/shared/schemadatatype.go | 3 +- .../pkg/models/shared/security.go | 2 +- sync-for-expenses/pkg/models/shared/status.go | 92 + .../pkg/models/shared/supplementaldata.go | 8 +- .../pkg/models/shared/supplier.go | 6 +- .../pkg/models/shared/supplierdetails.go | 4 +- .../pkg/models/shared/suppliers.go | 2 +- .../pkg/models/shared/supplierstatus.go | 3 +- .../pkg/models/shared/synccompletewebhook.go | 2 +- .../models/shared/synccompletewebhookdata.go | 2 +- .../pkg/models/shared/syncfailedwebhook.go | 2 +- .../models/shared/syncfailedwebhookdata.go | 2 +- .../pkg/models/shared/syncinitiated.go | 15 - .../pkg/models/shared/syncstartedwebhook.go | 101 - .../pkg/models/shared/taxratemappinginfo.go | 57 +- .../shared/trackingcategorymappinginfo.go | 29 +- .../pkg/models/shared/trackingref.go | 3 +- .../trackingrefadjustmenttransaction.go | 71 + .../pkg/models/shared/transaction.go | 2 +- .../pkg/models/shared/transactions.go | 2 +- .../pkg/models/shared/transactionstatus.go | 3 +- .../pkg/models/shared/transferdetails.go | 40 - .../shared/transfertransactionrequest.go | 134 + .../shared/transfertransactionresponse.go | 15 + .../models/shared/updatecustomerresponse.go | 6 +- .../pkg/models/shared/updateexpenserequest.go | 62 +- .../models/shared/updateexpenseresponse.go | 2 +- ...tereimbursableexpensetransactionrequest.go | 160 ++ .../models/shared/updatesupplierresponse.go | 6 +- .../pkg/models/shared/validation.go | 2 +- .../pkg/models/shared/validationitem.go | 2 +- .../models/shared/validtransactiontypes.go | 40 + .../models/webhooks/clientratelimitreached.go | 10 +- .../models/webhooks/clientratelimitreset.go | 10 +- .../pkg/models/webhooks/synccomplete.go | 2 +- .../pkg/models/webhooks/syncfailed.go | 2 +- .../pkg/models/webhooks/syncstarted.go | 37 - sync-for-expenses/pkg/retry/config.go | 16 + sync-for-expenses/pkg/types/bigint.go | 2 +- sync-for-expenses/pkg/types/date.go | 2 +- sync-for-expenses/pkg/types/datetime.go | 2 +- sync-for-expenses/pkg/types/decimal.go | 2 +- sync-for-expenses/pkg/types/pointers.go | 3 +- sync-for-expenses/pkg/utils/contenttype.go | 6 +- sync-for-expenses/pkg/utils/form.go | 2 +- sync-for-expenses/pkg/utils/headers.go | 5 +- sync-for-expenses/pkg/utils/json.go | 113 +- sync-for-expenses/pkg/utils/pathparams.go | 5 +- sync-for-expenses/pkg/utils/queryparams.go | 131 +- sync-for-expenses/pkg/utils/requestbody.go | 29 +- sync-for-expenses/pkg/utils/retries.go | 23 +- sync-for-expenses/pkg/utils/security.go | 23 +- sync-for-expenses/pkg/utils/utils.go | 9 +- sync-for-expenses/pushoperations.go | 295 +- sync-for-expenses/reimbursements.go | 323 ++- sync-for-expenses/suppliers.go | 585 +++- sync-for-expenses/sync.go | 744 +++-- sync-for-expenses/transactionstatus.go | 295 +- sync-for-expenses/transfers.go | 166 +- 331 files changed, 12697 insertions(+), 3809 deletions(-) create mode 100644 sync-for-expenses/CONTRIBUTING.md create mode 100644 sync-for-expenses/adjustments.go create mode 100644 sync-for-expenses/bankaccounts.go create mode 100644 sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionrequest.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionresponse.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/createbankaccountrequest.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/createbankaccountresponse.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelrequest.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelresponse.md create mode 100644 sync-for-expenses/docs/pkg/models/operations/getdatastatusdatastatuses.md delete mode 100644 sync-for-expenses/docs/pkg/models/operations/initiatesyncrequest.md delete mode 100644 sync-for-expenses/docs/pkg/models/operations/initiatesyncresponse.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/accountingbankaccount.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/accountref.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/accountreference.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionline.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionrequest.md rename sync-for-expenses/docs/pkg/models/shared/{groupitems.md => adjustmenttransactionresponse.md} (74%) create mode 100644 sync-for-expenses/docs/pkg/models/shared/bankaccountdetails.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/bankaccountstatus.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/bankaccounttype.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhook.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhookpayload.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/createbankaccountresponse.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/createbankaccountresponsebankaccounttype.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/createexpenserequest.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/createreimbursableexpenserequest.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/createtransferrequest.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/data.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/datasetstatus.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/errorstatus.md rename sync-for-expenses/docs/pkg/models/shared/{contactref.md => expensecontactref.md} (86%) create mode 100644 sync-for-expenses/docs/pkg/models/shared/from.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/initiatesync.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/invoicetodatatype.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/invoicetotype.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/itemref.md rename sync-for-expenses/docs/pkg/models/shared/{expensetransactionbankaccountreference.md => reimbursementcontactref.md} (63%) delete mode 100644 sync-for-expenses/docs/pkg/models/shared/syncinitiated.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/syncstartedwebhook.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/tags.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/taxratemappinginfovalidtransactiontypes.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/to.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransaction.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransactiondatatype.md delete mode 100644 sync-for-expenses/docs/pkg/models/shared/transferdetails.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/transfertransactionrequest.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/transfertransactionrequestaccountreference.md rename sync-for-expenses/docs/pkg/models/shared/{createtransferresponse.md => transfertransactionresponse.md} (95%) create mode 100644 sync-for-expenses/docs/pkg/models/shared/updateexpenserequesttype.md create mode 100644 sync-for-expenses/docs/pkg/models/shared/updatereimbursableexpensetransactionrequest.md create mode 100644 sync-for-expenses/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md rename sync-for-expenses/docs/pkg/models/webhooks/{syncstartedresponse.md => clientratelimitresetresponse1.md} (97%) create mode 100644 sync-for-expenses/docs/sdks/adjustments/README.md create mode 100644 sync-for-expenses/docs/sdks/bankaccounts/README.md create mode 100644 sync-for-expenses/docs/sdks/mappingoptions/README.md create mode 100644 sync-for-expenses/mappingoptions.go create mode 100644 sync-for-expenses/pkg/models/operations/createadjustmenttransaction.go create mode 100644 sync-for-expenses/pkg/models/operations/createbankaccount.go create mode 100644 sync-for-expenses/pkg/models/operations/getcreatebankaccountsmodel.go delete mode 100644 sync-for-expenses/pkg/models/operations/initiatesync.go delete mode 100644 sync-for-expenses/pkg/models/shared/accountref.go create mode 100644 sync-for-expenses/pkg/models/shared/adjustmenttransactionline.go create mode 100644 sync-for-expenses/pkg/models/shared/adjustmenttransactionrequest.go create mode 100644 sync-for-expenses/pkg/models/shared/adjustmenttransactionresponse.go create mode 100644 sync-for-expenses/pkg/models/shared/bankaccountdetails.go create mode 100644 sync-for-expenses/pkg/models/shared/bankaccountstatus.go create mode 100644 sync-for-expenses/pkg/models/shared/clientratelimitwebhook.go create mode 100644 sync-for-expenses/pkg/models/shared/clientratelimitwebhookpayload.go create mode 100644 sync-for-expenses/pkg/models/shared/createbankaccountresponse.go delete mode 100644 sync-for-expenses/pkg/models/shared/createexpenserequest.go delete mode 100644 sync-for-expenses/pkg/models/shared/createreimbursableexpenserequest.go delete mode 100644 sync-for-expenses/pkg/models/shared/createtransferrequest.go delete mode 100644 sync-for-expenses/pkg/models/shared/createtransferresponse.go rename sync-for-expenses/pkg/models/shared/{contactref.go => expensecontactref.go} (62%) delete mode 100644 sync-for-expenses/pkg/models/shared/groupitems.go delete mode 100644 sync-for-expenses/pkg/models/shared/initiatesync.go create mode 100644 sync-for-expenses/pkg/models/shared/itemref.go create mode 100644 sync-for-expenses/pkg/models/shared/reimbursementcontactref.go create mode 100644 sync-for-expenses/pkg/models/shared/status.go delete mode 100644 sync-for-expenses/pkg/models/shared/syncinitiated.go delete mode 100644 sync-for-expenses/pkg/models/shared/syncstartedwebhook.go create mode 100644 sync-for-expenses/pkg/models/shared/trackingrefadjustmenttransaction.go delete mode 100644 sync-for-expenses/pkg/models/shared/transferdetails.go create mode 100644 sync-for-expenses/pkg/models/shared/transfertransactionrequest.go create mode 100644 sync-for-expenses/pkg/models/shared/transfertransactionresponse.go create mode 100644 sync-for-expenses/pkg/models/shared/updatereimbursableexpensetransactionrequest.go create mode 100644 sync-for-expenses/pkg/models/shared/validtransactiontypes.go delete mode 100644 sync-for-expenses/pkg/models/webhooks/syncstarted.go create mode 100644 sync-for-expenses/pkg/retry/config.go diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 36b18edb3..e73bd2696 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -77,6 +77,13 @@ sources: tags: - latest - main + sync-for-expenses-source: + sourceNamespace: sync-for-expenses-source + sourceRevisionDigest: sha256:20f3897e882714662e3768287cdf2248e93501b8666560ffc0f1f629208c7a9f + sourceBlobDigest: sha256:7f399328e7bf537a3e5ee884667234673d34c00e889182df4e2b0500bb91dcfd + tags: + - latest + - main targets: accounting-library: source: accounting-source @@ -133,6 +140,11 @@ targets: sourceNamespace: sync-for-commerce-version-1-source sourceRevisionDigest: sha256:09d7bb14b3736b3157a46766c502598e3dde7fb338652eaaeca6fb3427b32630 sourceBlobDigest: sha256:c00e3840ee75be94b232308b1e35ba628a278cf0eead16d5cfac18d91d5f144c + sync-for-expenses-library: + source: sync-for-expenses-source + sourceNamespace: sync-for-expenses-source + sourceRevisionDigest: sha256:20f3897e882714662e3768287cdf2248e93501b8666560ffc0f1f629208c7a9f + sourceBlobDigest: sha256:7f399328e7bf537a3e5ee884667234673d34c00e889182df4e2b0500bb91dcfd workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -195,6 +207,8 @@ workflow: sync-for-expenses-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source sync-for-expenses-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses-v1.yaml diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 71fff25a7..63825bc92 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -59,6 +59,8 @@ sources: sync-for-expenses-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses.yaml + registry: + location: registry.speakeasyapi.dev/codat/codat/sync-for-expenses-source sync-for-expenses-version-1-source: inputs: - location: https://raw.githubusercontent.com/codatio/oas/main/yaml/Codat-Sync-Expenses-v1.yaml diff --git a/sync-for-expenses/.speakeasy/gen.lock b/sync-for-expenses/.speakeasy/gen.lock index 0293cedf4..cc7a5c95c 100755 --- a/sync-for-expenses/.speakeasy/gen.lock +++ b/sync-for-expenses/.speakeasy/gen.lock @@ -1,446 +1,2268 @@ lockVersion: 2.0.0 id: e2492906-821b-42bf-87aa-d2e0a13ba8fa management: - docChecksum: b84c137b488c9aa6b56fa6e53acdf2cc + docChecksum: 05894ed5d629c7c3f5209e037a7061bc docVersion: prealpha - speakeasyVersion: 1.244.2 - generationVersion: 2.301.3 - releaseVersion: 4.2.1 - configChecksum: e0045777797ea423fc74f829f4b72247 + speakeasyVersion: 1.396.9 + generationVersion: 2.415.7 + releaseVersion: 4.3.0 + configChecksum: a533c11614feef69b515a47678c79b0f repoURL: https://github.com/codatio/client-sdk-go.git repoSubDirectory: sync-for-expenses installationURL: https://github.com/codatio/client-sdk-go/sync-for-expenses published: true features: go: - constsAndDefaults: 0.1.4 - core: 3.4.6 + additionalDependencies: 0.1.0 + constsAndDefaults: 0.1.6 + core: 3.5.8 decimal: 0.1.0 + defaultEnabledRetries: 0.2.0 deprecations: 2.81.1 + envVarSecurityUsage: 0.3.1 examples: 2.81.3 - globalSecurity: 2.82.9 + globalSecurity: 2.82.10 + globalSecurityCallbacks: 0.1.0 + globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.2 inputOutputModels: 2.83.0 + intellisenseMarkdownSupport: 0.1.0 nameOverrides: 2.81.2 - responseFormat: 0.1.0 - retries: 2.82.2 + nullables: 0.1.0 + responseFormat: 0.1.2 + retries: 2.83.0 + sdkHooks: 0.1.0 + serverEventsSentinels: 0.1.0 + uploadStreams: 0.1.0 webhooks: 1.0.0 generatedFiles: - - companies.go - - connections.go - - accounts.go - - customers.go - - suppliers.go - - managedata.go - - pushoperations.go - - configuration.go - - expenses.go - - reimbursements.go - - sync.go - - transactionstatus.go - - attachments.go - - transfers.go - - codatsyncexpenses.go - - go.mod - - pkg/models/sdkerrors/sdkerror.go - - pkg/types/bigint.go - - pkg/types/date.go - - pkg/types/datetime.go - - pkg/types/decimal.go - - pkg/types/pointers.go - - pkg/utils/contenttype.go - - pkg/utils/form.go - - pkg/utils/headers.go - - pkg/utils/json.go - - pkg/utils/pathparams.go - - pkg/utils/queryparams.go - - pkg/utils/requestbody.go - - pkg/utils/retries.go - - pkg/utils/security.go - - pkg/utils/utils.go + - .gitattributes + - /pkg/models/operations/createaccount.go + - /pkg/models/operations/createadjustmenttransaction.go + - /pkg/models/operations/createbankaccount.go - /pkg/models/operations/createcompany.go - - /pkg/models/operations/deletecompany.go - - /pkg/models/operations/getcompany.go - - /pkg/models/operations/listcompanies.go - - /pkg/models/operations/updatecompany.go - /pkg/models/operations/createconnection.go + - /pkg/models/operations/createcustomer.go + - /pkg/models/operations/createexpensetransaction.go - /pkg/models/operations/createpartnerexpenseconnection.go + - /pkg/models/operations/createreimbursableexpensetransaction.go + - /pkg/models/operations/createsupplier.go + - /pkg/models/operations/createtransfertransaction.go + - /pkg/models/operations/deletecompany.go - /pkg/models/operations/deleteconnection.go + - /pkg/models/operations/getcompany.go + - /pkg/models/operations/getcompanyconfiguration.go - /pkg/models/operations/getconnection.go - - /pkg/models/operations/listconnections.go - - /pkg/models/operations/unlinkconnection.go - - /pkg/models/operations/createaccount.go + - /pkg/models/operations/getcreatebankaccountsmodel.go - /pkg/models/operations/getcreatechartofaccountsmodel.go - - /pkg/models/operations/createcustomer.go - /pkg/models/operations/getcustomer.go - - /pkg/models/operations/listcustomers.go - - /pkg/models/operations/updatecustomer.go - - /pkg/models/operations/createsupplier.go - - /pkg/models/operations/getsupplier.go - - /pkg/models/operations/listsuppliers.go - - /pkg/models/operations/updatesupplier.go - /pkg/models/operations/getdatastatus.go + - /pkg/models/operations/getlastsuccessfulsync.go + - /pkg/models/operations/getlatestsync.go + - /pkg/models/operations/getmappingoptions.go - /pkg/models/operations/getpulloperation.go + - /pkg/models/operations/getpushoperation.go + - /pkg/models/operations/getsupplier.go + - /pkg/models/operations/getsyncbyid.go + - /pkg/models/operations/getsynctransaction.go + - /pkg/models/operations/listcompanies.go + - /pkg/models/operations/listconnections.go + - /pkg/models/operations/listcustomers.go - /pkg/models/operations/listpulloperations.go + - /pkg/models/operations/listpushoperations.go + - /pkg/models/operations/listsuppliers.go + - /pkg/models/operations/listsyncs.go + - /pkg/models/operations/listsynctransactions.go - /pkg/models/operations/refreshalldatatypes.go - /pkg/models/operations/refreshdatatype.go - - /pkg/models/operations/getpushoperation.go - - /pkg/models/operations/listpushoperations.go - - /pkg/models/operations/getcompanyconfiguration.go - - /pkg/models/operations/getmappingoptions.go - /pkg/models/operations/setcompanyconfiguration.go - - /pkg/models/operations/createexpensetransaction.go + - /pkg/models/operations/unlinkconnection.go + - /pkg/models/operations/updatecompany.go + - /pkg/models/operations/updatecustomer.go - /pkg/models/operations/updateexpensetransaction.go - - /pkg/models/operations/createreimbursableexpensetransaction.go - /pkg/models/operations/updatereimbursableexpensetransaction.go - - /pkg/models/operations/getsyncbyid.go - - /pkg/models/operations/getlastsuccessfulsync.go - - /pkg/models/operations/getlatestsync.go - - /pkg/models/operations/initiatesync.go - - /pkg/models/operations/listsyncs.go - - /pkg/models/operations/getsynctransaction.go - - /pkg/models/operations/listsynctransactions.go + - /pkg/models/operations/updatesupplier.go - /pkg/models/operations/uploadexpenseattachment.go - - /pkg/models/operations/createtransfertransaction.go + - /pkg/models/sdkerrors/errormessage.go + - /pkg/models/shared/accountingaddresstype.go + - /pkg/models/shared/accountmappinginfo.go + - /pkg/models/shared/accountprototype.go + - /pkg/models/shared/accountstatus.go + - /pkg/models/shared/accounttype.go + - /pkg/models/shared/adjustmenttransactionline.go + - /pkg/models/shared/adjustmenttransactionrequest.go + - /pkg/models/shared/adjustmenttransactionresponse.go + - /pkg/models/shared/attachment.go + - /pkg/models/shared/attachmentupload.go + - /pkg/models/shared/bankaccount.go + - /pkg/models/shared/bankaccountdetails.go + - /pkg/models/shared/bankaccountstatus.go + - /pkg/models/shared/clientratelimitreachedwebhook.go + - /pkg/models/shared/clientratelimitreachedwebhookdata.go + - /pkg/models/shared/clientratelimitresetwebhook.go + - /pkg/models/shared/clientratelimitresetwebhookdata.go + - /pkg/models/shared/clientratelimitwebhook.go + - /pkg/models/shared/clientratelimitwebhookpayload.go + - /pkg/models/shared/codatfile.go + - /pkg/models/shared/companies.go - /pkg/models/shared/company.go - - /pkg/models/shared/connection.go - - /pkg/models/shared/dataconnectionstatus.go - - /pkg/models/shared/dataconnectionerror.go - - /pkg/models/shared/errorvalidation.go - - /pkg/models/shared/errorvalidationitem.go + - /pkg/models/shared/companyconfiguration.go - /pkg/models/shared/companyrequestbody.go - - /pkg/models/shared/groupitems.go - - /pkg/models/shared/companies.go - - /pkg/models/shared/links.go - - /pkg/models/shared/halref.go + - /pkg/models/shared/companysyncstatus.go + - /pkg/models/shared/connection.go - /pkg/models/shared/connections.go + - /pkg/models/shared/contact.go - /pkg/models/shared/createaccountresponse.go - - /pkg/models/shared/validation.go - - /pkg/models/shared/validationitem.go - - /pkg/models/shared/pushoperationstatus.go - - /pkg/models/shared/datatype.go - - /pkg/models/shared/accounttype.go - - /pkg/models/shared/supplementaldata.go - - /pkg/models/shared/accountstatus.go - - /pkg/models/shared/pushoperationchange.go - - /pkg/models/shared/pushchangetype.go - - /pkg/models/shared/pushoperationref.go - - /pkg/models/shared/accountprototype.go - - /pkg/models/shared/pushoption.go - - /pkg/models/shared/pushvalidationinfo.go - - /pkg/models/shared/pushfieldvalidation.go - - /pkg/models/shared/pushoptiontype.go - - /pkg/models/shared/pushoptionproperty.go - - /pkg/models/shared/pushoptionchoice.go + - /pkg/models/shared/createbankaccountresponse.go - /pkg/models/shared/createcustomerresponse.go - - /pkg/models/shared/customerstatus.go - - /pkg/models/shared/metadata.go - - /pkg/models/shared/contact.go - - /pkg/models/shared/phonenumbertype.go - - /pkg/models/shared/items.go - - /pkg/models/shared/accountingaddresstype.go + - /pkg/models/shared/createexpenseresponse.go + - /pkg/models/shared/createreimbursableexpenseresponse.go + - /pkg/models/shared/createsupplierresponse.go - /pkg/models/shared/customer.go + - /pkg/models/shared/customerdetails.go - /pkg/models/shared/customers.go - - /pkg/models/shared/updatecustomerresponse.go - - /pkg/models/shared/createsupplierresponse.go - - /pkg/models/shared/supplierstatus.go - - /pkg/models/shared/supplier.go - - /pkg/models/shared/suppliers.go - - /pkg/models/shared/updatesupplierresponse.go + - /pkg/models/shared/customerstatus.go + - /pkg/models/shared/dataconnectionerror.go + - /pkg/models/shared/dataconnectionstatus.go - /pkg/models/shared/datastatus.go + - /pkg/models/shared/datatype.go + - /pkg/models/shared/errorvalidation.go + - /pkg/models/shared/errorvalidationitem.go + - /pkg/models/shared/expensecontactref.go + - /pkg/models/shared/expensetransaction.go + - /pkg/models/shared/expensetransactionline.go + - /pkg/models/shared/halref.go + - /pkg/models/shared/integrationtype.go + - /pkg/models/shared/invoiceto.go + - /pkg/models/shared/itemref.go + - /pkg/models/shared/items.go + - /pkg/models/shared/links.go + - /pkg/models/shared/mappingoptions.go + - /pkg/models/shared/metadata.go + - /pkg/models/shared/phonenumbertype.go - /pkg/models/shared/pulloperation.go - /pkg/models/shared/pulloperations.go - - /pkg/models/shared/schemadatatype.go + - /pkg/models/shared/pushchangetype.go + - /pkg/models/shared/pushfieldvalidation.go - /pkg/models/shared/pushoperation.go + - /pkg/models/shared/pushoperationchange.go + - /pkg/models/shared/pushoperationref.go - /pkg/models/shared/pushoperations.go - - /pkg/models/shared/companyconfiguration.go - - /pkg/models/shared/supplierdetails.go - - /pkg/models/shared/customerdetails.go - - /pkg/models/shared/bankaccount.go - - /pkg/models/shared/mappingoptions.go - - /pkg/models/shared/trackingcategorymappinginfo.go - - /pkg/models/shared/taxratemappinginfo.go - - /pkg/models/shared/accountmappinginfo.go - - /pkg/models/shared/createexpenseresponse.go - - /pkg/models/shared/createexpenserequest.go - - /pkg/models/shared/expensetransaction.go - - /pkg/models/shared/expensetransactionline.go - - /pkg/models/shared/trackingref.go + - /pkg/models/shared/pushoperationstatus.go + - /pkg/models/shared/pushoption.go + - /pkg/models/shared/pushoptionchoice.go + - /pkg/models/shared/pushoptionproperty.go + - /pkg/models/shared/pushoptiontype.go + - /pkg/models/shared/pushvalidationinfo.go - /pkg/models/shared/recordref.go - - /pkg/models/shared/invoiceto.go - - /pkg/models/shared/contactref.go - - /pkg/models/shared/updateexpenseresponse.go - - /pkg/models/shared/updateexpenserequest.go - - /pkg/models/shared/createreimbursableexpenseresponse.go - - /pkg/models/shared/createreimbursableexpenserequest.go - /pkg/models/shared/reimbursableexpensetransaction.go - /pkg/models/shared/reimbursableexpensetransactionline.go - - /pkg/models/shared/companysyncstatus.go - - /pkg/models/shared/syncinitiated.go - - /pkg/models/shared/initiatesync.go - - /pkg/models/shared/transaction.go - - /pkg/models/shared/transactionstatus.go - - /pkg/models/shared/integrationtype.go - - /pkg/models/shared/transactions.go - - /pkg/models/shared/attachment.go - - /pkg/models/shared/attachmentupload.go - - /pkg/models/shared/codatfile.go - - /pkg/models/shared/createtransferresponse.go - - /pkg/models/shared/createtransferrequest.go - - /pkg/models/shared/transferdetails.go - - /pkg/models/shared/accountref.go + - /pkg/models/shared/reimbursementcontactref.go + - /pkg/models/shared/schemadatatype.go - /pkg/models/shared/security.go - - /pkg/models/shared/clientratelimitreachedwebhook.go - - /pkg/models/shared/clientratelimitreachedwebhookdata.go - - /pkg/models/shared/clientratelimitresetwebhook.go - - /pkg/models/shared/clientratelimitresetwebhookdata.go + - /pkg/models/shared/status.go + - /pkg/models/shared/supplementaldata.go + - /pkg/models/shared/supplier.go + - /pkg/models/shared/supplierdetails.go + - /pkg/models/shared/suppliers.go + - /pkg/models/shared/supplierstatus.go - /pkg/models/shared/synccompletewebhook.go - /pkg/models/shared/synccompletewebhookdata.go - /pkg/models/shared/syncfailedwebhook.go - /pkg/models/shared/syncfailedwebhookdata.go - - /pkg/models/shared/syncstartedwebhook.go - - /pkg/models/sdkerrors/errormessage.go + - /pkg/models/shared/taxratemappinginfo.go + - /pkg/models/shared/trackingcategorymappinginfo.go + - /pkg/models/shared/trackingref.go + - /pkg/models/shared/trackingrefadjustmenttransaction.go + - /pkg/models/shared/transaction.go + - /pkg/models/shared/transactions.go + - /pkg/models/shared/transactionstatus.go + - /pkg/models/shared/transfertransactionrequest.go + - /pkg/models/shared/transfertransactionresponse.go + - /pkg/models/shared/updatecustomerresponse.go + - /pkg/models/shared/updateexpenserequest.go + - /pkg/models/shared/updateexpenseresponse.go + - /pkg/models/shared/updatereimbursableexpensetransactionrequest.go + - /pkg/models/shared/updatesupplierresponse.go + - /pkg/models/shared/validation.go + - /pkg/models/shared/validationitem.go + - /pkg/models/shared/validtransactiontypes.go - /pkg/models/webhooks/clientratelimitreached.go - /pkg/models/webhooks/clientratelimitreset.go - /pkg/models/webhooks/synccomplete.go - /pkg/models/webhooks/syncfailed.go - - /pkg/models/webhooks/syncstarted.go + - CONTRIBUTING.md + - USAGE.md + - accounts.go + - adjustments.go + - attachments.go + - bankaccounts.go + - codatsyncexpenses.go + - companies.go + - configuration.go + - connections.go + - customers.go + - docs/pkg/models/operations/createaccountrequest.md + - docs/pkg/models/operations/createaccountresponse.md + - docs/pkg/models/operations/createadjustmenttransactionrequest.md + - docs/pkg/models/operations/createadjustmenttransactionresponse.md + - docs/pkg/models/operations/createbankaccountrequest.md + - docs/pkg/models/operations/createbankaccountresponse.md - docs/pkg/models/operations/createcompanyresponse.md - - docs/pkg/models/operations/deletecompanyrequest.md - - docs/pkg/models/operations/deletecompanyresponse.md - - docs/pkg/models/operations/getcompanyrequest.md - - docs/pkg/models/operations/getcompanyresponse.md - - docs/pkg/models/operations/listcompaniesrequest.md - - docs/pkg/models/operations/listcompaniesresponse.md - - docs/pkg/models/operations/updatecompanyrequest.md - - docs/pkg/models/operations/updatecompanyresponse.md - - docs/pkg/models/operations/createconnectionrequestbody.md - docs/pkg/models/operations/createconnectionrequest.md + - docs/pkg/models/operations/createconnectionrequestbody.md - docs/pkg/models/operations/createconnectionresponse.md + - docs/pkg/models/operations/createcustomerrequest.md + - docs/pkg/models/operations/createcustomerresponse.md + - docs/pkg/models/operations/createexpensetransactionrequest.md + - docs/pkg/models/operations/createexpensetransactionresponse.md - docs/pkg/models/operations/createpartnerexpenseconnectionrequest.md - docs/pkg/models/operations/createpartnerexpenseconnectionresponse.md + - docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md + - docs/pkg/models/operations/createreimbursableexpensetransactionresponse.md + - docs/pkg/models/operations/createsupplierrequest.md + - docs/pkg/models/operations/createsupplierresponse.md + - docs/pkg/models/operations/createtransfertransactionrequest.md + - docs/pkg/models/operations/createtransfertransactionresponse.md + - docs/pkg/models/operations/deletecompanyrequest.md + - docs/pkg/models/operations/deletecompanyresponse.md - docs/pkg/models/operations/deleteconnectionrequest.md - docs/pkg/models/operations/deleteconnectionresponse.md + - docs/pkg/models/operations/getcompanyconfigurationrequest.md + - docs/pkg/models/operations/getcompanyconfigurationresponse.md + - docs/pkg/models/operations/getcompanyrequest.md + - docs/pkg/models/operations/getcompanyresponse.md - docs/pkg/models/operations/getconnectionrequest.md - docs/pkg/models/operations/getconnectionresponse.md - - docs/pkg/models/operations/listconnectionsrequest.md - - docs/pkg/models/operations/listconnectionsresponse.md - - docs/pkg/models/operations/unlinkconnectionupdateconnection.md - - docs/pkg/models/operations/unlinkconnectionrequest.md - - docs/pkg/models/operations/unlinkconnectionresponse.md - - docs/pkg/models/operations/createaccountrequest.md - - docs/pkg/models/operations/createaccountresponse.md + - docs/pkg/models/operations/getcreatebankaccountsmodelrequest.md + - docs/pkg/models/operations/getcreatebankaccountsmodelresponse.md - docs/pkg/models/operations/getcreatechartofaccountsmodelrequest.md - docs/pkg/models/operations/getcreatechartofaccountsmodelresponse.md - - docs/pkg/models/operations/createcustomerrequest.md - - docs/pkg/models/operations/createcustomerresponse.md - docs/pkg/models/operations/getcustomerrequest.md - docs/pkg/models/operations/getcustomerresponse.md - - docs/pkg/models/operations/listcustomersrequest.md - - docs/pkg/models/operations/listcustomersresponse.md - - docs/pkg/models/operations/updatecustomerrequest.md - - docs/pkg/models/operations/updatecustomerresponse.md - - docs/pkg/models/operations/createsupplierrequest.md - - docs/pkg/models/operations/createsupplierresponse.md - - docs/pkg/models/operations/getsupplierrequest.md - - docs/pkg/models/operations/getsupplierresponse.md - - docs/pkg/models/operations/listsuppliersrequest.md - - docs/pkg/models/operations/listsuppliersresponse.md - - docs/pkg/models/operations/updatesupplierrequest.md - - docs/pkg/models/operations/updatesupplierresponse.md + - docs/pkg/models/operations/getdatastatusdatastatuses.md - docs/pkg/models/operations/getdatastatusrequest.md - docs/pkg/models/operations/getdatastatusresponse.md + - docs/pkg/models/operations/getlastsuccessfulsyncrequest.md + - docs/pkg/models/operations/getlastsuccessfulsyncresponse.md + - docs/pkg/models/operations/getlatestsyncrequest.md + - docs/pkg/models/operations/getlatestsyncresponse.md + - docs/pkg/models/operations/getmappingoptionsrequest.md + - docs/pkg/models/operations/getmappingoptionsresponse.md - docs/pkg/models/operations/getpulloperationrequest.md - docs/pkg/models/operations/getpulloperationresponse.md + - docs/pkg/models/operations/getpushoperationrequest.md + - docs/pkg/models/operations/getpushoperationresponse.md + - docs/pkg/models/operations/getsupplierrequest.md + - docs/pkg/models/operations/getsupplierresponse.md + - docs/pkg/models/operations/getsyncbyidrequest.md + - docs/pkg/models/operations/getsyncbyidresponse.md + - docs/pkg/models/operations/getsynctransactionrequest.md + - docs/pkg/models/operations/getsynctransactionresponse.md + - docs/pkg/models/operations/listcompaniesrequest.md + - docs/pkg/models/operations/listcompaniesresponse.md + - docs/pkg/models/operations/listconnectionsrequest.md + - docs/pkg/models/operations/listconnectionsresponse.md + - docs/pkg/models/operations/listcustomersrequest.md + - docs/pkg/models/operations/listcustomersresponse.md - docs/pkg/models/operations/listpulloperationsrequest.md - docs/pkg/models/operations/listpulloperationsresponse.md + - docs/pkg/models/operations/listpushoperationsrequest.md + - docs/pkg/models/operations/listpushoperationsresponse.md + - docs/pkg/models/operations/listsuppliersrequest.md + - docs/pkg/models/operations/listsuppliersresponse.md + - docs/pkg/models/operations/listsyncsrequest.md + - docs/pkg/models/operations/listsyncsresponse.md + - docs/pkg/models/operations/listsynctransactionsrequest.md + - docs/pkg/models/operations/listsynctransactionsresponse.md + - docs/pkg/models/operations/option.md - docs/pkg/models/operations/refreshalldatatypesrequest.md - docs/pkg/models/operations/refreshalldatatypesresponse.md - docs/pkg/models/operations/refreshdatatyperequest.md - docs/pkg/models/operations/refreshdatatyperesponse.md - - docs/pkg/models/operations/getpushoperationrequest.md - - docs/pkg/models/operations/getpushoperationresponse.md - - docs/pkg/models/operations/listpushoperationsrequest.md - - docs/pkg/models/operations/listpushoperationsresponse.md - - docs/pkg/models/operations/getcompanyconfigurationrequest.md - - docs/pkg/models/operations/getcompanyconfigurationresponse.md - - docs/pkg/models/operations/getmappingoptionsrequest.md - - docs/pkg/models/operations/getmappingoptionsresponse.md - docs/pkg/models/operations/setcompanyconfigurationrequest.md - docs/pkg/models/operations/setcompanyconfigurationresponse.md - - docs/pkg/models/operations/createexpensetransactionrequest.md - - docs/pkg/models/operations/createexpensetransactionresponse.md + - docs/pkg/models/operations/unlinkconnectionrequest.md + - docs/pkg/models/operations/unlinkconnectionresponse.md + - docs/pkg/models/operations/unlinkconnectionupdateconnection.md + - docs/pkg/models/operations/updatecompanyrequest.md + - docs/pkg/models/operations/updatecompanyresponse.md + - docs/pkg/models/operations/updatecustomerrequest.md + - docs/pkg/models/operations/updatecustomerresponse.md - docs/pkg/models/operations/updateexpensetransactionrequest.md - docs/pkg/models/operations/updateexpensetransactionresponse.md - - docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md - - docs/pkg/models/operations/createreimbursableexpensetransactionresponse.md - docs/pkg/models/operations/updatereimbursableexpensetransactionrequest.md - docs/pkg/models/operations/updatereimbursableexpensetransactionresponse.md - - docs/pkg/models/operations/getsyncbyidrequest.md - - docs/pkg/models/operations/getsyncbyidresponse.md - - docs/pkg/models/operations/getlastsuccessfulsyncrequest.md - - docs/pkg/models/operations/getlastsuccessfulsyncresponse.md - - docs/pkg/models/operations/getlatestsyncrequest.md - - docs/pkg/models/operations/getlatestsyncresponse.md - - docs/pkg/models/operations/initiatesyncrequest.md - - docs/pkg/models/operations/initiatesyncresponse.md - - docs/pkg/models/operations/listsyncsrequest.md - - docs/pkg/models/operations/listsyncsresponse.md - - docs/pkg/models/operations/getsynctransactionrequest.md - - docs/pkg/models/operations/getsynctransactionresponse.md - - docs/pkg/models/operations/listsynctransactionsrequest.md - - docs/pkg/models/operations/listsynctransactionsresponse.md + - docs/pkg/models/operations/updatesupplierrequest.md + - docs/pkg/models/operations/updatesupplierresponse.md - docs/pkg/models/operations/uploadexpenseattachmentrequest.md - docs/pkg/models/operations/uploadexpenseattachmentresponse.md - - docs/pkg/models/operations/createtransfertransactionrequest.md - - docs/pkg/models/operations/createtransfertransactionresponse.md - - docs/pkg/models/shared/groupreference.md + - docs/pkg/models/sdkerrors/errormessage.md + - docs/pkg/models/shared/accountingaccount.md + - docs/pkg/models/shared/accountingaddress.md + - docs/pkg/models/shared/accountingaddresstype.md + - docs/pkg/models/shared/accountingbankaccount.md + - docs/pkg/models/shared/accountingcustomer.md + - docs/pkg/models/shared/accountingsupplier.md + - docs/pkg/models/shared/accountmappinginfo.md + - docs/pkg/models/shared/accountmappinginfoaccounttype.md + - docs/pkg/models/shared/accountprototype.md + - docs/pkg/models/shared/accountreference.md + - docs/pkg/models/shared/accountstatus.md + - docs/pkg/models/shared/accounttype.md + - docs/pkg/models/shared/adjustmenttransactionline.md + - docs/pkg/models/shared/adjustmenttransactionrequest.md + - docs/pkg/models/shared/adjustmenttransactionresponse.md + - docs/pkg/models/shared/attachment.md + - docs/pkg/models/shared/attachmentupload.md + - docs/pkg/models/shared/bankaccount.md + - docs/pkg/models/shared/bankaccountdetails.md + - docs/pkg/models/shared/bankaccountreference.md + - docs/pkg/models/shared/bankaccountstatus.md + - docs/pkg/models/shared/bankaccounttype.md + - docs/pkg/models/shared/clientratelimitreachedwebhook.md + - docs/pkg/models/shared/clientratelimitreachedwebhookdata.md + - docs/pkg/models/shared/clientratelimitresetwebhook.md + - docs/pkg/models/shared/clientratelimitresetwebhookdata.md + - docs/pkg/models/shared/clientratelimitwebhook.md + - docs/pkg/models/shared/clientratelimitwebhookpayload.md + - docs/pkg/models/shared/codatfile.md + - docs/pkg/models/shared/companies.md - docs/pkg/models/shared/company.md - - docs/pkg/models/shared/sourcetype.md - - docs/pkg/models/shared/connection.md - - docs/pkg/models/shared/dataconnectionstatus.md - - docs/pkg/models/shared/dataconnectionerror.md - - docs/pkg/models/shared/errorvalidation.md - - docs/pkg/models/shared/errorvalidationitem.md + - docs/pkg/models/shared/companyconfiguration.md - docs/pkg/models/shared/companyrequestbody.md - - docs/pkg/models/shared/groupitems.md - - docs/pkg/models/shared/companies.md - - docs/pkg/models/shared/links.md - - docs/pkg/models/shared/halref.md + - docs/pkg/models/shared/companysyncstatus.md + - docs/pkg/models/shared/connection.md - docs/pkg/models/shared/connections.md + - docs/pkg/models/shared/contact.md + - docs/pkg/models/shared/createaccountresponse.md - docs/pkg/models/shared/createaccountresponsemetadata.md - docs/pkg/models/shared/createaccountresponsevaliddatatypelinks.md - - docs/pkg/models/shared/accountingaccount.md - - docs/pkg/models/shared/createaccountresponse.md - - docs/pkg/models/shared/validation.md - - docs/pkg/models/shared/validationitem.md - - docs/pkg/models/shared/pushoperationstatus.md - - docs/pkg/models/shared/datatype.md - - docs/pkg/models/shared/accounttype.md - - docs/pkg/models/shared/supplementaldata.md - - docs/pkg/models/shared/accountstatus.md - - docs/pkg/models/shared/pushoperationchange.md - - docs/pkg/models/shared/pushchangetype.md - - docs/pkg/models/shared/pushoperationref.md - - docs/pkg/models/shared/validdatatypelinks.md - - docs/pkg/models/shared/accountprototype.md - - docs/pkg/models/shared/pushoption.md - - docs/pkg/models/shared/pushvalidationinfo.md - - docs/pkg/models/shared/pushfieldvalidation.md - - docs/pkg/models/shared/pushoptiontype.md - - docs/pkg/models/shared/pushoptionproperty.md - - docs/pkg/models/shared/pushoptionchoice.md - - docs/pkg/models/shared/createcustomerresponseaccountingaddress.md - - docs/pkg/models/shared/accountingcustomer.md + - docs/pkg/models/shared/createbankaccountresponse.md + - docs/pkg/models/shared/createbankaccountresponsebankaccounttype.md - docs/pkg/models/shared/createcustomerresponse.md + - docs/pkg/models/shared/createcustomerresponseaccountingaddress.md + - docs/pkg/models/shared/createexpenseresponse.md + - docs/pkg/models/shared/createreimbursableexpenseresponse.md + - docs/pkg/models/shared/createsupplierresponse.md + - docs/pkg/models/shared/customer.md + - docs/pkg/models/shared/customerdetails.md + - docs/pkg/models/shared/customers.md - docs/pkg/models/shared/customerstatus.md + - docs/pkg/models/shared/dataconnectionerror.md + - docs/pkg/models/shared/dataconnectionstatus.md + - docs/pkg/models/shared/datasetstatus.md + - docs/pkg/models/shared/datastatus.md + - docs/pkg/models/shared/datatype.md + - docs/pkg/models/shared/datatypes.md + - docs/pkg/models/shared/errorstatus.md + - docs/pkg/models/shared/errorvalidation.md + - docs/pkg/models/shared/errorvalidationitem.md + - docs/pkg/models/shared/expensecontactref.md + - docs/pkg/models/shared/expensetransaction.md + - docs/pkg/models/shared/expensetransactionline.md + - docs/pkg/models/shared/expensetransactiontype.md + - docs/pkg/models/shared/from.md + - docs/pkg/models/shared/groupreference.md + - docs/pkg/models/shared/halref.md + - docs/pkg/models/shared/integrationtype.md + - docs/pkg/models/shared/invoiceto.md + - docs/pkg/models/shared/invoicetotype.md + - docs/pkg/models/shared/itemref.md + - docs/pkg/models/shared/items.md + - docs/pkg/models/shared/links.md + - docs/pkg/models/shared/mappingoptions.md - docs/pkg/models/shared/metadata.md - docs/pkg/models/shared/phone.md - - docs/pkg/models/shared/contact.md - docs/pkg/models/shared/phonenumbertype.md - - docs/pkg/models/shared/items.md - - docs/pkg/models/shared/accountingaddresstype.md - - docs/pkg/models/shared/accountingaddress.md - - docs/pkg/models/shared/customer.md - - docs/pkg/models/shared/customers.md - - docs/pkg/models/shared/updatecustomerresponseaccountingaddress.md - - docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md - - docs/pkg/models/shared/updatecustomerresponse.md - - docs/pkg/models/shared/accountingsupplier.md - - docs/pkg/models/shared/createsupplierresponse.md - - docs/pkg/models/shared/supplierstatus.md - - docs/pkg/models/shared/supplier.md - - docs/pkg/models/shared/suppliers.md - - docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md - - docs/pkg/models/shared/updatesupplierresponse.md - - docs/pkg/models/shared/datatypes.md - - docs/pkg/models/shared/datastatus.md - - docs/pkg/models/shared/status.md - docs/pkg/models/shared/pulloperation.md - docs/pkg/models/shared/pulloperations.md - - docs/pkg/models/shared/schemadatatype.md + - docs/pkg/models/shared/pushchangetype.md + - docs/pkg/models/shared/pushfieldvalidation.md - docs/pkg/models/shared/pushoperation.md + - docs/pkg/models/shared/pushoperationchange.md + - docs/pkg/models/shared/pushoperationref.md - docs/pkg/models/shared/pushoperations.md - - docs/pkg/models/shared/companyconfiguration.md - - docs/pkg/models/shared/supplierdetails.md - - docs/pkg/models/shared/customerdetails.md - - docs/pkg/models/shared/bankaccount.md - - docs/pkg/models/shared/mappingoptions.md - - docs/pkg/models/shared/trackingcategorymappinginfo.md - - docs/pkg/models/shared/taxratemappinginfovalidtransactiontypes.md - - docs/pkg/models/shared/taxratemappinginfo.md - - docs/pkg/models/shared/accountmappinginfoaccounttype.md - - docs/pkg/models/shared/validtransactiontypes.md - - docs/pkg/models/shared/accountmappinginfo.md - - docs/pkg/models/shared/createexpenseresponse.md - - docs/pkg/models/shared/createexpenserequest.md - - docs/pkg/models/shared/expensetransactionbankaccountreference.md - - docs/pkg/models/shared/expensetransactiontype.md - - docs/pkg/models/shared/expensetransaction.md - - docs/pkg/models/shared/expensetransactionline.md - - docs/pkg/models/shared/trackingrefdatatype.md - - docs/pkg/models/shared/trackingref.md + - docs/pkg/models/shared/pushoperationstatus.md + - docs/pkg/models/shared/pushoption.md + - docs/pkg/models/shared/pushoptionchoice.md + - docs/pkg/models/shared/pushoptionproperty.md + - docs/pkg/models/shared/pushoptiontype.md + - docs/pkg/models/shared/pushvalidationinfo.md - docs/pkg/models/shared/recordref.md - - docs/pkg/models/shared/invoicetodatatype.md - - docs/pkg/models/shared/invoiceto.md - - docs/pkg/models/shared/type.md - - docs/pkg/models/shared/contactref.md - - docs/pkg/models/shared/updateexpenseresponse.md - - docs/pkg/models/shared/updateexpenserequestbankaccountreference.md - - docs/pkg/models/shared/updateexpenserequest.md - - docs/pkg/models/shared/createreimbursableexpenseresponse.md - - docs/pkg/models/shared/createreimbursableexpenserequest.md - - docs/pkg/models/shared/bankaccountreference.md - docs/pkg/models/shared/reimbursableexpensetransaction.md - docs/pkg/models/shared/reimbursableexpensetransactionline.md - - docs/pkg/models/shared/companysyncstatus.md - - docs/pkg/models/shared/syncinitiated.md - - docs/pkg/models/shared/initiatesync.md - - docs/pkg/models/shared/transaction.md - - docs/pkg/models/shared/transactionstatus.md - - docs/pkg/models/shared/integrationtype.md - - docs/pkg/models/shared/transactions.md - - docs/pkg/models/shared/attachment.md - - docs/pkg/models/shared/attachmentupload.md - - docs/pkg/models/shared/codatfile.md - - docs/pkg/models/shared/createtransferresponse.md - - docs/pkg/models/shared/createtransferrequest.md - - docs/pkg/models/shared/transferdetails.md - - docs/pkg/models/shared/accountref.md + - docs/pkg/models/shared/reimbursementcontactref.md + - docs/pkg/models/shared/schemadatatype.md - docs/pkg/models/shared/security.md - - docs/pkg/models/shared/clientratelimitreachedwebhook.md - - docs/pkg/models/shared/clientratelimitreachedwebhookdata.md - - docs/pkg/models/shared/clientratelimitresetwebhook.md - - docs/pkg/models/shared/clientratelimitresetwebhookdata.md + - docs/pkg/models/shared/sourcetype.md + - docs/pkg/models/shared/status.md + - docs/pkg/models/shared/supplementaldata.md + - docs/pkg/models/shared/supplier.md + - docs/pkg/models/shared/supplierdetails.md + - docs/pkg/models/shared/suppliers.md + - docs/pkg/models/shared/supplierstatus.md - docs/pkg/models/shared/synccompletewebhook.md - docs/pkg/models/shared/synccompletewebhookdata.md - docs/pkg/models/shared/syncfailedwebhook.md - docs/pkg/models/shared/syncfailedwebhookdata.md - - docs/pkg/models/shared/data.md - - docs/pkg/models/shared/syncstartedwebhook.md - - docs/pkg/models/sdkerrors/errormessage.md + - docs/pkg/models/shared/tags.md + - docs/pkg/models/shared/taxratemappinginfo.md + - docs/pkg/models/shared/to.md + - docs/pkg/models/shared/trackingcategorymappinginfo.md + - docs/pkg/models/shared/trackingref.md + - docs/pkg/models/shared/trackingrefadjustmenttransaction.md + - docs/pkg/models/shared/trackingrefadjustmenttransactiondatatype.md + - docs/pkg/models/shared/trackingrefdatatype.md + - docs/pkg/models/shared/transaction.md + - docs/pkg/models/shared/transactions.md + - docs/pkg/models/shared/transactionstatus.md + - docs/pkg/models/shared/transfertransactionrequest.md + - docs/pkg/models/shared/transfertransactionrequestaccountreference.md + - docs/pkg/models/shared/transfertransactionresponse.md + - docs/pkg/models/shared/type.md + - docs/pkg/models/shared/updatecustomerresponse.md + - docs/pkg/models/shared/updatecustomerresponseaccountingaddress.md + - docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md + - docs/pkg/models/shared/updateexpenserequest.md + - docs/pkg/models/shared/updateexpenserequestbankaccountreference.md + - docs/pkg/models/shared/updateexpenserequesttype.md + - docs/pkg/models/shared/updateexpenseresponse.md + - docs/pkg/models/shared/updatereimbursableexpensetransactionrequest.md + - docs/pkg/models/shared/updatesupplierresponse.md + - docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md + - docs/pkg/models/shared/validation.md + - docs/pkg/models/shared/validationitem.md + - docs/pkg/models/shared/validdatatypelinks.md + - docs/pkg/models/shared/validtransactiontypes.md - docs/pkg/models/webhooks/clientratelimitreachedresponse.md + - docs/pkg/models/webhooks/clientratelimitreachedresponse1.md - docs/pkg/models/webhooks/clientratelimitresetresponse.md + - docs/pkg/models/webhooks/clientratelimitresetresponse1.md - docs/pkg/models/webhooks/synccompleteresponse.md - docs/pkg/models/webhooks/syncfailedresponse.md - - docs/pkg/models/webhooks/syncstartedresponse.md + - docs/sdks/accounts/README.md + - docs/sdks/adjustments/README.md + - docs/sdks/attachments/README.md + - docs/sdks/bankaccounts/README.md - docs/sdks/codatsyncexpenses/README.md - - docs/pkg/models/operations/option.md - docs/sdks/companies/README.md + - docs/sdks/configuration/README.md - docs/sdks/connections/README.md - - docs/sdks/accounts/README.md - docs/sdks/customers/README.md - - docs/sdks/suppliers/README.md + - docs/sdks/expenses/README.md - docs/sdks/managedata/README.md + - docs/sdks/mappingoptions/README.md - docs/sdks/pushoperations/README.md - - docs/sdks/configuration/README.md - - docs/sdks/expenses/README.md - docs/sdks/reimbursements/README.md + - docs/sdks/suppliers/README.md - docs/sdks/sync/README.md - docs/sdks/transactionstatus/README.md - - docs/sdks/attachments/README.md - docs/sdks/transfers/README.md - - USAGE.md - - pkg/models/operations/options.go - - .gitattributes + - expenses.go + - go.mod - internal/hooks/hooks.go + - managedata.go + - mappingoptions.go + - pkg/models/operations/options.go + - pkg/models/sdkerrors/sdkerror.go + - pkg/retry/config.go + - pkg/types/bigint.go + - pkg/types/date.go + - pkg/types/datetime.go + - pkg/types/decimal.go + - pkg/types/pointers.go + - pkg/utils/contenttype.go + - pkg/utils/form.go + - pkg/utils/headers.go + - pkg/utils/json.go + - pkg/utils/pathparams.go + - pkg/utils/queryparams.go + - pkg/utils/requestbody.go + - pkg/utils/retries.go + - pkg/utils/security.go + - pkg/utils/utils.go + - pushoperations.go + - reimbursements.go + - suppliers.go + - sync.go + - transactionstatus.go + - transfers.go +examples: + create-company: + With no description: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + With a description: + requestBody: + application/json: {"description": "Technology services, including web and app design and development", "groups": [], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "Technology services, including web and app design and development", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + With a group: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [{"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"}], "name": "Technicalium"} + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18.1950523Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + "400": {} + Malformed query: + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Bank of Dave"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + delete-company: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-company: + Simple company: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "My First Company", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + With groups: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"created": "2022-11-10T10:45:18Z", "createdByUserName": "Dan Tzabar", "dataConnections": [], "description": "", "id": "ab12c58d-a678-4ebf-a159-ae99e1807bd0", "lastSync": "2022-10-23T00:00:00Z", "name": "My First Company", "redirect": "https://link.codat.io/company/ab12c58d-a678-4ebf-a159-ae99e1807bd0"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-companies: + "": + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"}], "totalResults": 1} + "400": {} + One company: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/3fa85f64-5717-4562-b3fc-2c963f66afa6/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "My Test Company make testing software", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "lastSync": "2022-01-01T12:30:00.000Z", "name": "My Test Company", "redirect": "https://link.codat.io/company/3fa85f64-5717-4562-b3fc-2c963f66afa6"}], "totalResults": 1} + List of Companies: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies?page=1&pageSize=100"}, "self": {"href": "/companies"}}, "pageNumber": 1, "pageSize": 100, "results": [{"created": "2022-01-01T11:30:00Z", "createdByUserName": "Joe Bloggs", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "51baa045-4836-4317-a42e-3542e991e581", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/d1568dde-adf6-11ed-afa1-0242ac120002/connections/51baa045-4836-4317-a42e-3542e991e581/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "Technology services, including web and app design and development", "id": "d1568dde-adf6-11ed-afa1-0242ac120002", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Technicalium", "redirect": "https://link.codat.io/company/d1568dde-adf6-11ed-afa1-0242ac120002"}, {"created": "2022-01-01T11:30:00Z", "createdByUserName": "Mike Smith", "dataConnections": [{"created": "2022-01-01T11:30:00Z", "dataConnectionErrors": [], "id": "a70bc148-dc21-46b2-a257-d9c58ac15cbb", "integrationId": "1c312d69-e638-46d4-ad31-72e6c3ba8390", "integrationKey": "vjms", "lastSync": "2022-01-01T12:30:00.000Z", "linkUrl": "https://link-api.codat.io/companies/096db70b-78de-4ff0-aa98-299cb5fe17a0/connections/a70bc148-dc21-46b2-a257-d9c58ac15cbb/start", "platformName": "Pandle", "sourceId": "396c3158-5dd7-481b-a7c4-a795ca31792b", "sourceType": "Accounting", "status": "Linked"}], "description": "A new digital agency with a passion for creating amazing digital experiences", "id": "096db70b-78de-4ff0-aa98-299cb5fe17a0", "lastSync": "2022-01-01T12:30:00.000Z", "name": "Godata", "redirect": "https://link.codat.io/company/096db70b-78de-4ff0-aa98-299cb5fe17a0"}], "totalResults": 2} + Malformed query: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + update-company: + Update name: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "New Name"} + responses: + "200": + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"} + "401": {} + Update description: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Additional documents required", "groups": [], "name": "Same name"} + responses: + "200": + application/json: {"created": "2022-01-01T12:00:00.000Z", "createdByUserName": "string", "dataConnections": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "description": "Requested early access to the new financing scheme.", "id": "0498e921-9b53-4396-a412-4f2f5983b0a2", "lastSync": "2022-01-01T12:00:00.000Z", "name": "string", "redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739"} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"description": "Requested early access to the new financing scheme.", "groups": [], "name": "Bank of Dave"} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"platformKey": "gbol"} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-partner-expense-connection: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + delete-connection: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-connection: + Connection: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-connections: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "totalResults": 1} + "400": {} + Connections: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "string"}, "next": {"href": "string"}, "previous": {"href": "string"}, "self": {"href": "string"}}, "pageNumber": 0, "pageSize": 0, "results": [{"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"}], "totalResults": 0} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + unlink-connection: + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + requestBody: + application/json: {"status": "Unlinked"} + responses: + "200": + application/json: {"created": "2022-10-27T09:53:29Z", "dataConnectionErrors": [], "id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd", "integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c", "integrationKey": "dfxm", "lastSync": "2022-10-27T10:22:43.6464237Z", "linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start", "platformName": "Basiq", "sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee", "sourceType": "Banking", "status": "Linked"} + "401": {} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-bank-account: + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountName": "GBP Bank Account", "accountNumber": "12345678", "accountType": "Debit", "currency": "GBP", "modifiedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + responses: + "200": + application/json: {"changes": [], "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "completedOnUtc": "2022-10-23T00:00:00Z", "dataConnectionKey": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "dataType": "invoices", "pushOperationKey": "1fc6fe07-241b-4cdd-89dc-7fa504e08333", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 829142} + "400": {} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"accountName": "Xero GBP Bank Account", "accountNumber": "12345678", "accountType": "Debit", "currency": "GBP", "modifiedDate": "2022-10-23T00:00:00Z", "sortCode": "445566", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + responses: + "200": + application/json: {"changes": [], "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "completedOnUtc": "2022-10-23T00:00:00Z", "dataConnectionKey": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "dataType": "invoices", "pushOperationKey": "e261915a-25d0-4d9e-a132-0e8504aa8ce6", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Success", "statusCode": 496323} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "USD", "modifiedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-create-bankAccounts-model: + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Needs to be of the format '{No.}-{Name}'", "field": "AccountName"}], "warnings": []}}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": true, "type": "String"}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": false, "type": "String"}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "Bank Account Posting Group with Nominal Account must exist", "field": "NominalCode"}], "warnings": []}}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": false, "type": "String", "validation": {"information": [{"details": "Must have a length between 0 and 20 characters", "field": "SortCode"}], "warnings": []}}, "iBan": {"description": "The international bank account number of the account. Often used when making or receiving international payments", "displayName": "IBAN", "required": false, "type": "String"}, "overdraftLimit": {"description": "The pre-arranged overdraft limit of the account", "displayName": "Overdraft Limit", "required": false, "type": "Number", "validation": {"information": [{"details": "Default value is 0", "field": "OverdraftLimit"}], "warnings": []}}}, "required": true, "type": "Object"} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String"}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Should not exceed the maximum length of 14 characters if the specified currency is GBP.", "field": "AccountNumber"}]}}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be 6 characters long if the specified currency is GBP.", "field": "SortCode"}, {"details": "Must be provided if the specified currency is GBP.", "field": "SortCode"}]}}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": false, "type": "String"}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String"}}, "required": true, "type": "Object"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String"}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Should not exceed the maximum length of 14 characters if the specified currency is GBP.", "field": "AccountNumber"}]}}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be 6 characters long if the specified currency is GBP.", "field": "SortCode"}, {"details": "Must be provided if the specified currency is GBP.", "field": "SortCode"}]}}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": false, "type": "String"}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String"}}, "required": true, "type": "Object"} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String"}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 0 and 8 characters", "field": "SortCode"}]}}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": false, "type": "String"}, "iBan": {"description": "The international bank account number of the account. Often used when making or receiving international payments", "displayName": "IBAN", "required": false, "type": "String"}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "options": [{"displayName": "AED", "required": false, "type": "String", "value": "AED"}, {"displayName": "AMD", "required": false, "type": "String", "value": "AMD"}, {"displayName": "AOA", "required": false, "type": "String", "value": "AOA"}, {"displayName": "ARS", "required": false, "type": "String", "value": "ARS"}, {"displayName": "AUD", "required": false, "type": "String", "value": "AUD"}, {"displayName": "AWG", "required": false, "type": "String", "value": "AWG"}, {"displayName": "AZN", "required": false, "type": "String", "value": "AZN"}, {"displayName": "BBD", "required": false, "type": "String", "value": "BBD"}, {"displayName": "BDT", "required": false, "type": "String", "value": "BDT"}, {"displayName": "BGN", "required": false, "type": "String", "value": "BGN"}, {"displayName": "BRL", "required": false, "type": "String", "value": "BRL"}, {"displayName": "BWP", "required": false, "type": "String", "value": "BWP"}, {"displayName": "CAD", "required": false, "type": "String", "value": "CAD"}, {"displayName": "CHF", "required": false, "type": "String", "value": "CHF"}, {"displayName": "CLP", "required": false, "type": "String", "value": "CLP"}, {"displayName": "CNY", "required": false, "type": "String", "value": "CNY"}, {"displayName": "COP", "required": false, "type": "String", "value": "COP"}, {"displayName": "CRC", "required": false, "type": "String", "value": "CRC"}, {"displayName": "CUC", "required": false, "type": "String", "value": "CUC"}, {"displayName": "CUP", "required": false, "type": "String", "value": "CUP"}, {"displayName": "CZK", "required": false, "type": "String", "value": "CZK"}, {"displayName": "DKK", "required": false, "type": "String", "value": "DKK"}, {"displayName": "DOP", "required": false, "type": "String", "value": "DOP"}, {"displayName": "EGP", "required": false, "type": "String", "value": "EGP"}, {"displayName": "EUR", "required": false, "type": "String", "value": "EUR"}, {"displayName": "FJD", "required": false, "type": "String", "value": "FJD"}, {"displayName": "GBP", "required": false, "type": "String", "value": "GBP"}, {"displayName": "GEL", "required": false, "type": "String", "value": "GEL"}, {"displayName": "GHS", "required": false, "type": "String", "value": "GHS"}, {"displayName": "GTQ", "required": false, "type": "String", "value": "GTQ"}, {"displayName": "GYD", "required": false, "type": "String", "value": "GYD"}, {"displayName": "HKD", "required": false, "type": "String", "value": "HKD"}, {"displayName": "HNL", "required": false, "type": "String", "value": "HNL"}, {"displayName": "HRK", "required": false, "type": "String", "value": "HRK"}, {"displayName": "HUF", "required": false, "type": "String", "value": "HUF"}, {"displayName": "IDR", "required": false, "type": "String", "value": "IDR"}, {"displayName": "ILS", "required": false, "type": "String", "value": "ILS"}, {"displayName": "INR", "required": false, "type": "String", "value": "INR"}, {"displayName": "ISK", "required": false, "type": "String", "value": "ISK"}, {"displayName": "JMD", "required": false, "type": "String", "value": "JMD"}, {"displayName": "JPY", "required": false, "type": "String", "value": "JPY"}, {"displayName": "KES", "required": false, "type": "String", "value": "KES"}, {"displayName": "KRW", "required": false, "type": "String", "value": "KRW"}, {"displayName": "KWD", "required": false, "type": "String", "value": "KWD"}, {"displayName": "KYD", "required": false, "type": "String", "value": "KYD"}, {"displayName": "KZT", "required": false, "type": "String", "value": "KZT"}, {"displayName": "LAK", "required": false, "type": "String", "value": "LAK"}, {"displayName": "LBP", "required": false, "type": "String", "value": "LBP"}, {"displayName": "LKR", "required": false, "type": "String", "value": "LKR"}, {"displayName": "LTL", "required": false, "type": "String", "value": "LTL"}, {"displayName": "LVL", "required": false, "type": "String", "value": "LVL"}, {"displayName": "MAD", "required": false, "type": "String", "value": "MAD"}, {"displayName": "MDL", "required": false, "type": "String", "value": "MDL"}, {"displayName": "MGA", "required": false, "type": "String", "value": "MGA"}, {"displayName": "MUR", "required": false, "type": "String", "value": "MUR"}, {"displayName": "MVR", "required": false, "type": "String", "value": "MVR"}, {"displayName": "MWK", "required": false, "type": "String", "value": "MWK"}, {"displayName": "MXN", "required": false, "type": "String", "value": "MXN"}, {"displayName": "MYR", "required": false, "type": "String", "value": "MYR"}, {"displayName": "MZN", "required": false, "type": "String", "value": "MZN"}, {"displayName": "NAD", "required": false, "type": "String", "value": "NAD"}, {"displayName": "NGN", "required": false, "type": "String", "value": "NGN"}, {"displayName": "NOK", "required": false, "type": "String", "value": "NOK"}, {"displayName": "NPR", "required": false, "type": "String", "value": "NPR"}, {"displayName": "NZD", "required": false, "type": "String", "value": "NZD"}, {"displayName": "OMR", "required": false, "type": "String", "value": "OMR"}, {"displayName": "PEN", "required": false, "type": "String", "value": "PEN"}, {"displayName": "PHP", "required": false, "type": "String", "value": "PHP"}, {"displayName": "PKR", "required": false, "type": "String", "value": "PKR"}, {"displayName": "PLN", "required": false, "type": "String", "value": "PLN"}, {"displayName": "QAR", "required": false, "type": "String", "value": "QAR"}, {"displayName": "RON", "required": false, "type": "String", "value": "RON"}, {"displayName": "RSD", "required": false, "type": "String", "value": "RSD"}, {"displayName": "RUB", "required": false, "type": "String", "value": "RUB"}, {"displayName": "RWF", "required": false, "type": "String", "value": "RWF"}, {"displayName": "SAR", "required": false, "type": "String", "value": "SAR"}, {"displayName": "SCR", "required": false, "type": "String", "value": "SCR"}, {"displayName": "SEK", "required": false, "type": "String", "value": "SEK"}, {"displayName": "SGD", "required": false, "type": "String", "value": "SGD"}, {"displayName": "THB", "required": false, "type": "String", "value": "THB"}, {"displayName": "TND", "required": false, "type": "String", "value": "TND"}, {"displayName": "TRY", "required": false, "type": "String", "value": "TRY"}, {"displayName": "TTD", "required": false, "type": "String", "value": "TTD"}, {"displayName": "TWD", "required": false, "type": "String", "value": "TWD"}, {"displayName": "TZS", "required": false, "type": "String", "value": "TZS"}, {"displayName": "UAH", "required": false, "type": "String", "value": "UAH"}, {"displayName": "UGX", "required": false, "type": "String", "value": "UGX"}, {"displayName": "USD", "required": false, "type": "String", "value": "USD"}, {"displayName": "UYU", "required": false, "type": "String", "value": "UYU"}, {"displayName": "VEF", "required": false, "type": "String", "value": "VEF"}, {"displayName": "VND", "required": false, "type": "String", "value": "VND"}, {"displayName": "VUV", "required": false, "type": "String", "value": "VUV"}, {"displayName": "XAF", "required": false, "type": "String", "value": "XAF"}, {"displayName": "XCD", "required": false, "type": "String", "value": "XCD"}, {"displayName": "XOF", "required": false, "type": "String", "value": "XOF"}, {"displayName": "ZAR", "required": false, "type": "String", "value": "ZAR"}, {"displayName": "ZMK", "required": false, "type": "String", "value": "ZMK"}], "required": true, "type": "String"}, "balance": {"description": "The balance of the bank account", "displayName": "Balance", "required": false, "type": "Number", "validation": {"information": [{"details": "The opening balance, in the account currency", "field": "Balance"}], "warnings": []}}, "institution": {"description": "The institution of the bank account", "displayName": "Institution", "required": false, "type": "String"}}, "required": true, "type": "Object"} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "Name of the bank account as it appears in Kashflow.", "displayName": "Account Name", "required": true, "type": "String"}, "balance": {"description": "The opening balance, in the account currency.", "displayName": "Balance", "required": false, "type": "Number"}, "currency": {"description": "The currency of the bank account.", "displayName": "Currency", "required": true, "type": "String"}}, "required": true, "type": "Object"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 7 characters.", "field": "NominalCode"}]}}, "accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 31 characters.", "field": "AccountName"}]}}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "If not set, will default to the base currency of the QuickBooks Desktop company", "field": "Currency"}], "warnings": [{"details": "The currency must match the base currency of the QuickBooks Desktop company unless the FullyQualifiedCategory is 'Asset.AccountsReceivable','Liability.AccountsPayable' or 'Liability.CreditCard'", "field": "Currency"}, {"details": "Must be a three letter ISO code that matches an existing active currency in the QuickBooks Desktop company", "field": "Currency"}, {"details": "Can only be set if the Quickbooks Desktop company has Multicurrency enabled.", "field": "Currency"}]}}, "balance": {"description": "The balance of the bank account", "displayName": "Balance", "required": false, "type": "Number"}}, "required": true, "type": "Object"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "Name of account as it appears in the chart of accounts or general ledger.", "displayName": "Account Name", "required": true, "type": "String"}, "accountNumber": {"description": "User-defined account number to help the user in identifying the account within the chart-of-accounts and in deciding what should be posted to the account.", "displayName": "Account Number", "required": true, "type": "String"}, "currency": {"description": "Currency of the bank account.", "displayName": "Currency", "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "AccountName"}, {"details": "Should not be longer than 50 characters.", "field": "AccountName"}], "warnings": []}}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Currency"}, {"details": "Must match the company's base currency.", "field": "Currency"}], "warnings": []}}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": false, "type": "String", "validation": {"information": [{"details": "Should be a 6 digit number.", "field": "SortCode"}], "warnings": []}}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": false, "type": "String", "validation": {"information": [{"details": "Should not be longer than 25 characters.", "field": "AccountNumber"}], "warnings": []}}, "iBan": {"description": "The international bank account number of the account. Often used when making or receiving international payments", "displayName": "IBAN", "required": false, "type": "String", "validation": {"information": [{"details": "Should be in the international bank account number format.", "field": "IBan"}], "warnings": []}}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "Should be a number between 1 and 99999999.", "field": "NominalCode"}], "warnings": []}}}, "required": true, "type": "Object"} + Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "An account that bank transactions may be recorded against", "displayName": "Bank Account", "properties": {"accountName": {"description": "The name of the bank account in the originating system", "displayName": "Name", "required": true, "type": "String"}, "accountType": {"description": "The type of account", "displayName": "Account Type", "required": true, "type": "String"}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String"}, "sortCode": {"description": "The sort code for the bank account", "displayName": "Sort Code", "required": true, "type": "String"}, "accountNumber": {"description": "The account number for the bank account", "displayName": "Account Number", "required": true, "type": "String"}, "iBan": {"description": "The international bank account number of the account. Often used when making or receiving international payments", "displayName": "IBAN", "required": true, "type": "String"}, "currency": {"description": "The currency of the bank account", "displayName": "Currency", "required": true, "type": "String"}, "balance": {"description": "The balance of the bank account", "displayName": "Balance", "required": true, "type": "Number"}, "availableBalance": {"description": "The available balance of the bank account", "displayName": "Available Balance", "required": true, "type": "Number"}, "overdraftLimit": {"description": "The pre-arranged overdraft limit of the account", "displayName": "Overdraft Limit", "required": true, "type": "Number"}, "institution": {"description": "The institution of the bank account", "displayName": "Institution", "required": true, "type": "String"}, "metadata": {"description": "Miscellaneous data about the item", "displayName": "Metadata", "required": true, "type": "Object"}}, "required": true, "type": "Object"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-account: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"currency": "USD", "currentBalance": 0, "description": "Invoices the business has issued but has not yet collected payment on.", "fullyQualifiedCategory": "Asset.Current", "fullyQualifiedName": "Cash On Hand", "name": "Accounts Receivable", "nominalCode": "610", "status": "Active", "type": "Asset"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-create-chartOfAccounts-model: + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Name"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Asset.Assets.Cash", "required": false, "type": "String", "value": "Asset.Assets.Cash"}, {"displayName": "Asset.Assets.Bank", "required": false, "type": "String", "value": "Asset.Assets.Bank"}, {"displayName": "Asset.Assets.PaymentServices", "required": false, "type": "String", "value": "Asset.Assets.PaymentServices"}, {"displayName": "Asset.Assets.AccountsReceivable", "required": false, "type": "String", "value": "Asset.Assets.AccountsReceivable"}, {"displayName": "Liability.EquityAndLiabilities.AccountsPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccountsPayable"}, {"displayName": "Asset.Assets.VAT", "required": false, "type": "String", "value": "Asset.Assets.VAT"}, {"displayName": "Liability.EquityAndLiabilities.EmployeesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.EmployeesPayable"}, {"displayName": "Asset.Assets.PrepaidExpenses", "required": false, "type": "String", "value": "Asset.Assets.PrepaidExpenses"}, {"displayName": "Liability.EquityAndLiabilities.AccruedExpenses", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccruedExpenses"}, {"displayName": "Liability.EquityAndLiabilities.IncomeTaxesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.IncomeTaxesPayable"}, {"displayName": "Asset.Assets.FixedAssets", "required": false, "type": "String", "value": "Asset.Assets.FixedAssets"}, {"displayName": "Asset.Assets.OtherAssets", "required": false, "type": "String", "value": "Asset.Assets.OtherAssets"}, {"displayName": "Asset.Assets.AccumulatedDeprecation", "required": false, "type": "String", "value": "Asset.Assets.AccumulatedDeprecation"}, {"displayName": "Asset.Assets.Inventory", "required": false, "type": "String", "value": "Asset.Assets.Inventory"}, {"displayName": "Equity.EquityAndLiabilities.CapitalStock", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.CapitalStock"}, {"displayName": "Equity.EquityAndLiabilities.RetainedEarnings", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.RetainedEarnings"}, {"displayName": "Liability.EquityAndLiabilities.LongTermDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.LongTermDebt"}, {"displayName": "Liability.EquityAndLiabilities.CurrentPortionOfDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.CurrentPortionOfDebt"}, {"displayName": "Unknown.EquityAndLiabilities.Intercompany", "required": false, "type": "String", "value": "Unknown.EquityAndLiabilities.Intercompany"}, {"displayName": "Unknown.General.General", "required": false, "type": "String", "value": "Unknown.General.General"}, {"displayName": "Income.NetIncome.Revenue", "required": false, "type": "String", "value": "Income.NetIncome.Revenue"}, {"displayName": "Expense.NetIncome.CostOfGoods", "required": false, "type": "String", "value": "Expense.NetIncome.CostOfGoods"}, {"displayName": "Expense.NetIncome.OtherCosts", "required": false, "type": "String", "value": "Expense.NetIncome.OtherCosts"}, {"displayName": "Expense.NetIncome.SalesGeneralAdministrativeExpenses", "required": false, "type": "String", "value": "Expense.NetIncome.SalesGeneralAdministrativeExpenses"}, {"displayName": "Expense.NetIncome.DeprecationCosts", "required": false, "type": "String", "value": "Expense.NetIncome.DeprecationCosts"}, {"displayName": "Expense.NetIncome.ResearchAndDevelopment", "required": false, "type": "String", "value": "Expense.NetIncome.ResearchAndDevelopment"}, {"displayName": "Expense.NetIncome.EmployeeCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmployeeCosts"}, {"displayName": "Expense.NetIncome.EmploymentCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmploymentCosts"}, {"displayName": "Expense.ExceptionalIncome.ExceptionalCosts", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.ExceptionalCosts"}, {"displayName": "Income.ExceptionalIncome.ExceptionalIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.ExceptionalIncome"}, {"displayName": "Expense.ExceptionalIncome.IncomeTaxes", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.IncomeTaxes"}, {"displayName": "Income.ExceptionalIncome.InterestIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.InterestIncome"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "FullyQualifiedCategory"}], "warnings": []}}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Pending", "required": false, "type": "String", "value": "Pending"}, {"displayName": "Unknown", "required": false, "type": "String", "value": "Unknown"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Status"}], "warnings": []}}}, "required": true, "type": "Object"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Name"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Asset.Assets.Cash", "required": false, "type": "String", "value": "Asset.Assets.Cash"}, {"displayName": "Asset.Assets.Bank", "required": false, "type": "String", "value": "Asset.Assets.Bank"}, {"displayName": "Asset.Assets.PaymentServices", "required": false, "type": "String", "value": "Asset.Assets.PaymentServices"}, {"displayName": "Asset.Assets.AccountsReceivable", "required": false, "type": "String", "value": "Asset.Assets.AccountsReceivable"}, {"displayName": "Liability.EquityAndLiabilities.AccountsPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccountsPayable"}, {"displayName": "Asset.Assets.VAT", "required": false, "type": "String", "value": "Asset.Assets.VAT"}, {"displayName": "Liability.EquityAndLiabilities.EmployeesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.EmployeesPayable"}, {"displayName": "Asset.Assets.PrepaidExpenses", "required": false, "type": "String", "value": "Asset.Assets.PrepaidExpenses"}, {"displayName": "Liability.EquityAndLiabilities.AccruedExpenses", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.AccruedExpenses"}, {"displayName": "Liability.EquityAndLiabilities.IncomeTaxesPayable", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.IncomeTaxesPayable"}, {"displayName": "Asset.Assets.FixedAssets", "required": false, "type": "String", "value": "Asset.Assets.FixedAssets"}, {"displayName": "Asset.Assets.OtherAssets", "required": false, "type": "String", "value": "Asset.Assets.OtherAssets"}, {"displayName": "Asset.Assets.AccumulatedDeprecation", "required": false, "type": "String", "value": "Asset.Assets.AccumulatedDeprecation"}, {"displayName": "Asset.Assets.Inventory", "required": false, "type": "String", "value": "Asset.Assets.Inventory"}, {"displayName": "Equity.EquityAndLiabilities.CapitalStock", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.CapitalStock"}, {"displayName": "Equity.EquityAndLiabilities.RetainedEarnings", "required": false, "type": "String", "value": "Equity.EquityAndLiabilities.RetainedEarnings"}, {"displayName": "Liability.EquityAndLiabilities.LongTermDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.LongTermDebt"}, {"displayName": "Liability.EquityAndLiabilities.CurrentPortionOfDebt", "required": false, "type": "String", "value": "Liability.EquityAndLiabilities.CurrentPortionOfDebt"}, {"displayName": "Unknown.EquityAndLiabilities.Intercompany", "required": false, "type": "String", "value": "Unknown.EquityAndLiabilities.Intercompany"}, {"displayName": "Unknown.General.General", "required": false, "type": "String", "value": "Unknown.General.General"}, {"displayName": "Income.NetIncome.Revenue", "required": false, "type": "String", "value": "Income.NetIncome.Revenue"}, {"displayName": "Expense.NetIncome.CostOfGoods", "required": false, "type": "String", "value": "Expense.NetIncome.CostOfGoods"}, {"displayName": "Expense.NetIncome.OtherCosts", "required": false, "type": "String", "value": "Expense.NetIncome.OtherCosts"}, {"displayName": "Expense.NetIncome.SalesGeneralAdministrativeExpenses", "required": false, "type": "String", "value": "Expense.NetIncome.SalesGeneralAdministrativeExpenses"}, {"displayName": "Expense.NetIncome.DeprecationCosts", "required": false, "type": "String", "value": "Expense.NetIncome.DeprecationCosts"}, {"displayName": "Expense.NetIncome.ResearchAndDevelopment", "required": false, "type": "String", "value": "Expense.NetIncome.ResearchAndDevelopment"}, {"displayName": "Expense.NetIncome.EmployeeCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmployeeCosts"}, {"displayName": "Expense.NetIncome.EmploymentCosts", "required": false, "type": "String", "value": "Expense.NetIncome.EmploymentCosts"}, {"displayName": "Expense.ExceptionalIncome.ExceptionalCosts", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.ExceptionalCosts"}, {"displayName": "Income.ExceptionalIncome.ExceptionalIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.ExceptionalIncome"}, {"displayName": "Expense.ExceptionalIncome.IncomeTaxes", "required": false, "type": "String", "value": "Expense.ExceptionalIncome.IncomeTaxes"}, {"displayName": "Income.ExceptionalIncome.InterestIncome", "required": false, "type": "String", "value": "Income.ExceptionalIncome.InterestIncome"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "FullyQualifiedCategory"}], "warnings": []}}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Pending", "required": false, "type": "String", "value": "Pending"}, {"displayName": "Unknown", "required": false, "type": "String", "value": "Unknown"}], "required": true, "type": "String", "validation": {"information": [{"details": "Must be provided.", "field": "Status"}], "warnings": []}}}, "required": true, "type": "Object"} + MYOB AccountRight and Essentials: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "If alphanumeric is supported, must be between 1 and 10 characters. Otherwise format is x-xxxx", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 60 characters", "field": "Name"}]}}, "description": {"description": "Description of the account", "displayName": "Description", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 255 characters", "field": "Description"}]}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Bank", "required": false, "type": "String", "value": "Asset.Bank"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.AccountReceivable"}, {"displayName": "Other Current Asset", "required": false, "type": "String", "value": "Asset.OtherCurrentAsset"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.FixedAsset"}, {"displayName": "Other Asset", "required": false, "type": "String", "value": "Asset.OtherAsset"}, {"displayName": "Cash", "required": false, "type": "String", "value": "Asset.CashAndBank"}, {"displayName": "Equipment Machinery", "required": false, "type": "String", "value": "Asset.Property Plant and Equipment"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.CreditCard"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.AccountsPayable"}, {"displayName": "Other Current Liability", "required": false, "type": "String", "value": "Liability.OtherCurrentLiability"}, {"displayName": "Long Term Liability", "required": false, "type": "String", "value": "Liability.LongTermLiability"}, {"displayName": "Other Liability", "required": false, "type": "String", "value": "Liability.OtherLiability"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Owner's Equity"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "OtherIncome"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense"}, {"displayName": "Sales Marketing", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "General Administrative", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "General Administrative", "required": false, "type": "String", "value": "Expense.Overhead"}, {"displayName": "Repairs Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Other Expense", "required": false, "type": "String", "value": "OtherExpense"}, {"displayName": "Cost of Sales", "required": false, "type": "String", "value": "CostOfSales"}, {"displayName": "Other", "required": false, "type": "String", "value": "Cost Of Goods Sold.Cost of Sales"}], "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Archived", "required": false, "type": "String", "value": "Archived"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 7 characters.", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 31 characters.", "field": "Name"}]}}, "description": {"description": "Description of the account", "displayName": "Description", "required": false, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 200 characters.", "field": "Description"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "If not set, will default to the base currency of the QuickBooks Desktop company", "field": "Currency"}], "warnings": [{"details": "The currency must match the base currency of the QuickBooks Desktop company unless the FullyQualifiedCategory is 'Asset.AccountsReceivable','Liability.AccountsPayable' or 'Liability.CreditCard'", "field": "Currency"}, {"details": "Must be a three letter ISO code that matches an existing active currency in the QuickBooks Desktop company", "field": "Currency"}, {"details": "Can only be set if the Quickbooks Desktop company has Multicurrency enabled.", "field": "Currency"}]}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Account Receivable", "required": false, "type": "String", "value": "Asset.AccountsReceivable"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.FixedAsset"}, {"displayName": "Other Current Asset", "required": false, "type": "String", "value": "Asset.OtherCurrentAsset"}, {"displayName": "Other Asset", "required": false, "type": "String", "value": "Asset.OtherAsset"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income.Income"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "Income.OtherIncome"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.AccountsPayable"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.CreditCard"}, {"displayName": "Long Term Liability", "required": false, "type": "String", "value": "Liability.LongTermLiability"}, {"displayName": "Other Current Liability", "required": false, "type": "String", "value": "Liability.OtherCurrentLiability"}, {"displayName": "Cost Of Goods Sold", "required": false, "type": "String", "value": "Liability.CostOfGoodsSold"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity.Equity"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "Other Expense", "required": false, "type": "String", "value": "Expense.OtherExpense"}], "required": true, "type": "String"}, "currentBalance": {"description": "The current balance in the account", "displayName": "Current Balance", "required": false, "type": "Number"}}, "required": true, "type": "Object"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "If included must have a length between 1 and 7 characters", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 100 characters", "field": "Name"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "When not specified company base currency will be used", "field": "Currency"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Cash On Hand", "required": false, "type": "String", "value": "Asset.Bank.CashOnHand"}, {"displayName": "Checking", "required": false, "type": "String", "value": "Asset.Bank.Checking"}, {"displayName": "Money Market", "required": false, "type": "String", "value": "Asset.Bank.MoneyMarket"}, {"displayName": "Rents Held In Trust", "required": false, "type": "String", "value": "Asset.Bank.RentsHeldInTrust"}, {"displayName": "Savings", "required": false, "type": "String", "value": "Asset.Bank.Savings"}, {"displayName": "Trust Accounts", "required": false, "type": "String", "value": "Asset.Bank.TrustAccounts"}, {"displayName": "Cash And Cash Equivalents", "required": false, "type": "String", "value": "Asset.Bank.CashAndCashEquivalents"}, {"displayName": "Other Earmarked Bank Accounts", "required": false, "type": "String", "value": "Asset.Bank.OtherEarmarkedBankAccounts"}, {"displayName": "Allowance For Bad Debts", "required": false, "type": "String", "value": "Asset.Other Current Asset.AllowanceForBadDebts"}, {"displayName": "Development Costs", "required": false, "type": "String", "value": "Asset.Other Current Asset.DevelopmentCosts"}, {"displayName": "Employee Cash Advances", "required": false, "type": "String", "value": "Asset.Other Current Asset.EmployeeCashAdvances"}, {"displayName": "Other Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherCurrentAssets"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Other Current Asset.Inventory"}, {"displayName": "Investment Mortgage Real Estate Loans", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_MortgageRealEstateLoans"}, {"displayName": "Investment Other", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_Other"}, {"displayName": "Investment Tax Exempt Securities", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_TaxExemptSecurities"}, {"displayName": "Investment US Government Obligations", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_USGovernmentObligations"}, {"displayName": "Loans To Officers", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOfficers"}, {"displayName": "Loans To Others", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOthers"}, {"displayName": "Loans To Stockholders", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToStockholders"}, {"displayName": "Prepaid Expenses", "required": false, "type": "String", "value": "Asset.Other Current Asset.PrepaidExpenses"}, {"displayName": "Retainage", "required": false, "type": "String", "value": "Asset.Other Current Asset.Retainage"}, {"displayName": "Undeposited Funds", "required": false, "type": "String", "value": "Asset.Other Current Asset.UndepositedFunds"}, {"displayName": "Assets Available For Sale", "required": false, "type": "String", "value": "Asset.Other Current Asset.AssetsAvailableForSale"}, {"displayName": "Balance With Govt Authorities", "required": false, "type": "String", "value": "Asset.Other Current Asset.BalWithGovtAuthorities"}, {"displayName": "Called Up Share Capital Not Paid", "required": false, "type": "String", "value": "Asset.Other Current Asset.CalledUpShareCapitalNotPaid"}, {"displayName": "Expenditure Authorisations And Letters Of Credit", "required": false, "type": "String", "value": "Asset.Other Current Asset.ExpenditureAuthorisationsAndLettersOfCredit"}, {"displayName": "Global Tax Deferred", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxDeferred"}, {"displayName": "Global Tax Refund", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxRefund"}, {"displayName": "Internal Transfers", "required": false, "type": "String", "value": "Asset.Other Current Asset.InternalTransfers"}, {"displayName": "Other Consumables", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherConsumables"}, {"displayName": "Provisions Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.ProvisionsCurrentAssets"}, {"displayName": "Short Term Investments In Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermInvestmentsInRelatedParties"}, {"displayName": "Short Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Trade And Other Receivables", "required": false, "type": "String", "value": "Asset.Other Current Asset.TradeAndOtherReceivables"}, {"displayName": "Accumulated Depletion", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepletion"}, {"displayName": "Accumulated Depreciation", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepreciation"}, {"displayName": "Depletable Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.DepletableAssets"}, {"displayName": "Fixed Asset Computers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetComputers"}, {"displayName": "Fixed Asset Copiers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetCopiers"}, {"displayName": "Fixed Asset Furniture", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetFurniture"}, {"displayName": "Fixed Asset Phone", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhone"}, {"displayName": "Fixed Asset Photo Video", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhotoVideo"}, {"displayName": "Fixed Asset Software", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetSoftware"}, {"displayName": "Fixed Asset Other Tools Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetOtherToolsEquipment"}, {"displayName": "Furniture And Fixtures", "required": false, "type": "String", "value": "Asset.Fixed Asset.FurnitureAndFixtures"}, {"displayName": "Land", "required": false, "type": "String", "value": "Asset.Fixed Asset.Land"}, {"displayName": "Leasehold Improvements", "required": false, "type": "String", "value": "Asset.Fixed Asset.LeaseholdImprovements"}, {"displayName": "Other Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.OtherFixedAssets"}, {"displayName": "Accumulated Amortization", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedAmortization"}, {"displayName": "Buildings", "required": false, "type": "String", "value": "Asset.Fixed Asset.Buildings"}, {"displayName": "Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssets"}, {"displayName": "Machinery And Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.MachineryAndEquipment"}, {"displayName": "Vehicles", "required": false, "type": "String", "value": "Asset.Fixed Asset.Vehicles"}, {"displayName": "Assets In Course Of Construction", "required": false, "type": "String", "value": "Asset.Fixed Asset.AssetsInCourseOfConstruction"}, {"displayName": "Capital Wip", "required": false, "type": "String", "value": "Asset.Fixed Asset.CapitalWip"}, {"displayName": "Cumulative Depreciation On Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.CumulativeDepreciationOnIntangibleAssets"}, {"displayName": "Intangible Assets Under Development", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssetsUnderDevelopment"}, {"displayName": "Land Asset", "required": false, "type": "String", "value": "Asset.Fixed Asset.LandAsset"}, {"displayName": "Non Current Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.NonCurrentAssets"}, {"displayName": "Participating Interests", "required": false, "type": "String", "value": "Asset.Fixed Asset.ParticipatingInterests"}, {"displayName": "Provisions Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.ProvisionsFixedAssets"}, {"displayName": "Lease Buyout", "required": false, "type": "String", "value": "Asset.Other Asset.LeaseBuyout"}, {"displayName": "Other Long Term Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermAssets"}, {"displayName": "Security Deposits", "required": false, "type": "String", "value": "Asset.Other Asset.SecurityDeposits"}, {"displayName": "Accumulated Amortization Of Other Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AccumulatedAmortizationOfOtherAssets"}, {"displayName": "Goodwill", "required": false, "type": "String", "value": "Asset.Other Asset.Goodwill"}, {"displayName": "Licenses", "required": false, "type": "String", "value": "Asset.Other Asset.Licenses"}, {"displayName": "Organizational Costs", "required": false, "type": "String", "value": "Asset.Other Asset.OrganizationalCosts"}, {"displayName": "Assets Held For Sale", "required": false, "type": "String", "value": "Asset.Other Asset.AssetsHeldForSale"}, {"displayName": "Available For Sale Financial Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AvailableForSaleFinancialAssets"}, {"displayName": "Deferred Tax", "required": false, "type": "String", "value": "Asset.Other Asset.DeferredTax"}, {"displayName": "Investments", "required": false, "type": "String", "value": "Asset.Other Asset.Investments"}, {"displayName": "Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermInvestments"}, {"displayName": "Long Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Other Intangible Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherIntangibleAssets"}, {"displayName": "Other Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermInvestments"}, {"displayName": "Other Long Term Loans And Advances", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermLoansAndAdvances"}, {"displayName": "Prepayments And Accrued Income", "required": false, "type": "String", "value": "Asset.Other Asset.PrepaymentsAndAccruedIncome"}, {"displayName": "Provisions Non-Current Assets", "required": false, "type": "String", "value": "Asset.Other Asset.ProvisionsNonCurrentAssets"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.Accounts Receivable.AccountsReceivable"}, {"displayName": "Advertising/Promotional", "required": false, "type": "String", "value": "Expense.Expense.AdvertisingPromotional"}, {"displayName": "Bad Debts", "required": false, "type": "String", "value": "Expense.Expense.BadDebts"}, {"displayName": "Bank Charges", "required": false, "type": "String", "value": "Expense.Expense.BankCharges"}, {"displayName": "Charitable Contributions", "required": false, "type": "String", "value": "Expense.Expense.CharitableContributions"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Entertainment", "required": false, "type": "String", "value": "Expense.Expense.Entertainment"}, {"displayName": "Entertainment Meals", "required": false, "type": "String", "value": "Expense.Expense.EntertainmentMeals"}, {"displayName": "Equipment Rental", "required": false, "type": "String", "value": "Expense.Expense.EquipmentRental"}, {"displayName": "Finance Costs", "required": false, "type": "String", "value": "Expense.Expense.FinanceCosts"}, {"displayName": "Global Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.GlobalTaxExpense"}, {"displayName": "Insurance", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "Interest Paid", "required": false, "type": "String", "value": "Expense.Expense.InterestPaid"}, {"displayName": "Legal And Professional Fees", "required": false, "type": "String", "value": "Expense.Expense.LegalProfessionalFees"}, {"displayName": "Office Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeExpenses"}, {"displayName": "Office/General Administrative Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeGeneralAdministrativeExpenses"}, {"displayName": "Other Business Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherBusinessExpenses"}, {"displayName": "Other Miscellaneous Service Cost", "required": false, "type": "String", "value": "Expense.Expense.OtherMiscellaneousServiceCost"}, {"displayName": "Promotional Meals", "required": false, "type": "String", "value": "Expense.Expense.PromotionalMeals"}, {"displayName": "Rent Or Lease Of Buildings", "required": false, "type": "String", "value": "Expense.Expense.RentOrLeaseOfBuildings"}, {"displayName": "Repair And Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Shipping, Freight And Delivery", "required": false, "type": "String", "value": "Expense.Expense.ShippingFreightDelivery"}, {"displayName": "Supplies And Materials", "required": false, "type": "String", "value": "Expense.Expense.SuppliesMaterials"}, {"displayName": "Travel", "required": false, "type": "String", "value": "Expense.Expense.Travel"}, {"displayName": "Travel Meals", "required": false, "type": "String", "value": "Expense.Expense.TravelMeals"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Auto", "required": false, "type": "String", "value": "Expense.Expense.Auto"}, {"displayName": "Cost Of Labor", "required": false, "type": "String", "value": "Expense.Expense.CostOfLabor"}, {"displayName": "Dues And Subscriptions", "required": false, "type": "String", "value": "Expense.Expense.DuesSubscriptions"}, {"displayName": "Payroll Expenses", "required": false, "type": "String", "value": "Expense.Expense.PayrollExpenses"}, {"displayName": "Taxes Paid", "required": false, "type": "String", "value": "Expense.Expense.TaxesPaid"}, {"displayName": "Unapplied Cash Bill Payment Expense", "required": false, "type": "String", "value": "Expense.Expense.UnappliedCashBillPaymentExpense"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Amortization Expense", "required": false, "type": "String", "value": "Expense.Expense.AmortizationExpense"}, {"displayName": "Appropriations To Depreciation", "required": false, "type": "String", "value": "Expense.Expense.AppropriationsToDepreciation"}, {"displayName": "Borrowing Cost", "required": false, "type": "String", "value": "Expense.Expense.BorrowingCost"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Distribution Costs", "required": false, "type": "String", "value": "Expense.Expense.DistributionCosts"}, {"displayName": "External Services", "required": false, "type": "String", "value": "Expense.Expense.ExternalServices"}, {"displayName": "Extraordinary Charges", "required": false, "type": "String", "value": "Expense.Expense.ExtraordinaryCharges"}, {"displayName": "Income Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.IncomeTaxExpense"}, {"displayName": "Loss On Discontinued Operations Net Of Tax", "required": false, "type": "String", "value": "Expense.Expense.LossOnDiscontinuedOperationsNetOfTax"}, {"displayName": "Management Compensation", "required": false, "type": "String", "value": "Expense.Expense.ManagementCompensation"}, {"displayName": "Other Current Operating Charges", "required": false, "type": "String", "value": "Expense.Expense.OtherCurrentOperatingCharges"}, {"displayName": "Other External Services", "required": false, "type": "String", "value": "Expense.Expense.OtherExternalServices"}, {"displayName": "Other Rental Costs", "required": false, "type": "String", "value": "Expense.Expense.OtherRentalCosts"}, {"displayName": "Other Selling Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherSellingExpenses"}, {"displayName": "Project Studies Surveys Assessments", "required": false, "type": "String", "value": "Expense.Expense.ProjectStudiesSurveysAssessments"}, {"displayName": "Purchases Rebates", "required": false, "type": "String", "value": "Expense.Expense.PurchasesRebates"}, {"displayName": "Shipping And Delivery Expense", "required": false, "type": "String", "value": "Expense.Expense.ShippingAndDeliveryExpense"}, {"displayName": "Staff Costs", "required": false, "type": "String", "value": "Expense.Expense.StaffCosts"}, {"displayName": "Sundry", "required": false, "type": "String", "value": "Expense.Expense.Sundry"}, {"displayName": "Travel Expenses General And Admin Expenses", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesGeneralAndAdminExpenses"}, {"displayName": "Travel Expenses Selling Expense", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesSellingExpense"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Expense.Other Expense.Depreciation"}, {"displayName": "Exchange Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.ExchangeGainOrLoss"}, {"displayName": "Other Miscellaneous Expense", "required": false, "type": "String", "value": "Expense.Other Expense.OtherMiscellaneousExpense"}, {"displayName": "Penalties And Settlements", "required": false, "type": "String", "value": "Expense.Other Expense.PenaltiesSettlements"}, {"displayName": "Amortization", "required": false, "type": "String", "value": "Expense.Other Expense.Amortization"}, {"displayName": "Gas And Fuel", "required": false, "type": "String", "value": "Expense.Other Expense.GasAndFuel"}, {"displayName": "Home Office", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOffice"}, {"displayName": "Home Owner Rental Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOwnerRentalInsurance"}, {"displayName": "Other Home Office Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherHomeOfficeExpenses"}, {"displayName": "Mortgage Interest", "required": false, "type": "String", "value": "Expense.Other Expense.MortgageInterest"}, {"displayName": "Rent And Lease", "required": false, "type": "String", "value": "Expense.Other Expense.RentAndLease"}, {"displayName": "Repairs And Maintenance", "required": false, "type": "String", "value": "Expense.Other Expense.RepairsAndMaintenance"}, {"displayName": "Parking And Tolls", "required": false, "type": "String", "value": "Expense.Other Expense.ParkingAndTolls"}, {"displayName": "Vehicle", "required": false, "type": "String", "value": "Expense.Other Expense.Vehicle"}, {"displayName": "Vehicle Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleInsurance"}, {"displayName": "Vehicle Lease", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLease"}, {"displayName": "Vehicle Loan Interest", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoanInterest"}, {"displayName": "Vehicle Loan", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoan"}, {"displayName": "Vehicle Registration", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRegistration"}, {"displayName": "Vehicle Repairs", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRepairs"}, {"displayName": "Other Vehicle Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherVehicleExpenses"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Other Expense.Utilities"}, {"displayName": "Wash And Road Services", "required": false, "type": "String", "value": "Expense.Other Expense.WashAndRoadServices"}, {"displayName": "Deferred Tax Expense", "required": false, "type": "String", "value": "Expense.Other Expense.DeferredTaxExpense"}, {"displayName": "Depletion", "required": false, "type": "String", "value": "Expense.Other Expense.Depletion"}, {"displayName": "Exceptional Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExceptionalItems"}, {"displayName": "Extraordinary Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExtraordinaryItems"}, {"displayName": "Income Tax Other Expense", "required": false, "type": "String", "value": "Expense.Other Expense.IncomeTaxOtherExpense"}, {"displayName": "Mat Credit", "required": false, "type": "String", "value": "Expense.Other Expense.MatCredit"}, {"displayName": "Prior Period Items", "required": false, "type": "String", "value": "Expense.Other Expense.PriorPeriodItems"}, {"displayName": "Tax Roundoff Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.TaxRoundoffGainOrLoss"}, {"displayName": "Equipment Rental - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.EquipmentRentalCos"}, {"displayName": "Other Costs Of Sales - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.OtherCostsOfServiceCos"}, {"displayName": "Shipping, Freight And Delivery - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.ShippingFreightDeliveryCos"}, {"displayName": "Supplies And Materials - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.SuppliesMaterialsCogs"}, {"displayName": "Cost Of Labor - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfLaborCos"}, {"displayName": "Cost Of Sales", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfSales"}, {"displayName": "Freight And Delivery Cost", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.FreightAndDeliveryCost"}, {"displayName": "Non Profit Income", "required": false, "type": "String", "value": "Income.Income.NonProfitIncome"}, {"displayName": "Other Primary Income", "required": false, "type": "String", "value": "Income.Income.OtherPrimaryIncome"}, {"displayName": "Sales Of ProductIncome", "required": false, "type": "String", "value": "Income.Income.SalesOfProductIncome"}, {"displayName": "Service Fee Income", "required": false, "type": "String", "value": "Income.Income.ServiceFeeIncome"}, {"displayName": "Discounts Refunds Given", "required": false, "type": "String", "value": "Income.Income.DiscountsRefundsGiven"}, {"displayName": "Unapplied Cash Payment Income", "required": false, "type": "String", "value": "Income.Income.UnappliedCashPaymentIncome"}, {"displayName": "Cash Receipt Income", "required": false, "type": "String", "value": "Income.Income.CashReceiptIncome"}, {"displayName": "Operating Grants", "required": false, "type": "String", "value": "Income.Income.OperatingGrants"}, {"displayName": "Other Current Operating Income", "required": false, "type": "String", "value": "Income.Income.OtherCurrentOperatingIncome"}, {"displayName": "Own Work Capitalized", "required": false, "type": "String", "value": "Income.Income.OwnWorkCapitalized"}, {"displayName": "Revenue General", "required": false, "type": "String", "value": "Income.Income.RevenueGeneral"}, {"displayName": "Sales Retail", "required": false, "type": "String", "value": "Income.Income.SalesRetail"}, {"displayName": "Sales Wholesale", "required": false, "type": "String", "value": "Income.Income.SalesWholesale"}, {"displayName": "Savings By Tax Scheme", "required": false, "type": "String", "value": "Income.Income.SavingsByTaxScheme"}, {"displayName": "Dividend Income", "required": false, "type": "String", "value": "Income.Other Income.DividendIncome"}, {"displayName": "Interest Earned", "required": false, "type": "String", "value": "Income.Other Income.InterestEarned"}, {"displayName": "Other Investment Income", "required": false, "type": "String", "value": "Income.Other Income.OtherInvestmentIncome"}, {"displayName": "Other Miscellaneous Income", "required": false, "type": "String", "value": "Income.Other Income.OtherMiscellaneousIncome"}, {"displayName": "Tax Exempt Interest", "required": false, "type": "String", "value": "Income.Other Income.TaxExemptInterest"}, {"displayName": "Gain Loss On Sale Of Fixed Assets", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfFixedAssets"}, {"displayName": "Gain Loss On Sale Of Investments", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfInvestments"}, {"displayName": "Loss On Disposal Of Assets", "required": false, "type": "String", "value": "Income.Other Income.LossOnDisposalOfAssets"}, {"displayName": "Other Operating Income", "required": false, "type": "String", "value": "Income.Other Income.OtherOperatingIncome"}, {"displayName": "Unrealised Loss On Securities Net Of Tax", "required": false, "type": "String", "value": "Income.Other Income.UnrealisedLossOnSecuritiesNetOfTax"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.Accounts Payable.AccountsPayable"}, {"displayName": "Outstanding Dues Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesMicroSmallEnterprise"}, {"displayName": "Outstanding Dues Other Than Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesOtherThanMicroSmallEnterprise"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.Credit Card.CreditCard"}, {"displayName": "Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.NotesPayable"}, {"displayName": "Other Long Term Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermLiabilities"}, {"displayName": "Shareholder Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.ShareholderNotesPayable"}, {"displayName": "Accruals And Deferred Income", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccrualsAndDeferredIncome"}, {"displayName": "Accrued Long Lerm Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedLongLermLiabilities"}, {"displayName": "Accrued Vacation Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedVacationPayable"}, {"displayName": "Bank Loans", "required": false, "type": "String", "value": "Liability.Long Term Liability.BankLoans"}, {"displayName": "Debts Related To Participating Interests", "required": false, "type": "String", "value": "Liability.Long Term Liability.DebtsRelatedToParticipatingInterests"}, {"displayName": "Deferred Tax Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.DeferredTaxLiabilities"}, {"displayName": "Government And Other Public Authorities", "required": false, "type": "String", "value": "Liability.Long Term Liability.GovernmentAndOtherPublicAuthorities"}, {"displayName": "Group And Associates", "required": false, "type": "String", "value": "Liability.Long Term Liability.GroupAndAssociates"}, {"displayName": "Liabilities Related To Assets Held For Sale", "required": false, "type": "String", "value": "Liability.Long Term Liability.LiabilitiesRelatedToAssetsHeldForSale"}, {"displayName": "Long Term Borrowings", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermBorrowings"}, {"displayName": "Long Term Debit", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermDebit"}, {"displayName": "Long Term Employee Benefit Obligations", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermEmployeeBenefitObligations"}, {"displayName": "Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Long Term Liability.ObligationsUnderFinanceLeases"}, {"displayName": "Other Long Term Provisions", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermProvisions"}, {"displayName": "Provision For Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionForLiabilities"}, {"displayName": "Provisions Non Current Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionsNonCurrentLiabilities"}, {"displayName": "Staff And Related Long Term Liability Accounts", "required": false, "type": "String", "value": "Liability.Long Term Liability.StaffAndRelatedLongTermLiabilityAccounts"}, {"displayName": "Direct Deposit Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DirectDepositPayable"}, {"displayName": "Line Of Credit", "required": false, "type": "String", "value": "Liability.Other Current Liability.LineOfCredit"}, {"displayName": "Loan Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.LoanPayable"}, {"displayName": "Global Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxPayable"}, {"displayName": "Global Tax Suspense", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxSuspense"}, {"displayName": "Other Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.OtherCurrentLiabilities"}, {"displayName": "Payroll Clearing", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollClearing"}, {"displayName": "Payroll Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollTaxPayable"}, {"displayName": "Prepaid Expenses Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PrepaidExpensesPayable"}, {"displayName": "Rents In Trust Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.RentsInTrustLiability"}, {"displayName": "Trust Accounts Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.TrustAccountsLiabilities"}, {"displayName": "Federal Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.FederalIncomeTaxPayable"}, {"displayName": "Insurance Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.InsurancePayable"}, {"displayName": "Sales Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.SalesTaxPayable"}, {"displayName": "State Local Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.StateLocalIncomeTaxPayable"}, {"displayName": "Accrued Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.AccruedLiabilities"}, {"displayName": "Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentLiabilities"}, {"displayName": "Current Portion EmployeeBenefits Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionEmployeeBenefitsObligations"}, {"displayName": "Current Portion Of Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionOfObligationsUnderFinanceLeases"}, {"displayName": "Current Tax Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentTaxLiability"}, {"displayName": "Dividends Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DividendsPayable"}, {"displayName": "Duties And Taxes", "required": false, "type": "String", "value": "Liability.Other Current Liability.DutiesAndTaxes"}, {"displayName": "Interest Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.InterestPayables"}, {"displayName": "Provision For Warranty Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionForWarrantyObligations"}, {"displayName": "Provisions Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionsCurrentLiabilities"}, {"displayName": "Short Term Borrowings", "required": false, "type": "String", "value": "Liability.Other Current Liability.ShortTermBorrowings"}, {"displayName": "Social Security Agencies", "required": false, "type": "String", "value": "Liability.Other Current Liability.SocialSecurityAgencies"}, {"displayName": "Staff And Related Liability Accounts", "required": false, "type": "String", "value": "Liability.Other Current Liability.StaffAndRelatedLiabilityAccounts"}, {"displayName": "Sundry Debtors And Creditors", "required": false, "type": "String", "value": "Liability.Other Current Liability.SundryDebtorsAndCreditors"}, {"displayName": "Trade And Other Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.TradeAndOtherPayables"}, {"displayName": "Opening Balance Equity", "required": false, "type": "String", "value": "Equity.Equity.OpeningBalanceEquity"}, {"displayName": "Partners Equity", "required": false, "type": "String", "value": "Equity.Equity.PartnersEquity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Accumulated Adjustment", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedAdjustment"}, {"displayName": "Owners Equity", "required": false, "type": "String", "value": "Equity.Equity.OwnersEquity"}, {"displayName": "Paid In Capital Or Surplus", "required": false, "type": "String", "value": "Equity.Equity.PaidInCapitalOrSurplus"}, {"displayName": "Partner Contributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerContributions"}, {"displayName": "Partner Distributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerDistributions"}, {"displayName": "Preferred Stock", "required": false, "type": "String", "value": "Equity.Equity.PreferredStock"}, {"displayName": "Common Stock", "required": false, "type": "String", "value": "Equity.Equity.CommonStock"}, {"displayName": "Treasury Stock", "required": false, "type": "String", "value": "Equity.Equity.TreasuryStock"}, {"displayName": "Estimated Taxes", "required": false, "type": "String", "value": "Equity.Equity.EstimatedTaxes"}, {"displayName": "Healthcare", "required": false, "type": "String", "value": "Equity.Equity.Healthcare"}, {"displayName": "Personal Income", "required": false, "type": "String", "value": "Equity.Equity.PersonalIncome"}, {"displayName": "Personal Expense", "required": false, "type": "String", "value": "Equity.Equity.PersonalExpense"}, {"displayName": "Accumulated Other Comprehensive Income", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedOtherComprehensiveIncome"}, {"displayName": "Called Up Share Capital", "required": false, "type": "String", "value": "Equity.Equity.CalledUpShareCapital"}, {"displayName": "Capital Reserves", "required": false, "type": "String", "value": "Equity.Equity.CapitalReserves"}, {"displayName": "Dividend Disbursed", "required": false, "type": "String", "value": "Equity.Equity.DividendDisbursed"}, {"displayName": "Equity In Earnings Of Subsiduaries", "required": false, "type": "String", "value": "Equity.Equity.EquityInEarningsOfSubsiduaries"}, {"displayName": "Investment Grants", "required": false, "type": "String", "value": "Equity.Equity.InvestmentGrants"}, {"displayName": "Money Received Against Share Warrants", "required": false, "type": "String", "value": "Equity.Equity.MoneyReceivedAgainstShareWarrants"}, {"displayName": "Other Free Reserves", "required": false, "type": "String", "value": "Equity.Equity.OtherFreeReserves"}, {"displayName": "Share Application Money Pending Allotment", "required": false, "type": "String", "value": "Equity.Equity.ShareApplicationMoneyPendingAllotment"}, {"displayName": "Share Capital", "required": false, "type": "String", "value": "Equity.Equity.ShareCapital"}, {"displayName": "Funds", "required": false, "type": "String", "value": "Equity.Equity.Funds"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": false, "type": "String", "validation": {"information": [{"details": "If included must have a length between 1 and 7 characters", "field": "NominalCode"}], "warnings": []}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must have a length between 1 and 100 characters", "field": "Name"}]}}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": false, "type": "String", "validation": {"information": [{"details": "When not specified company base currency will be used", "field": "Currency"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Cash On Hand", "required": false, "type": "String", "value": "Asset.Bank.CashOnHand"}, {"displayName": "Checking", "required": false, "type": "String", "value": "Asset.Bank.Checking"}, {"displayName": "Money Market", "required": false, "type": "String", "value": "Asset.Bank.MoneyMarket"}, {"displayName": "Rents Held In Trust", "required": false, "type": "String", "value": "Asset.Bank.RentsHeldInTrust"}, {"displayName": "Savings", "required": false, "type": "String", "value": "Asset.Bank.Savings"}, {"displayName": "Trust Accounts", "required": false, "type": "String", "value": "Asset.Bank.TrustAccounts"}, {"displayName": "Cash And Cash Equivalents", "required": false, "type": "String", "value": "Asset.Bank.CashAndCashEquivalents"}, {"displayName": "Other Earmarked Bank Accounts", "required": false, "type": "String", "value": "Asset.Bank.OtherEarmarkedBankAccounts"}, {"displayName": "Allowance For Bad Debts", "required": false, "type": "String", "value": "Asset.Other Current Asset.AllowanceForBadDebts"}, {"displayName": "Development Costs", "required": false, "type": "String", "value": "Asset.Other Current Asset.DevelopmentCosts"}, {"displayName": "Employee Cash Advances", "required": false, "type": "String", "value": "Asset.Other Current Asset.EmployeeCashAdvances"}, {"displayName": "Other Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherCurrentAssets"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Other Current Asset.Inventory"}, {"displayName": "Investment Mortgage Real Estate Loans", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_MortgageRealEstateLoans"}, {"displayName": "Investment Other", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_Other"}, {"displayName": "Investment Tax Exempt Securities", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_TaxExemptSecurities"}, {"displayName": "Investment US Government Obligations", "required": false, "type": "String", "value": "Asset.Other Current Asset.Investment_USGovernmentObligations"}, {"displayName": "Loans To Officers", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOfficers"}, {"displayName": "Loans To Others", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToOthers"}, {"displayName": "Loans To Stockholders", "required": false, "type": "String", "value": "Asset.Other Current Asset.LoansToStockholders"}, {"displayName": "Prepaid Expenses", "required": false, "type": "String", "value": "Asset.Other Current Asset.PrepaidExpenses"}, {"displayName": "Retainage", "required": false, "type": "String", "value": "Asset.Other Current Asset.Retainage"}, {"displayName": "Undeposited Funds", "required": false, "type": "String", "value": "Asset.Other Current Asset.UndepositedFunds"}, {"displayName": "Assets Available For Sale", "required": false, "type": "String", "value": "Asset.Other Current Asset.AssetsAvailableForSale"}, {"displayName": "Balance With Govt Authorities", "required": false, "type": "String", "value": "Asset.Other Current Asset.BalWithGovtAuthorities"}, {"displayName": "Called Up Share Capital Not Paid", "required": false, "type": "String", "value": "Asset.Other Current Asset.CalledUpShareCapitalNotPaid"}, {"displayName": "Expenditure Authorisations And Letters Of Credit", "required": false, "type": "String", "value": "Asset.Other Current Asset.ExpenditureAuthorisationsAndLettersOfCredit"}, {"displayName": "Global Tax Deferred", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxDeferred"}, {"displayName": "Global Tax Refund", "required": false, "type": "String", "value": "Asset.Other Current Asset.GlobalTaxRefund"}, {"displayName": "Internal Transfers", "required": false, "type": "String", "value": "Asset.Other Current Asset.InternalTransfers"}, {"displayName": "Other Consumables", "required": false, "type": "String", "value": "Asset.Other Current Asset.OtherConsumables"}, {"displayName": "Provisions Current Assets", "required": false, "type": "String", "value": "Asset.Other Current Asset.ProvisionsCurrentAssets"}, {"displayName": "Short Term Investments In Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermInvestmentsInRelatedParties"}, {"displayName": "Short Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Current Asset.ShortTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Trade And Other Receivables", "required": false, "type": "String", "value": "Asset.Other Current Asset.TradeAndOtherReceivables"}, {"displayName": "Accumulated Depletion", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepletion"}, {"displayName": "Accumulated Depreciation", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedDepreciation"}, {"displayName": "Depletable Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.DepletableAssets"}, {"displayName": "Fixed Asset Computers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetComputers"}, {"displayName": "Fixed Asset Copiers", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetCopiers"}, {"displayName": "Fixed Asset Furniture", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetFurniture"}, {"displayName": "Fixed Asset Phone", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhone"}, {"displayName": "Fixed Asset Photo Video", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetPhotoVideo"}, {"displayName": "Fixed Asset Software", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetSoftware"}, {"displayName": "Fixed Asset Other Tools Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.FixedAssetOtherToolsEquipment"}, {"displayName": "Furniture And Fixtures", "required": false, "type": "String", "value": "Asset.Fixed Asset.FurnitureAndFixtures"}, {"displayName": "Land", "required": false, "type": "String", "value": "Asset.Fixed Asset.Land"}, {"displayName": "Leasehold Improvements", "required": false, "type": "String", "value": "Asset.Fixed Asset.LeaseholdImprovements"}, {"displayName": "Other Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.OtherFixedAssets"}, {"displayName": "Accumulated Amortization", "required": false, "type": "String", "value": "Asset.Fixed Asset.AccumulatedAmortization"}, {"displayName": "Buildings", "required": false, "type": "String", "value": "Asset.Fixed Asset.Buildings"}, {"displayName": "Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssets"}, {"displayName": "Machinery And Equipment", "required": false, "type": "String", "value": "Asset.Fixed Asset.MachineryAndEquipment"}, {"displayName": "Vehicles", "required": false, "type": "String", "value": "Asset.Fixed Asset.Vehicles"}, {"displayName": "Assets In Course Of Construction", "required": false, "type": "String", "value": "Asset.Fixed Asset.AssetsInCourseOfConstruction"}, {"displayName": "Capital Wip", "required": false, "type": "String", "value": "Asset.Fixed Asset.CapitalWip"}, {"displayName": "Cumulative Depreciation On Intangible Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.CumulativeDepreciationOnIntangibleAssets"}, {"displayName": "Intangible Assets Under Development", "required": false, "type": "String", "value": "Asset.Fixed Asset.IntangibleAssetsUnderDevelopment"}, {"displayName": "Land Asset", "required": false, "type": "String", "value": "Asset.Fixed Asset.LandAsset"}, {"displayName": "Non Current Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.NonCurrentAssets"}, {"displayName": "Participating Interests", "required": false, "type": "String", "value": "Asset.Fixed Asset.ParticipatingInterests"}, {"displayName": "Provisions Fixed Assets", "required": false, "type": "String", "value": "Asset.Fixed Asset.ProvisionsFixedAssets"}, {"displayName": "Lease Buyout", "required": false, "type": "String", "value": "Asset.Other Asset.LeaseBuyout"}, {"displayName": "Other Long Term Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermAssets"}, {"displayName": "Security Deposits", "required": false, "type": "String", "value": "Asset.Other Asset.SecurityDeposits"}, {"displayName": "Accumulated Amortization Of Other Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AccumulatedAmortizationOfOtherAssets"}, {"displayName": "Goodwill", "required": false, "type": "String", "value": "Asset.Other Asset.Goodwill"}, {"displayName": "Licenses", "required": false, "type": "String", "value": "Asset.Other Asset.Licenses"}, {"displayName": "Organizational Costs", "required": false, "type": "String", "value": "Asset.Other Asset.OrganizationalCosts"}, {"displayName": "Assets Held For Sale", "required": false, "type": "String", "value": "Asset.Other Asset.AssetsHeldForSale"}, {"displayName": "Available For Sale Financial Assets", "required": false, "type": "String", "value": "Asset.Other Asset.AvailableForSaleFinancialAssets"}, {"displayName": "Deferred Tax", "required": false, "type": "String", "value": "Asset.Other Asset.DeferredTax"}, {"displayName": "Investments", "required": false, "type": "String", "value": "Asset.Other Asset.Investments"}, {"displayName": "Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermInvestments"}, {"displayName": "Long Term Loans And Advances To Related Parties", "required": false, "type": "String", "value": "Asset.Other Asset.LongTermLoansAndAdvancesToRelatedParties"}, {"displayName": "Other Intangible Assets", "required": false, "type": "String", "value": "Asset.Other Asset.OtherIntangibleAssets"}, {"displayName": "Other Long Term Investments", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermInvestments"}, {"displayName": "Other Long Term Loans And Advances", "required": false, "type": "String", "value": "Asset.Other Asset.OtherLongTermLoansAndAdvances"}, {"displayName": "Prepayments And Accrued Income", "required": false, "type": "String", "value": "Asset.Other Asset.PrepaymentsAndAccruedIncome"}, {"displayName": "Provisions Non-Current Assets", "required": false, "type": "String", "value": "Asset.Other Asset.ProvisionsNonCurrentAssets"}, {"displayName": "Accounts Receivable", "required": false, "type": "String", "value": "Asset.Accounts Receivable.AccountsReceivable"}, {"displayName": "Advertising/Promotional", "required": false, "type": "String", "value": "Expense.Expense.AdvertisingPromotional"}, {"displayName": "Bad Debts", "required": false, "type": "String", "value": "Expense.Expense.BadDebts"}, {"displayName": "Bank Charges", "required": false, "type": "String", "value": "Expense.Expense.BankCharges"}, {"displayName": "Charitable Contributions", "required": false, "type": "String", "value": "Expense.Expense.CharitableContributions"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Entertainment", "required": false, "type": "String", "value": "Expense.Expense.Entertainment"}, {"displayName": "Entertainment Meals", "required": false, "type": "String", "value": "Expense.Expense.EntertainmentMeals"}, {"displayName": "Equipment Rental", "required": false, "type": "String", "value": "Expense.Expense.EquipmentRental"}, {"displayName": "Finance Costs", "required": false, "type": "String", "value": "Expense.Expense.FinanceCosts"}, {"displayName": "Global Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.GlobalTaxExpense"}, {"displayName": "Insurance", "required": false, "type": "String", "value": "Expense.Expense.Insurance"}, {"displayName": "Interest Paid", "required": false, "type": "String", "value": "Expense.Expense.InterestPaid"}, {"displayName": "Legal And Professional Fees", "required": false, "type": "String", "value": "Expense.Expense.LegalProfessionalFees"}, {"displayName": "Office Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeExpenses"}, {"displayName": "Office/General Administrative Expenses", "required": false, "type": "String", "value": "Expense.Expense.OfficeGeneralAdministrativeExpenses"}, {"displayName": "Other Business Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherBusinessExpenses"}, {"displayName": "Other Miscellaneous Service Cost", "required": false, "type": "String", "value": "Expense.Expense.OtherMiscellaneousServiceCost"}, {"displayName": "Promotional Meals", "required": false, "type": "String", "value": "Expense.Expense.PromotionalMeals"}, {"displayName": "Rent Or Lease Of Buildings", "required": false, "type": "String", "value": "Expense.Expense.RentOrLeaseOfBuildings"}, {"displayName": "Repair And Maintenance", "required": false, "type": "String", "value": "Expense.Expense.RepairMaintenance"}, {"displayName": "Shipping, Freight And Delivery", "required": false, "type": "String", "value": "Expense.Expense.ShippingFreightDelivery"}, {"displayName": "Supplies And Materials", "required": false, "type": "String", "value": "Expense.Expense.SuppliesMaterials"}, {"displayName": "Travel", "required": false, "type": "String", "value": "Expense.Expense.Travel"}, {"displayName": "Travel Meals", "required": false, "type": "String", "value": "Expense.Expense.TravelMeals"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Auto", "required": false, "type": "String", "value": "Expense.Expense.Auto"}, {"displayName": "Cost Of Labor", "required": false, "type": "String", "value": "Expense.Expense.CostOfLabor"}, {"displayName": "Dues And Subscriptions", "required": false, "type": "String", "value": "Expense.Expense.DuesSubscriptions"}, {"displayName": "Payroll Expenses", "required": false, "type": "String", "value": "Expense.Expense.PayrollExpenses"}, {"displayName": "Taxes Paid", "required": false, "type": "String", "value": "Expense.Expense.TaxesPaid"}, {"displayName": "Unapplied Cash Bill Payment Expense", "required": false, "type": "String", "value": "Expense.Expense.UnappliedCashBillPaymentExpense"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Expense.Utilities"}, {"displayName": "Amortization Expense", "required": false, "type": "String", "value": "Expense.Expense.AmortizationExpense"}, {"displayName": "Appropriations To Depreciation", "required": false, "type": "String", "value": "Expense.Expense.AppropriationsToDepreciation"}, {"displayName": "Borrowing Cost", "required": false, "type": "String", "value": "Expense.Expense.BorrowingCost"}, {"displayName": "Commissions And Fees", "required": false, "type": "String", "value": "Expense.Expense.CommissionsAndFees"}, {"displayName": "Distribution Costs", "required": false, "type": "String", "value": "Expense.Expense.DistributionCosts"}, {"displayName": "External Services", "required": false, "type": "String", "value": "Expense.Expense.ExternalServices"}, {"displayName": "Extraordinary Charges", "required": false, "type": "String", "value": "Expense.Expense.ExtraordinaryCharges"}, {"displayName": "Income Tax Expense", "required": false, "type": "String", "value": "Expense.Expense.IncomeTaxExpense"}, {"displayName": "Loss On Discontinued Operations Net Of Tax", "required": false, "type": "String", "value": "Expense.Expense.LossOnDiscontinuedOperationsNetOfTax"}, {"displayName": "Management Compensation", "required": false, "type": "String", "value": "Expense.Expense.ManagementCompensation"}, {"displayName": "Other Current Operating Charges", "required": false, "type": "String", "value": "Expense.Expense.OtherCurrentOperatingCharges"}, {"displayName": "Other External Services", "required": false, "type": "String", "value": "Expense.Expense.OtherExternalServices"}, {"displayName": "Other Rental Costs", "required": false, "type": "String", "value": "Expense.Expense.OtherRentalCosts"}, {"displayName": "Other Selling Expenses", "required": false, "type": "String", "value": "Expense.Expense.OtherSellingExpenses"}, {"displayName": "Project Studies Surveys Assessments", "required": false, "type": "String", "value": "Expense.Expense.ProjectStudiesSurveysAssessments"}, {"displayName": "Purchases Rebates", "required": false, "type": "String", "value": "Expense.Expense.PurchasesRebates"}, {"displayName": "Shipping And Delivery Expense", "required": false, "type": "String", "value": "Expense.Expense.ShippingAndDeliveryExpense"}, {"displayName": "Staff Costs", "required": false, "type": "String", "value": "Expense.Expense.StaffCosts"}, {"displayName": "Sundry", "required": false, "type": "String", "value": "Expense.Expense.Sundry"}, {"displayName": "Travel Expenses General And Admin Expenses", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesGeneralAndAdminExpenses"}, {"displayName": "Travel Expenses Selling Expense", "required": false, "type": "String", "value": "Expense.Expense.TravelExpensesSellingExpense"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Expense.Other Expense.Depreciation"}, {"displayName": "Exchange Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.ExchangeGainOrLoss"}, {"displayName": "Other Miscellaneous Expense", "required": false, "type": "String", "value": "Expense.Other Expense.OtherMiscellaneousExpense"}, {"displayName": "Penalties And Settlements", "required": false, "type": "String", "value": "Expense.Other Expense.PenaltiesSettlements"}, {"displayName": "Amortization", "required": false, "type": "String", "value": "Expense.Other Expense.Amortization"}, {"displayName": "Gas And Fuel", "required": false, "type": "String", "value": "Expense.Other Expense.GasAndFuel"}, {"displayName": "Home Office", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOffice"}, {"displayName": "Home Owner Rental Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.HomeOwnerRentalInsurance"}, {"displayName": "Other Home Office Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherHomeOfficeExpenses"}, {"displayName": "Mortgage Interest", "required": false, "type": "String", "value": "Expense.Other Expense.MortgageInterest"}, {"displayName": "Rent And Lease", "required": false, "type": "String", "value": "Expense.Other Expense.RentAndLease"}, {"displayName": "Repairs And Maintenance", "required": false, "type": "String", "value": "Expense.Other Expense.RepairsAndMaintenance"}, {"displayName": "Parking And Tolls", "required": false, "type": "String", "value": "Expense.Other Expense.ParkingAndTolls"}, {"displayName": "Vehicle", "required": false, "type": "String", "value": "Expense.Other Expense.Vehicle"}, {"displayName": "Vehicle Insurance", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleInsurance"}, {"displayName": "Vehicle Lease", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLease"}, {"displayName": "Vehicle Loan Interest", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoanInterest"}, {"displayName": "Vehicle Loan", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleLoan"}, {"displayName": "Vehicle Registration", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRegistration"}, {"displayName": "Vehicle Repairs", "required": false, "type": "String", "value": "Expense.Other Expense.VehicleRepairs"}, {"displayName": "Other Vehicle Expenses", "required": false, "type": "String", "value": "Expense.Other Expense.OtherVehicleExpenses"}, {"displayName": "Utilities", "required": false, "type": "String", "value": "Expense.Other Expense.Utilities"}, {"displayName": "Wash And Road Services", "required": false, "type": "String", "value": "Expense.Other Expense.WashAndRoadServices"}, {"displayName": "Deferred Tax Expense", "required": false, "type": "String", "value": "Expense.Other Expense.DeferredTaxExpense"}, {"displayName": "Depletion", "required": false, "type": "String", "value": "Expense.Other Expense.Depletion"}, {"displayName": "Exceptional Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExceptionalItems"}, {"displayName": "Extraordinary Items", "required": false, "type": "String", "value": "Expense.Other Expense.ExtraordinaryItems"}, {"displayName": "Income Tax Other Expense", "required": false, "type": "String", "value": "Expense.Other Expense.IncomeTaxOtherExpense"}, {"displayName": "Mat Credit", "required": false, "type": "String", "value": "Expense.Other Expense.MatCredit"}, {"displayName": "Prior Period Items", "required": false, "type": "String", "value": "Expense.Other Expense.PriorPeriodItems"}, {"displayName": "Tax Roundoff Gain Or Loss", "required": false, "type": "String", "value": "Expense.Other Expense.TaxRoundoffGainOrLoss"}, {"displayName": "Equipment Rental - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.EquipmentRentalCos"}, {"displayName": "Other Costs Of Sales - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.OtherCostsOfServiceCos"}, {"displayName": "Shipping, Freight And Delivery - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.ShippingFreightDeliveryCos"}, {"displayName": "Supplies And Materials - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.SuppliesMaterialsCogs"}, {"displayName": "Cost Of Labor - COS", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfLaborCos"}, {"displayName": "Cost Of Sales", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.CostOfSales"}, {"displayName": "Freight And Delivery Cost", "required": false, "type": "String", "value": "Expense.Cost of Goods Sold.FreightAndDeliveryCost"}, {"displayName": "Non Profit Income", "required": false, "type": "String", "value": "Income.Income.NonProfitIncome"}, {"displayName": "Other Primary Income", "required": false, "type": "String", "value": "Income.Income.OtherPrimaryIncome"}, {"displayName": "Sales Of ProductIncome", "required": false, "type": "String", "value": "Income.Income.SalesOfProductIncome"}, {"displayName": "Service Fee Income", "required": false, "type": "String", "value": "Income.Income.ServiceFeeIncome"}, {"displayName": "Discounts Refunds Given", "required": false, "type": "String", "value": "Income.Income.DiscountsRefundsGiven"}, {"displayName": "Unapplied Cash Payment Income", "required": false, "type": "String", "value": "Income.Income.UnappliedCashPaymentIncome"}, {"displayName": "Cash Receipt Income", "required": false, "type": "String", "value": "Income.Income.CashReceiptIncome"}, {"displayName": "Operating Grants", "required": false, "type": "String", "value": "Income.Income.OperatingGrants"}, {"displayName": "Other Current Operating Income", "required": false, "type": "String", "value": "Income.Income.OtherCurrentOperatingIncome"}, {"displayName": "Own Work Capitalized", "required": false, "type": "String", "value": "Income.Income.OwnWorkCapitalized"}, {"displayName": "Revenue General", "required": false, "type": "String", "value": "Income.Income.RevenueGeneral"}, {"displayName": "Sales Retail", "required": false, "type": "String", "value": "Income.Income.SalesRetail"}, {"displayName": "Sales Wholesale", "required": false, "type": "String", "value": "Income.Income.SalesWholesale"}, {"displayName": "Savings By Tax Scheme", "required": false, "type": "String", "value": "Income.Income.SavingsByTaxScheme"}, {"displayName": "Dividend Income", "required": false, "type": "String", "value": "Income.Other Income.DividendIncome"}, {"displayName": "Interest Earned", "required": false, "type": "String", "value": "Income.Other Income.InterestEarned"}, {"displayName": "Other Investment Income", "required": false, "type": "String", "value": "Income.Other Income.OtherInvestmentIncome"}, {"displayName": "Other Miscellaneous Income", "required": false, "type": "String", "value": "Income.Other Income.OtherMiscellaneousIncome"}, {"displayName": "Tax Exempt Interest", "required": false, "type": "String", "value": "Income.Other Income.TaxExemptInterest"}, {"displayName": "Gain Loss On Sale Of Fixed Assets", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfFixedAssets"}, {"displayName": "Gain Loss On Sale Of Investments", "required": false, "type": "String", "value": "Income.Other Income.GainLossOnSaleOfInvestments"}, {"displayName": "Loss On Disposal Of Assets", "required": false, "type": "String", "value": "Income.Other Income.LossOnDisposalOfAssets"}, {"displayName": "Other Operating Income", "required": false, "type": "String", "value": "Income.Other Income.OtherOperatingIncome"}, {"displayName": "Unrealised Loss On Securities Net Of Tax", "required": false, "type": "String", "value": "Income.Other Income.UnrealisedLossOnSecuritiesNetOfTax"}, {"displayName": "Accounts Payable", "required": false, "type": "String", "value": "Liability.Accounts Payable.AccountsPayable"}, {"displayName": "Outstanding Dues Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesMicroSmallEnterprise"}, {"displayName": "Outstanding Dues Other Than Micro Small Enterprise", "required": false, "type": "String", "value": "Liability.Accounts Payable.OutstandingDuesOtherThanMicroSmallEnterprise"}, {"displayName": "Credit Card", "required": false, "type": "String", "value": "Liability.Credit Card.CreditCard"}, {"displayName": "Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.NotesPayable"}, {"displayName": "Other Long Term Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermLiabilities"}, {"displayName": "Shareholder Notes Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.ShareholderNotesPayable"}, {"displayName": "Accruals And Deferred Income", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccrualsAndDeferredIncome"}, {"displayName": "Accrued Long Lerm Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedLongLermLiabilities"}, {"displayName": "Accrued Vacation Payable", "required": false, "type": "String", "value": "Liability.Long Term Liability.AccruedVacationPayable"}, {"displayName": "Bank Loans", "required": false, "type": "String", "value": "Liability.Long Term Liability.BankLoans"}, {"displayName": "Debts Related To Participating Interests", "required": false, "type": "String", "value": "Liability.Long Term Liability.DebtsRelatedToParticipatingInterests"}, {"displayName": "Deferred Tax Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.DeferredTaxLiabilities"}, {"displayName": "Government And Other Public Authorities", "required": false, "type": "String", "value": "Liability.Long Term Liability.GovernmentAndOtherPublicAuthorities"}, {"displayName": "Group And Associates", "required": false, "type": "String", "value": "Liability.Long Term Liability.GroupAndAssociates"}, {"displayName": "Liabilities Related To Assets Held For Sale", "required": false, "type": "String", "value": "Liability.Long Term Liability.LiabilitiesRelatedToAssetsHeldForSale"}, {"displayName": "Long Term Borrowings", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermBorrowings"}, {"displayName": "Long Term Debit", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermDebit"}, {"displayName": "Long Term Employee Benefit Obligations", "required": false, "type": "String", "value": "Liability.Long Term Liability.LongTermEmployeeBenefitObligations"}, {"displayName": "Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Long Term Liability.ObligationsUnderFinanceLeases"}, {"displayName": "Other Long Term Provisions", "required": false, "type": "String", "value": "Liability.Long Term Liability.OtherLongTermProvisions"}, {"displayName": "Provision For Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionForLiabilities"}, {"displayName": "Provisions Non Current Liabilities", "required": false, "type": "String", "value": "Liability.Long Term Liability.ProvisionsNonCurrentLiabilities"}, {"displayName": "Staff And Related Long Term Liability Accounts", "required": false, "type": "String", "value": "Liability.Long Term Liability.StaffAndRelatedLongTermLiabilityAccounts"}, {"displayName": "Direct Deposit Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DirectDepositPayable"}, {"displayName": "Line Of Credit", "required": false, "type": "String", "value": "Liability.Other Current Liability.LineOfCredit"}, {"displayName": "Loan Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.LoanPayable"}, {"displayName": "Global Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxPayable"}, {"displayName": "Global Tax Suspense", "required": false, "type": "String", "value": "Liability.Other Current Liability.GlobalTaxSuspense"}, {"displayName": "Other Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.OtherCurrentLiabilities"}, {"displayName": "Payroll Clearing", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollClearing"}, {"displayName": "Payroll Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PayrollTaxPayable"}, {"displayName": "Prepaid Expenses Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.PrepaidExpensesPayable"}, {"displayName": "Rents In Trust Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.RentsInTrustLiability"}, {"displayName": "Trust Accounts Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.TrustAccountsLiabilities"}, {"displayName": "Federal Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.FederalIncomeTaxPayable"}, {"displayName": "Insurance Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.InsurancePayable"}, {"displayName": "Sales Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.SalesTaxPayable"}, {"displayName": "State Local Income Tax Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.StateLocalIncomeTaxPayable"}, {"displayName": "Accrued Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.AccruedLiabilities"}, {"displayName": "Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentLiabilities"}, {"displayName": "Current Portion EmployeeBenefits Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionEmployeeBenefitsObligations"}, {"displayName": "Current Portion Of Obligations Under Finance Leases", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentPortionOfObligationsUnderFinanceLeases"}, {"displayName": "Current Tax Liability", "required": false, "type": "String", "value": "Liability.Other Current Liability.CurrentTaxLiability"}, {"displayName": "Dividends Payable", "required": false, "type": "String", "value": "Liability.Other Current Liability.DividendsPayable"}, {"displayName": "Duties And Taxes", "required": false, "type": "String", "value": "Liability.Other Current Liability.DutiesAndTaxes"}, {"displayName": "Interest Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.InterestPayables"}, {"displayName": "Provision For Warranty Obligations", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionForWarrantyObligations"}, {"displayName": "Provisions Current Liabilities", "required": false, "type": "String", "value": "Liability.Other Current Liability.ProvisionsCurrentLiabilities"}, {"displayName": "Short Term Borrowings", "required": false, "type": "String", "value": "Liability.Other Current Liability.ShortTermBorrowings"}, {"displayName": "Social Security Agencies", "required": false, "type": "String", "value": "Liability.Other Current Liability.SocialSecurityAgencies"}, {"displayName": "Staff And Related Liability Accounts", "required": false, "type": "String", "value": "Liability.Other Current Liability.StaffAndRelatedLiabilityAccounts"}, {"displayName": "Sundry Debtors And Creditors", "required": false, "type": "String", "value": "Liability.Other Current Liability.SundryDebtorsAndCreditors"}, {"displayName": "Trade And Other Payables", "required": false, "type": "String", "value": "Liability.Other Current Liability.TradeAndOtherPayables"}, {"displayName": "Opening Balance Equity", "required": false, "type": "String", "value": "Equity.Equity.OpeningBalanceEquity"}, {"displayName": "Partners Equity", "required": false, "type": "String", "value": "Equity.Equity.PartnersEquity"}, {"displayName": "Retained Earnings", "required": false, "type": "String", "value": "Equity.Equity.RetainedEarnings"}, {"displayName": "Accumulated Adjustment", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedAdjustment"}, {"displayName": "Owners Equity", "required": false, "type": "String", "value": "Equity.Equity.OwnersEquity"}, {"displayName": "Paid In Capital Or Surplus", "required": false, "type": "String", "value": "Equity.Equity.PaidInCapitalOrSurplus"}, {"displayName": "Partner Contributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerContributions"}, {"displayName": "Partner Distributions", "required": false, "type": "String", "value": "Equity.Equity.PartnerDistributions"}, {"displayName": "Preferred Stock", "required": false, "type": "String", "value": "Equity.Equity.PreferredStock"}, {"displayName": "Common Stock", "required": false, "type": "String", "value": "Equity.Equity.CommonStock"}, {"displayName": "Treasury Stock", "required": false, "type": "String", "value": "Equity.Equity.TreasuryStock"}, {"displayName": "Estimated Taxes", "required": false, "type": "String", "value": "Equity.Equity.EstimatedTaxes"}, {"displayName": "Healthcare", "required": false, "type": "String", "value": "Equity.Equity.Healthcare"}, {"displayName": "Personal Income", "required": false, "type": "String", "value": "Equity.Equity.PersonalIncome"}, {"displayName": "Personal Expense", "required": false, "type": "String", "value": "Equity.Equity.PersonalExpense"}, {"displayName": "Accumulated Other Comprehensive Income", "required": false, "type": "String", "value": "Equity.Equity.AccumulatedOtherComprehensiveIncome"}, {"displayName": "Called Up Share Capital", "required": false, "type": "String", "value": "Equity.Equity.CalledUpShareCapital"}, {"displayName": "Capital Reserves", "required": false, "type": "String", "value": "Equity.Equity.CapitalReserves"}, {"displayName": "Dividend Disbursed", "required": false, "type": "String", "value": "Equity.Equity.DividendDisbursed"}, {"displayName": "Equity In Earnings Of Subsiduaries", "required": false, "type": "String", "value": "Equity.Equity.EquityInEarningsOfSubsiduaries"}, {"displayName": "Investment Grants", "required": false, "type": "String", "value": "Equity.Equity.InvestmentGrants"}, {"displayName": "Money Received Against Share Warrants", "required": false, "type": "String", "value": "Equity.Equity.MoneyReceivedAgainstShareWarrants"}, {"displayName": "Other Free Reserves", "required": false, "type": "String", "value": "Equity.Equity.OtherFreeReserves"}, {"displayName": "Share Application Money Pending Allotment", "required": false, "type": "String", "value": "Equity.Equity.ShareApplicationMoneyPendingAllotment"}, {"displayName": "Share Capital", "required": false, "type": "String", "value": "Equity.Equity.ShareCapital"}, {"displayName": "Funds", "required": false, "type": "String", "value": "Equity.Equity.Funds"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Should not be longer than 200 characters.", "field": "Name"}], "warnings": []}}, "nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [{"details": "Should be a number between 1 and 99999999.", "field": "NominalCode"}], "warnings": []}}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "options": [{"displayName": "Sales", "required": false, "type": "String", "value": "SALES"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "OTHER_INCOME"}, {"displayName": "Direct Expenses", "required": false, "type": "String", "value": "DIRECT_EXPENSES"}, {"displayName": "Overheads", "required": false, "type": "String", "value": "OVERHEADS"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "DEPRECIATION"}, {"displayName": "Current Assets", "required": false, "type": "String", "value": "CURRENT_ASSETS"}, {"displayName": "Fixed Assets", "required": false, "type": "String", "value": "FIXED_ASSETS"}, {"displayName": "Future Assets", "required": false, "type": "String", "value": "FUTURE_ASSETS"}, {"displayName": "Bank", "required": false, "type": "String", "value": "BANK"}, {"displayName": "Current Liability", "required": false, "type": "String", "value": "CURRENT_LIABILITY"}, {"displayName": "Future Liability", "required": false, "type": "String", "value": "FUTURE_LIABILITY"}, {"displayName": "Equity", "required": false, "type": "String", "value": "EQUITY"}, {"displayName": "Credit Card / Loan", "required": false, "type": "String", "value": "LINE_OF_CREDIT"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Must be unique within the entity.", "field": "NominalCode"}, {"details": "Must be at most 24 characters in length, although restrictions may vary between entities.", "field": "NominalCode"}]}}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "options": [{"displayName": "Active", "required": false, "type": "String", "value": "Active"}, {"displayName": "Archived", "required": false, "type": "String", "value": "Archived"}], "required": true, "type": "String"}, "type": {"description": "The type, or base category, of the account", "displayName": "Account Type", "options": [{"displayName": "Asset", "required": false, "type": "String", "value": "Asset"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense"}, {"displayName": "Income", "required": false, "type": "String", "value": "Income"}, {"displayName": "Liability", "required": false, "type": "String", "value": "Liability"}], "required": true, "type": "String"}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "required": true, "type": "String", "validation": {"information": [{"details": "Any category that is part of the hierarchy of one of: 'Assets', 'Equity', 'Liabilities', 'Total Expenses' and 'Total Income' is permitted.", "field": "FullyQualifiedCategory"}], "warnings": []}}}, "required": true, "type": "Object"} + Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "The external reference given to each nominal account for a business", "displayName": "Nominal Code", "required": true, "type": "String"}, "name": {"description": "Name of the account", "displayName": "Name", "required": true, "type": "String"}, "description": {"description": "Description of the account", "displayName": "Description", "required": true, "type": "String"}, "fullyQualifiedCategory": {"description": "The full category of the account e.g. Liability.Current or Income.Revenue", "displayName": "Fully Qualified Category", "required": true, "type": "String"}, "fullyQualifiedName": {"description": "The full name of the account e.g. Liability.Current.VAT or Income.Revenue.Sales", "displayName": "Fully Qualified Name", "required": true, "type": "String"}, "currency": {"description": "The currency of the account", "displayName": "Currency", "required": true, "type": "String"}, "currentBalance": {"description": "The current balance in the account", "displayName": "Current Balance", "required": true, "type": "Number"}, "type": {"description": "The type, or base category, of the account", "displayName": "Account Type", "required": true, "type": "String"}, "status": {"description": "The status of the account", "displayName": "Account Status", "required": true, "type": "String"}, "isBankAccount": {"description": "Confirms whether the nominal account represents a bank account or not", "displayName": "Is Bank Account?", "required": true, "type": "Boolean"}, "validDatatypeLinks": {"description": "Describes which fields on other data types are valid links to this account in the originating system", "displayName": "Valid Datatype Links", "required": true, "type": "Array"}, "metadata": {"description": "Miscellaneous data about the item", "displayName": "Metadata", "required": true, "type": "Object"}}, "required": true, "type": "Object"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "200": + application/json: {"description": "Nominal Accounts are the categories a business uses to record transactions", "displayName": "Nominal Account", "properties": {"nominalCode": {"description": "Identifier for the nominal account.", "displayName": "Nominal Code", "required": true, "type": "String", "validation": {"information": [], "warnings": [{"details": "Max length of 10 characters.", "field": "NominalCode"}]}}, "name": {"description": "Name of account as it appears in the chart of accounts or general ledger.", "displayName": "Name", "required": true, "type": "String", "validation": {"information": [{"details": "Payments are enabled to this account if the name ends in .PaymentsEnabled.", "field": "Name"}], "warnings": []}}, "description": {"description": "Description for the nominal account.", "displayName": "Description", "required": false, "type": "String"}, "fullyQualifiedCategory": {"description": "Account type and category for nominal account.", "displayName": "Fully Qualified Category", "options": [{"displayName": "Current Asset", "required": false, "type": "String", "value": "Asset.Current"}, {"displayName": "Fixed Asset", "required": false, "type": "String", "value": "Asset.Fixed"}, {"displayName": "Inventory", "required": false, "type": "String", "value": "Asset.Inventory"}, {"displayName": "Non-current Asset", "required": false, "type": "String", "value": "Asset.NonCurrent"}, {"displayName": "Prepayment", "required": false, "type": "String", "value": "Asset.Prepayment"}, {"displayName": "Direct Costs", "required": false, "type": "String", "value": "Expense.DirectCosts"}, {"displayName": "Expense", "required": false, "type": "String", "value": "Expense.Expense"}, {"displayName": "Overhead", "required": false, "type": "String", "value": "Expense.Overhead"}, {"displayName": "Superannuation", "required": false, "type": "String", "value": "Expense.Superannuation"}, {"displayName": "Wages", "required": false, "type": "String", "value": "Expense.Wages"}, {"displayName": "Sales", "required": false, "type": "String", "value": "Income.Sales"}, {"displayName": "Revenue", "required": false, "type": "String", "value": "Income.Revenue"}, {"displayName": "Other Income", "required": false, "type": "String", "value": "Income.Other"}, {"displayName": "Current Liability", "required": false, "type": "String", "value": "Liability.Current"}, {"displayName": "Depreciation", "required": false, "type": "String", "value": "Liability.Depreciation"}, {"displayName": "Liability", "required": false, "type": "String", "value": "Liability.Liability"}, {"displayName": "Non Current Liability", "required": false, "type": "String", "value": "Liability.NonCurrent"}, {"displayName": "Pay As You Go Liability", "required": false, "type": "String", "value": "Liability.PayAsYouGo"}, {"displayName": "Superannuation Liability", "required": false, "type": "String", "value": "Liability.Superannuation"}, {"displayName": "Wages Payable Liability", "required": false, "type": "String", "value": "Liability.WagesPayable"}, {"displayName": "Equity", "required": false, "type": "String", "value": "Equity.Equity"}], "required": true, "type": "String"}}, "required": true, "type": "Object"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-customer: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"contacts": [], "defaultCurrency": "USD", "modifiedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-customer: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Fernandohaven", "country": "United Kingdom", "line1": "Suite 214", "line2": "8439 Lueilwitz Passage", "postalCode": "JG04 7PV", "region": "Northern Ireland", "type": "Delivery"}, {"city": "Juliochester", "country": "United Kingdom", "line1": "Suite 096", "line2": "864 Halie Course", "postalCode": "DZ8 4BF", "region": "England", "type": "Delivery"}, {"city": "Naderborough", "country": "United Kingdom", "line1": "Suite 001", "line2": "416 Stokes Fords", "postalCode": "XG25 0XX", "region": "Wales", "type": "Delivery"}], "contactName": "Werner Langworth", "contacts": [{"address": {"city": "Hortenseville", "country": "United Kingdom", "line1": "Apt. 145", "line2": "317 Williamson Freeway", "postalCode": "CV4 2HR", "region": "Scotland", "type": "Delivery"}, "email": "Werner_Langworth@hotmail.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Werner Langworth", "phone": [], "status": "Active"}, {"address": {"city": "South Ali", "country": "United Kingdom", "line1": "Suite 075", "line2": "9921 Dickens Walk", "postalCode": "TI04 4OO", "region": "Scotland", "type": "Delivery"}, "email": "Belle51@yahoo.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Belle Glover", "phone": [], "status": "Active"}], "customerName": "Arjun Kuvalis", "defaultCurrency": "GBP", "emailAddress": "Arjun34@hotmail.com", "id": "c8180244-74ac-40cf-a5df-6d83661c44d7", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:16Z", "phone": "014605 64820", "registrationNumber": "NI7JEJVM", "sourceModifiedDate": "2022-07-03T01:27:00", "status": "Active", "taxNumber": "7505220209.583549"} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "contacts": [{"address": {"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}, "email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "", "phone": [], "status": "Active"}], "customerName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "0e2f7751-7696-ed11-bff5-6045bd0d2ad6", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:25Z", "phone": "", "sourceModifiedDate": "2023-01-17T14:50:54Z", "status": "Active", "taxNumber": ""} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"country": "NL", "type": "Billing"}], "contacts": [], "customerName": "Ab Netherlands", "defaultCurrency": "EUR", "id": "555f8251-c65a-433a-a813-5dbe04321d1e", "modifiedDate": "2022-10-26T13:32:05Z", "sourceModifiedDate": "2021-06-14T15:26:37Z", "status": "Active"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "London", "country": "GB", "line1": "Ink Rooms", "postalCode": "WC1X 0BE", "type": "Billing"}], "contacts": [], "customerName": "Abdi 99", "defaultCurrency": "GBP", "emailAddress": "email@codat.io", "id": "5f20075a-a28e-434d-81a6-2db0dc170e87", "modifiedDate": "2022-10-26T13:33:08Z", "registrationNumber": "123456789", "sourceModifiedDate": "2020-02-26T11:23:50Z", "status": "Active", "taxNumber": "GB339 0727 47"} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "contacts": [{"address": {"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Test 1", "phone": [], "status": "Unknown"}], "customerName": "-", "defaultCurrency": "USD", "id": "11526230", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sourceModifiedDate": "2023-04-17T06:02:46Z", "status": "Active"} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Some city", "country": "Country 1", "line1": "Line 1", "line2": "Line 2", "postalCode": "SW1 2JQ", "region": "A region", "type": "Billing"}], "contactName": "test person name", "contacts": [{"email": "test14A@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person1", "phone": [{"number": "24681012", "type": "Primary"}, {"number": "121086420", "type": "Unknown"}], "status": "Active"}, {"email": "test14B@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person2", "phone": [{"number": "123456789", "type": "Primary"}, {"number": "987654321", "type": "Unknown"}], "status": "Active"}, {"email": "test14@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person name", "phone": [{"number": "01876 541245", "type": "Unknown"}], "status": "Active"}], "customerName": "A test customer 14 (updated)", "defaultCurrency": "GBP", "emailAddress": "test14@example.com", "id": "634509", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:23Z", "phone": "01876 541245", "sourceModifiedDate": "2022-05-18T09:23:56", "status": "Active"} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contactName": "", "contacts": [{"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "", "phone": [], "status": "Active"}], "customerName": "Chekko Customer Test 01", "defaultCurrency": "EUR", "emailAddress": "", "id": "92227673", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "", "sourceModifiedDate": "0001-01-01T00:00:00", "status": "Active", "taxNumber": ""} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contactName": "Mr Test Customer", "contacts": [], "customerName": "119 Test Customer", "defaultCurrency": "GBP", "id": "773", "modifiedDate": "2023-01-30T14:48:02Z", "sourceModifiedDate": "2022-01-11T12:28:49", "status": "Active"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Bayshore", "line1": "Kristy Abercrombie", "line2": "5647 Cypress Hill Rd", "postalCode": "94326", "region": "CA", "type": "Delivery"}, {"city": "Bayshore", "line1": "Kristy Abercrombie", "line2": "5647 Cypress Hill Rd", "postalCode": "94326", "region": "CA", "type": "Billing"}], "contactName": "Kristy Abercrombie", "contacts": [{"email": "kristy@samplename.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abercrombie, Kristy", "phone": [{"number": "415-555-6579", "type": "Primary"}], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Kristy Abercrombie", "phone": [], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Steve Darcangelo", "phone": [], "status": "Active"}], "customerName": "Abercrombie, Kristy", "defaultCurrency": "GBP", "emailAddress": "kristy@samplename.com", "id": "150000-933272658", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:07:55Z", "phone": "415-555-6579", "sourceModifiedDate": "2023-12-16T05:06:42", "status": "Active"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contactName": "Abraham's Company", "contacts": [{"email": "ab@email.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abe", "phone": [{"number": "01111111111", "type": "Mobile"}], "status": "Active"}], "customerName": "Abe", "defaultCurrency": "GBP", "emailAddress": "ab@email.com", "id": "9", "modifiedDate": "2023-01-18T11:02:35Z", "registrationNumber": "XXXX9900001", "sourceModifiedDate": "2022-12-08T15:42:59Z", "status": "Active", "taxNumber": "XXXX9900001"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "New York, NY", "line1": "123 Main St", "type": "Billing"}], "contactName": "Kristy Abercrombie", "contacts": [{"address": {"city": "New York, NY", "line1": "123 Main St", "type": "Billing"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abercrombie International Group (deleted)", "phone": [], "status": "Archived"}], "customerName": "Abercrombie International Group", "defaultCurrency": "GBP", "id": "66", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:56Z", "sourceModifiedDate": "2016-09-12T18:53:19Z", "status": "Archived"} + Sage 200cloud: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Blackpool", "country": "", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Delivery"}, {"city": "Manchester", "country": "", "line1": "23a Union Street", "line2": "", "postalCode": "M2 6JK", "region": "", "type": "Delivery"}, {"city": "Blackpool", "country": "Great Britain", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Billing"}], "contactName": "Lee Dalkin", "contacts": [{"email": "newbusinessadvice@sage.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Lee Dalkin", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Landline"}, {"number": "01742 876 236", "type": "Fax"}], "status": "Active"}, {"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Malcolm Leverret", "phone": [], "status": "Active"}, {"email": "Jim@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jim Thomas", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Fax"}], "status": "Active"}, {"email": "Jullian@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jullian Plawsworth", "phone": [{"number": "0151 349 3939", "type": "Landline"}, {"number": "0151 349 3940", "type": "Fax"}], "status": "Active"}], "customerName": "A1 Design Services", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "A1D001", "modifiedDate": "2022-10-14T09:35:53Z", "phone": "01742 876 234", "registrationNumber": "", "sourceModifiedDate": "2022-04-27T15:17:36Z", "status": "Active", "taxNumber": "GB238 3839 38"} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Blackpool", "country": "GB", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Delivery"}, {"city": "Manchester", "country": "GB", "line1": "23a Union Street", "line2": "", "postalCode": "M2 6JK", "region": "", "type": "Delivery"}, {"city": "Blackpool", "country": "GB", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Unknown"}], "contactName": "Ian Cairns", "contacts": [], "customerName": "A1 Design Services", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "A1D001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:41Z", "phone": "01742 876 234", "sourceModifiedDate": "2022-11-25T09:43:54Z", "status": "Active", "taxNumber": "GB238 3839 38"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Aruba City", "country": "Aruba (AW)", "line1": "Aruba Address line 1", "line2": "Aruba Address line 2", "postalCode": "Aruba Post", "region": "Aruba Province", "type": "Billing"}], "contactName": "Main Contact", "contacts": [{"modifiedDate": "2022-10-23T00:00:00Z", "phone": [{"number": "contact mobile number", "type": "Mobile"}, {"number": "contact fax number", "type": "Fax"}], "status": "Unknown"}], "customerName": "100 test name", "defaultCurrency": "GBP", "emailAddress": "email@codat.io", "id": "260f6a3f94a243738f2d5e08496a41a8", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "contact phone number", "sourceModifiedDate": "2021-05-10T16:31:51Z", "status": "Active"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [{"city": "Albuquerque", "country": "United States", "line1": "155 Westend Point", "line2": "", "postalCode": "87140", "region": "NM", "type": "Unknown"}], "contactName": "Yuna Conn", "contacts": [{"address": {"city": "Albuquerque", "country": "United States", "line1": "155 Westend Point", "line2": "", "postalCode": "87140", "region": "NM", "type": "Unknown"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Conn, Yuna", "phone": [{"number": "520-393-4468", "type": "Primary"}], "status": "Unknown"}], "customerName": "33Across", "defaultCurrency": "USD", "id": "188", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:21Z", "phone": "520-393-4468", "sourceModifiedDate": "2022-09-06T12:58:27", "status": "Active", "taxNumber": ""} + Wave: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contactName": "", "contacts": [], "customerName": "ABC Textiles", "defaultCurrency": "USD", "emailAddress": "c.taylor@codat.io", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O0N1c3RvbWVyOjMyMzkzNTA4", "modifiedDate": "2022-11-16T18:15:30Z", "sourceModifiedDate": "2019-10-17T07:59:04Z", "status": "Active"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contacts": [], "customerName": "24 Locks", "defaultCurrency": "USD", "emailAddress": "", "id": "e4c9d0e2-c285-4e85-b579-6d28b180c730", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:35:10Z", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active"} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "200": + application/json: {"addresses": [], "contactName": "Contact (First Name) Contact (Last Name)", "contacts": [{"email": "contactperson@whateveryouwantidontcare12345.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Contact (First Name) Contact (Last Name)", "phone": [{"number": "Work Phone", "type": "Landline"}, {"number": "Mobile", "type": "Mobile"}], "status": "Active"}], "customerName": "A B", "defaultCurrency": "GBP", "emailAddress": "contactperson@whateveryouwantidontcare12345.com", "id": "104957000000032105", "modifiedDate": "2022-10-03T08:40:37Z", "phone": "Work Phone", "sourceModifiedDate": "2022-06-09T14:36:47", "status": "Active"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + customerId: "" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-customers: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [], "totalResults": 1} + "400": {} + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Fernandohaven", "country": "United Kingdom", "line1": "Suite 214", "line2": "8439 Lueilwitz Passage", "postalCode": "JG04 7PV", "region": "Northern Ireland", "type": "Delivery"}, {"city": "Juliochester", "country": "United Kingdom", "line1": "Suite 096", "line2": "864 Halie Course", "postalCode": "DZ8 4BF", "region": "England", "type": "Delivery"}, {"city": "Naderborough", "country": "United Kingdom", "line1": "Suite 001", "line2": "416 Stokes Fords", "postalCode": "XG25 0XX", "region": "Wales", "type": "Delivery"}], "contactName": "Werner Langworth", "contacts": [{"address": {"city": "Hortenseville", "country": "United Kingdom", "line1": "Apt. 145", "line2": "317 Williamson Freeway", "postalCode": "CV4 2HR", "region": "Scotland", "type": "Delivery"}, "email": "Werner_Langworth@hotmail.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Werner Langworth", "phone": [], "status": "Active"}, {"address": {"city": "South Ali", "country": "United Kingdom", "line1": "Suite 075", "line2": "9921 Dickens Walk", "postalCode": "TI04 4OO", "region": "Scotland", "type": "Delivery"}, "email": "Belle51@yahoo.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Belle Glover", "phone": [], "status": "Active"}], "customerName": "Arjun Kuvalis", "defaultCurrency": "GBP", "emailAddress": "Arjun34@hotmail.com", "id": "c8180244-74ac-40cf-a5df-6d83661c44d7", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:16Z", "phone": "014605 64820", "registrationNumber": "NI7JEJVM", "sourceModifiedDate": "2022-07-03T01:27:00", "status": "Active", "taxNumber": "7505220209.583549"}, {"addresses": [{"city": "East Khalid", "country": "United Kingdom", "line1": "Apt. 184", "line2": "60578 Louie Springs", "postalCode": "XW89 7NT", "region": "Wales", "type": "Billing"}], "contactName": "Miguel Hahn", "contacts": [{"address": {"city": "Reingerton", "country": "United Kingdom", "line1": "Suite 400", "line2": "21930 Milan Lane", "postalCode": "QG10 2DL", "region": "Wales", "type": "Delivery"}, "email": "Miguel.Hahn@gmail.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Miguel Hahn", "phone": [{"number": "018555 09614", "type": "Landline"}], "status": "Active"}], "customerName": "Breitenberg, Emard and Schiller", "defaultCurrency": "GBP", "emailAddress": "contact@BreitenbergEmardandSchiller.biz", "id": "6d162ee4-47b4-46c6-a2e6-aa9edd0fe6b0", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:16Z", "phone": "0800 445 6957", "registrationNumber": "KME0AMIL", "sourceModifiedDate": "2022-12-03T11:05:01", "status": "Archived", "taxNumber": "8560920952.553111"}], "totalResults": 20} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "contacts": [{"address": {"city": "", "country": "", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}, "email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "", "phone": [], "status": "Active"}], "customerName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "0e2f7751-7696-ed11-bff5-6045bd0d2ad6", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:25Z", "phone": "", "sourceModifiedDate": "2023-01-17T14:50:54Z", "status": "Active", "taxNumber": ""}, {"addresses": [{"city": "", "country": "GB", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "contacts": [{"address": {"city": "", "country": "GB", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}, "email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "", "phone": [], "status": "Active"}], "customerName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "0ef95175-48c4-eb11-9f0a-0022481b4343", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:25Z", "phone": "", "sourceModifiedDate": "2021-06-03T08:48:36Z", "status": "Active", "taxNumber": ""}], "totalResults": 42} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"country": "NL", "type": "Billing"}], "contacts": [], "customerName": "Ab Netherlands", "defaultCurrency": "EUR", "id": "555f8251-c65a-433a-a813-5dbe04321d1e", "modifiedDate": "2022-10-26T13:32:05Z", "sourceModifiedDate": "2021-06-14T15:26:37Z", "status": "Active"}, {"addresses": [{"country": "NL", "type": "Billing"}], "contacts": [], "customerName": "anna test 2", "defaultCurrency": "EUR", "id": "9fd1f78e-67aa-4af7-8a10-df1fc5fb5841", "modifiedDate": "2022-10-26T13:32:05Z", "sourceModifiedDate": "2022-05-24T11:53:21Z", "status": "Active"}], "totalResults": 71} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "country": "GB", "line1": "Ink Rooms", "postalCode": "WC1X 0BE", "type": "Billing"}], "contacts": [], "customerName": "Abdi 99", "defaultCurrency": "GBP", "emailAddress": "email@codat.io", "id": "5f20075a-a28e-434d-81a6-2db0dc170e87", "modifiedDate": "2022-10-26T13:33:08Z", "registrationNumber": "123456789", "sourceModifiedDate": "2020-02-26T11:23:50Z", "status": "Active", "taxNumber": "GB339 0727 47"}, {"addresses": [{"country": "GB", "type": "Billing"}], "contactName": "abeee", "contacts": [{"address": {"country": "GB ", "line1": "", "type": "Unknown"}, "modifiedDate": "2020-02-24T12:00:51.027Z", "name": "abeee", "phone": [], "status": "Active"}], "customerName": "Abdulbasit Al-haj", "defaultCurrency": "GBP", "emailAddress": "a.alhaj@codat.io", "id": "1d9dc1a7-92d6-441b-93fd-42c9fb321b1c", "modifiedDate": "2022-10-26T13:33:08Z", "sourceModifiedDate": "2020-02-24T12:00:50Z", "status": "Active"}], "totalResults": 53} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "contacts": [{"address": {"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Test 1", "phone": [], "status": "Unknown"}], "customerName": "-", "defaultCurrency": "GBP", "id": "11526230", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sourceModifiedDate": "2023-04-17T06:02:46Z", "status": "Active"}, {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "contacts": [{"address": {"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Test 1", "phone": [], "status": "Unknown"}], "customerName": "-", "defaultCurrency": "GBP", "id": "9677150", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:12Z", "sourceModifiedDate": "2023-04-24T06:19:23Z", "status": "Active"}], "totalResults": 159} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Some city", "country": "Country 1", "line1": "Line 1", "line2": "Line 2", "postalCode": "SW1 2JQ", "region": "A region", "type": "Billing"}], "contactName": "test person name", "contacts": [{"email": "test14A@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person1", "phone": [{"number": "24681012", "type": "Primary"}, {"number": "121086420", "type": "Unknown"}], "status": "Active"}, {"email": "test14B@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person2", "phone": [{"number": "1234 56789", "type": "Primary"}, {"number": "9876 54321", "type": "Unknown"}], "status": "Active"}, {"email": "test14@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person name", "phone": [{"number": "01876 541245", "type": "Unknown"}], "status": "Active"}], "customerName": "A test customer 14 (updated)", "defaultCurrency": "GBP", "emailAddress": "test14@example.com", "id": "634509", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:23Z", "phone": "01876 541245", "sourceModifiedDate": "2022-05-18T09:23:56", "status": "Active"}, {"addresses": [{"city": "Some city", "country": "Country 1", "line1": "Line 1", "line2": "Line 2", "postalCode": "SW1 2JQ", "region": "A region", "type": "Billing"}], "contactName": "test person name", "contacts": [{"email": "test9@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person1", "phone": [{"number": "24681012", "type": "Primary"}, {"number": "121086420", "type": "Unknown"}], "status": "Active"}, {"email": "test10@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person2", "phone": [{"number": "123456789", "type": "Primary"}, {"number": "987654321", "type": "Unknown"}], "status": "Active"}, {"email": "test8@example.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "test person name", "phone": [{"number": "01876 541245", "type": "Unknown"}], "status": "Active"}], "customerName": "A test customer name 2", "defaultCurrency": "GBP", "emailAddress": "test8@example.com", "id": "634486", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:23Z", "phone": "01876 541245", "sourceModifiedDate": "2022-05-11T11:39:58", "status": "Active"}], "totalResults": 39} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "", "contacts": [{"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "", "phone": [], "status": "Active"}], "customerName": "Chekko Customer Test 01", "defaultCurrency": "GBP", "emailAddress": "", "id": "92227673", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "", "sourceModifiedDate": "0001-01-01T00:00:00", "status": "Active", "taxNumber": ""}, {"addresses": [{"city": "Billing line 4", "country": "United Kingdom", "line1": "Billing Address", "line2": "Billing line 2 Billing line 3", "postalCode": "123321", "type": "Billing"}, {"city": "Delivery line4", "country": "United Kingdom", "line1": "Delivery Address", "line2": "Delivery line2 Delivery line3", "postalCode": "123321", "type": "Delivery"}], "contactName": "Mr Diogo Sousa", "contacts": [{"address": {"city": "Billing line 4", "country": "United Kingdom", "line1": "Billing Address", "line2": "Billing line 2 Billing line 3", "postalCode": "123321", "type": "Billing"}, "email": "diogomail@mail.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Mr Diogo Sousa", "phone": [{"number": "123123123", "type": "Landline"}, {"number": "321321321", "type": "Mobile"}], "status": "Active"}, {"address": {"city": "Delivery line4", "country": "United Kingdom", "line1": "Delivery Address", "line2": "Delivery line2 Delivery line3", "postalCode": "123321", "type": "Delivery"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Mr Diogo Sousa", "phone": [], "status": "Active"}], "customerName": "Diogo Sousa", "defaultCurrency": "EUR", "emailAddress": "diogomail@mail.com", "id": "88459410", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "123123123", "sourceModifiedDate": "2021-05-04T13:22:19", "status": "Active", "taxNumber": ""}], "totalResults": 10} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "Mr Test Customer", "contacts": [], "customerName": "119 Test Customer", "defaultCurrency": "GBP", "id": "773", "modifiedDate": "2023-01-30T14:48:02Z", "sourceModifiedDate": "2022-01-11T12:28:49", "status": "Active"}, {"addresses": [], "contactName": "European Company", "contacts": [], "customerName": "1248 European Company", "defaultCurrency": "GBP", "id": "172722", "modifiedDate": "2023-01-30T14:48:02Z", "sourceModifiedDate": "2022-07-27T14:29:16", "status": "Active"}], "totalResults": 4} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Bayshore", "line1": "Kristy Abercrombie", "line2": "5647 Cypress Hill Rd", "postalCode": "94326", "region": "CA", "type": "Delivery"}, {"city": "Bayshore", "line1": "Kristy Abercrombie", "line2": "5647 Cypress Hill Rd", "postalCode": "94326", "region": "CA", "type": "Billing"}], "contactName": "Kristy Abercrombie", "contacts": [{"email": "kristy@samplename.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abercrombie, Kristy", "phone": [{"number": "415-555-6579", "type": "Primary"}], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Kristy Abercrombie", "phone": [], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Steve Darcangelo", "phone": [], "status": "Active"}], "customerName": "Abercrombie, Kristy", "defaultCurrency": "GBP", "emailAddress": "kristy@samplename.com", "id": "150000-933272658", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:07:55Z", "phone": "415-555-6579", "sourceModifiedDate": "2023-12-16T05:06:42", "status": "Active"}, {"addresses": [{"city": "Millbrae", "line1": "Robert Allard", "line2": "92834 Chandler St.", "postalCode": "94030", "region": "CA", "type": "Delivery"}, {"city": "Millbrae", "line1": "Robert Allard", "line2": "92834 Chandler St.", "postalCode": "94030", "region": "CA", "type": "Billing"}], "contactName": "Amanda Roberts", "contacts": [{"email": "rallard@myemail.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Allard, Robert", "phone": [{"number": "650-555-3422", "type": "Primary"}, {"number": "650-555-9804", "type": "Fax"}, {"number": "650-555-8349", "type": "Unknown"}], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Robert Allard", "phone": [], "status": "Active"}, {"modifiedDate": "2022-10-23T00:00:00Z", "name": "Rachel Fisher", "phone": [], "status": "Active"}], "customerName": "Allard, Robert", "defaultCurrency": "GBP", "emailAddress": "rallard@myemail.com", "id": "800000D0-1182061376", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:07:55Z", "phone": "650-555-3422", "sourceModifiedDate": "2023-12-16T05:06:42", "status": "Active"}], "totalResults": 64} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "Abraham's Company", "contacts": [{"email": "ab@email.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abe", "phone": [{"number": "01111111111", "type": "Mobile"}], "status": "Active"}], "customerName": "Abe", "defaultCurrency": "GBP", "emailAddress": "ab@email.com", "id": "9", "modifiedDate": "2023-01-18T11:02:35Z", "registrationNumber": "XXXX9900001", "sourceModifiedDate": "2022-12-08T15:42:59Z", "status": "Active", "taxNumber": "XXXX9900001"}, {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "4 Privet Drive", "postalCode": "WD25 7LR", "type": "Billing"}, {"city": "London", "country": "United Kingdom", "line1": "4 Privet Drive", "postalCode": "WD25 7LR", "type": "Delivery"}], "contactName": "Adeel test", "contacts": [{"address": {"city": "London", "country": "United Kingdom", "line1": "4 Privet Drive", "postalCode": "WD25 7LR", "type": "Billing"}, "email": "adeel@adeel.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Adeel test", "phone": [{"number": "123456789", "type": "Primary"}, {"number": "07546543216", "type": "Mobile"}], "status": "Active"}], "customerName": "adeel qbo child test", "defaultCurrency": "GBP", "emailAddress": "adeel@adeel.com", "id": "49", "modifiedDate": "2023-01-18T11:02:35Z", "phone": "123456789", "sourceModifiedDate": "2022-08-22T09:21:09Z", "status": "Active"}], "totalResults": 40} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "New York, NY", "line1": "123 Main St", "type": "Billing"}], "contactName": "Kristy Abercrombie", "contacts": [{"address": {"city": "New York, NY", "line1": "123 Main St", "type": "Billing"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abercrombie International Group (deleted)", "phone": [], "status": "Archived"}], "customerName": "Abercrombie International Group", "defaultCurrency": "GBP", "id": "66", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:56Z", "sourceModifiedDate": "2016-09-12T18:53:19Z", "status": "Archived"}, {"addresses": [{"type": "Billing"}, {"type": "Delivery"}], "contactName": "Natalie Watts", "contacts": [{"address": {"type": "Billing"}, "email": "n.watts@google.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Abercrombie International Group", "phone": [], "status": "Active"}], "customerName": "Abercrombie International Group", "defaultCurrency": "USD", "emailAddress": "n.watts@google.com", "id": "67", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:56Z", "registrationNumber": "XXXXVat123456", "sourceModifiedDate": "2023-03-29T01:12:55Z", "status": "Active", "taxNumber": "XXXXVat123456"}], "totalResults": 243} + Sage 200cloud: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Blackpool", "country": "", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Delivery"}, {"city": "Manchester", "country": "", "line1": "23a Union Street", "line2": "", "postalCode": "M2 6JK", "region": "", "type": "Delivery"}, {"city": "Blackpool", "country": "Great Britain", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Billing"}], "contactName": "Lee Dalkin", "contacts": [{"email": "newbusinessadvice@sage.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Lee Dalkin", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Landline"}, {"number": "01742 876 236", "type": "Fax"}], "status": "Active"}, {"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Malcolm Leverret", "phone": [], "status": "Active"}, {"email": "Jim@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jim Thomas", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Fax"}], "status": "Active"}, {"email": "Jullian@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jullian Plawsworth", "phone": [{"number": "0151 349 3939", "type": "Landline"}, {"number": "0151 349 3940", "type": "Fax"}], "status": "Active"}], "customerName": "A1 Design Services", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "A1D001", "modifiedDate": "2022-10-14T09:35:53Z", "phone": "01742 876 234", "registrationNumber": "", "sourceModifiedDate": "2022-04-27T15:17:36Z", "status": "Active", "taxNumber": "GB238 3839 38"}, {"addresses": [{"city": "Blackpool", "country": "Great Britain", "line1": "77a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Billing"}], "contactName": "Lee Dalkin", "contacts": [{"email": "newbusinessadvice@sage.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Lee Dalkin", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Landline"}, {"number": "01742 876 236", "type": "Fax"}], "status": "Active"}, {"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Malcolm Leverret", "phone": [], "status": "Active"}, {"email": "Jim@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jim Thomas", "phone": [{"number": "01742 876 234", "type": "Landline"}, {"number": "01742 876 235", "type": "Fax"}], "status": "Active"}, {"email": "Jullian@a1designservices.co.uk", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Jullian Plawsworth", "phone": [{"number": "0151 349 3939", "type": "Landline"}, {"number": "0151 349 3940", "type": "Fax"}], "status": "Active"}], "customerName": "A2 Design Services", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "A1D002", "modifiedDate": "2022-10-14T09:35:53Z", "phone": "01742 876 234", "registrationNumber": "", "sourceModifiedDate": "2020-09-23T10:28:58Z", "status": "Active", "taxNumber": "GB238 3839 40"}], "totalResults": 43} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Blackpool", "country": "GB", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Delivery"}, {"city": "Manchester", "country": "GB", "line1": "23a Union Street", "line2": "", "postalCode": "M2 6JK", "region": "", "type": "Delivery"}, {"city": "Blackpool", "country": "GB", "line1": "67a Station Road", "line2": "", "postalCode": "BP12 7HT", "region": "Lancashire", "type": "Unknown"}], "contactName": "Ian Cairns", "contacts": [], "customerName": "A1 Design Services", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "A1D001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:41Z", "phone": "01742 876 234", "sourceModifiedDate": "2022-11-25T09:43:54Z", "status": "Active", "taxNumber": "GB238 3839 38"}, {"addresses": [{"city": "Whitley Bay", "country": "GB", "line1": "Swanson Industries", "line2": "Dukes Industrial Estate", "postalCode": "NE56 4ER", "region": "North Tyneside", "type": "Delivery"}, {"city": "Hebburn", "country": "GB", "line1": "Unit 34", "line2": "Holystone Ind Estate", "postalCode": "NE31 1VB", "region": "Tyne & Wear", "type": "Delivery"}, {"city": "Hebburn", "country": "GB", "line1": "Unit 34", "line2": "Holystone Ind Estate", "postalCode": "NE31 1VB", "region": "Tyne & Wear", "type": "Unknown"}], "contactName": "Mike Hall", "contacts": [], "customerName": "ABS Garages Ltd", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "ABS001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:41Z", "phone": "0191 254 5909", "sourceModifiedDate": "2022-11-25T09:43:54Z", "status": "Active", "taxNumber": "GB745 4584 68"}], "totalResults": 30} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Aruba City", "country": "Aruba (AW)", "line1": "Aruba Address line 1", "line2": "Aruba Address line 2", "postalCode": "Aruba Post", "region": "Aruba Province", "type": "Billing"}], "contactName": "Main Contact", "contacts": [{"modifiedDate": "2022-10-23T00:00:00Z", "phone": [{"number": "contact mobile number", "type": "Mobile"}, {"number": "contact fax number", "type": "Fax"}], "status": "Unknown"}], "customerName": "100 test name", "defaultCurrency": "GBP", "emailAddress": "email@codat.io", "id": "260f6a3f94a243738f2d5e08496a41a8", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "contact phone number", "sourceModifiedDate": "2021-05-10T16:31:51Z", "status": "Active"}, {"addresses": [{"city": "POST - Aruba City", "country": "Aruba (AW)", "line1": "POST - Aruba Address line 1", "line2": "POST - Aruba Address line 2", "postalCode": "Aruba Post", "region": "Aruba Province", "type": "Billing"}], "contactName": "Main Contact", "contacts": [], "customerName": "100 test name DS", "defaultCurrency": "GBP", "emailAddress": "DCemail@codat.io", "id": "44a5d9461d9e4f6d90a5ace251c5cf35", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "contact phone number", "sourceModifiedDate": "2021-06-10T14:22:46Z", "status": "Active"}], "totalResults": 168} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Albuquerque", "country": "United States", "line1": "155 Westend Point", "line2": "", "postalCode": "87140", "region": "NM", "type": "Unknown"}], "contactName": "Yuna Conn", "contacts": [{"address": {"city": "Albuquerque", "country": "United States", "line1": "155 Westend Point", "line2": "", "postalCode": "87140", "region": "NM", "type": "Unknown"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "Conn, Yuna", "phone": [{"number": "520-393-4468", "type": "Primary"}], "status": "Unknown"}], "customerName": "33Across", "defaultCurrency": "USD", "id": "188", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:21Z", "phone": "520-393-4468", "sourceModifiedDate": "2022-09-06T12:58:27", "status": "Active", "taxNumber": ""}, {"addresses": [{"city": "Sparwood", "country": "Canada", "line1": "7 Lerdahl Junction", "line2": "", "postalCode": "L4R", "region": "British Columbia", "type": "Unknown"}], "contactName": "Lauri O'Heagertie", "contacts": [{"address": {"city": "Sparwood", "country": "Canada", "line1": "7 Lerdahl Junction", "line2": "", "postalCode": "L4R", "region": "British Columbia", "type": "Unknown"}, "modifiedDate": "2022-10-23T00:00:00Z", "name": "O'Heagertie, Lauri", "phone": [{"number": "410-309-3976", "type": "Primary"}], "status": "Unknown"}], "customerName": "3Way International Logistics", "defaultCurrency": "CAD", "id": "324", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:21Z", "phone": "410-309-3976", "sourceModifiedDate": "2020-10-20T05:01:49", "status": "Active", "taxNumber": ""}], "totalResults": 530} + Wave: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "", "contacts": [], "customerName": "ABC Textiles", "defaultCurrency": "USD", "emailAddress": "c.taylor@codat.io", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O0N1c3RvbWVyOjMyMzkzNTA4", "modifiedDate": "2022-11-16T18:15:30Z", "sourceModifiedDate": "2019-10-17T07:59:04Z", "status": "Active"}, {"addresses": [{"city": "Coffee City", "country": "United Kingdom", "line1": "11 Coffee Lane", "line2": "Coffee Town", "postalCode": "CC1 1CC", "region": "Hampshire", "type": "Billing"}], "contactName": "Coffee Carl", "contacts": [{"modifiedDate": "2022-10-23T00:00:00Z", "name": "Coffee Carl", "phone": [{"number": "07733", "type": "Mobile"}], "status": "Active"}], "customerName": "Coffee Cart", "defaultCurrency": "GBP", "emailAddress": "coffee.cart@example.com", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O0N1c3RvbWVyOjM3MTUzNDI2", "modifiedDate": "2022-11-16T18:15:30Z", "phone": "0201111", "sourceModifiedDate": "2020-03-17T19:12:39Z", "status": "Active"}], "totalResults": 10} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contacts": [], "customerName": "24 Locks", "defaultCurrency": "USD", "emailAddress": "", "id": "e4c9d0e2-c285-4e85-b579-6d28b180c730", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:35:10Z", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active"}, {"addresses": [], "contacts": [], "customerName": "7-Eleven", "defaultCurrency": "GBP", "emailAddress": "", "id": "bab779bc-c5fb-42cb-a888-953e8309711c", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:35:10Z", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active"}], "totalResults": 48} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/customers?page=1&pageSize=2"}, "next": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/customers?page=2&pageSize=2"}, "self": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/customers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "Contact (First Name) Contact (Last Name)", "contacts": [{"email": "contactperson@whateveryouwantidontcare12345.com", "modifiedDate": "2022-10-23T00:00:00Z", "name": "Contact (First Name) Contact (Last Name)", "phone": [{"number": "Work Phone", "type": "Landline"}, {"number": "Mobile", "type": "Mobile"}], "status": "Active"}], "customerName": "A B", "defaultCurrency": "GBP", "emailAddress": "contactperson@whateveryouwantidontcare12345.com", "id": "104957000000032105", "modifiedDate": "2022-10-03T08:40:37Z", "phone": "Work Phone", "sourceModifiedDate": "2022-06-09T14:36:47", "status": "Active"}, {"addresses": [], "contactName": "John Doe", "contacts": [{"email": "", "modifiedDate": "2022-10-23T00:00:00Z", "name": "John Doe", "phone": [], "status": "Active"}], "customerName": "Doe, John", "defaultCurrency": "GBP", "emailAddress": "", "id": "104957000000054050", "modifiedDate": "2022-10-03T08:40:37Z", "sourceModifiedDate": "2022-09-28T15:09:22", "status": "Active"}], "totalResults": 14} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + update-customer: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + customerId: "" + query: {} + requestBody: + application/json: {"contacts": [], "defaultCurrency": "EUR", "modifiedDate": "2022-10-23T00:00:00Z", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-supplier: + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"contactName": "Joe Bloggs", "id": "73593", "modifiedDate": "2022-10-23T00:00:00Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "test 20230420 1004"} + responses: + "200": + application/json: {"changes": [], "companyId": "8a210b68-6988-11ed-a1eb-0242ac120002", "completedOnUtc": "2022-10-23T00:00:00Z", "dataConnectionKey": "2e9d2c44-f675-40ba-8049-353bfcb5e171", "dataType": "invoices", "pushOperationKey": "642c1fc6-fe07-4241-bcdd-89dc7fa504e0", "requestedOnUtc": "2022-10-23T00:00:00Z", "status": "Pending", "statusCode": 207565} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + query: {} + requestBody: + application/json: {"addresses": [{"city": "Bakersfield", "country": "USA", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "region": "California", "type": "Billing"}], "contactName": "Kelly's Industrial Supplies", "defaultCurrency": "string", "emailAddress": "sales@kellysupplies.com", "id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "phone": "07999 999999", "registrationNumber": "string", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "supplementalData": {"content": {"property1": {"property1": "", "property2": ""}, "property2": {"property1": "", "property2": ""}}}, "supplierName": "Kelly's Industrial Supplies", "taxNumber": "string"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-supplier: + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "7110701885" + responses: + "200": + application/json: {"addresses": [{"city": "Cesarmouth", "country": "United Kingdom", "line1": "Suite 431", "line2": "289 Giles Lake", "postalCode": "BG40 9GP", "region": "Northern Ireland", "type": "Delivery"}], "contactName": "Faye Hansen", "defaultCurrency": "GBP", "emailAddress": "hello@Abshire-Kshlerin.info", "id": "owQ2Gqgj9f", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:17Z", "phone": "01338 858162", "registrationNumber": "VYL1XZXR", "sourceModifiedDate": "1660-11-28T23:18:00", "status": "Active", "supplierName": "Abshire - Kshlerin", "taxNumber": "1396267523.0914588"} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + responses: + "200": + application/json: {"addresses": [{"city": "", "country": "GB", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "78623f13-931e-eb11-bbf8-0022481b3585", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:12Z", "phone": "", "sourceModifiedDate": "2020-11-04T11:44:22Z", "status": "Active", "supplierName": "", "taxNumber": ""} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "7110701885" + responses: + "200": + application/json: {"addresses": [{"city": "Bakersfield", "country": "US", "line1": "Unit 51", "postalCode": "933081", "region": "California", "type": "Billing"}], "contactName": "Kelly's Contact Name", "defaultCurrency": "EUR", "emailAddress": "sales@kellysupplies.com", "id": "3150917c-1d92-4d77-9018-31b5c4758ca9", "modifiedDate": "2022-10-26T13:32:05Z", "phone": "07999 999999", "registrationNumber": "8409314368", "sourceModifiedDate": "2022-07-15T12:01:15Z", "status": "Active", "supplierName": "Abe"} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"addresses": [{"country": "GB", "type": "Billing"}], "defaultCurrency": "GBP", "id": "0185fea2-0298-445b-909a-0db685118a9e", "modifiedDate": "2022-10-26T13:33:13Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2017-08-02T10:58:54Z", "status": "Active", "supplierName": "a"} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "7110701885" + responses: + "200": + application/json: {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "id": "11526230", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:08Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2023-04-17T06:02:46", "status": "Active", "supplierName": "-"} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"addresses": [], "id": "api vendor", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:25Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "api vendor"} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "7110701885" + responses: + "200": + application/json: {"addresses": [], "contactName": "", "emailAddress": "", "id": "6202387", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "", "sourceModifiedDate": "2017-05-09T00:00:00", "status": "Unknown", "supplierName": "Dell", "taxNumber": ""} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + responses: + "200": + application/json: {"addresses": [], "contactName": "Test Vendor", "defaultCurrency": "GBP", "emailAddress": "", "id": "779", "modifiedDate": "2023-01-30T14:47:02Z", "phone": "", "sourceModifiedDate": "2022-02-04T14:24:43", "status": "Active", "supplierName": "Test Vendor"} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"addresses": [{"city": "Berkeley", "line1": "A Cheung Limited, Angela Cheung", "line2": "3818 Bear Rd. West", "postalCode": "94688", "region": "CA", "type": "Billing"}], "contactName": "Angela Cheung", "defaultCurrency": "GBP", "emailAddress": "AC@CheungLimited.com", "id": "A60000-1197760912", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:09:03Z", "phone": "510 555 5723", "sourceModifiedDate": "2023-12-16T05:06:44", "status": "Active", "supplierName": "A Cheung Limited"} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"addresses": [{"country": "Djibouti", "line1": "test", "region": "string", "type": "Billing"}], "contactName": "AI Support", "defaultCurrency": "GBP", "id": "41", "modifiedDate": "2023-01-18T11:02:36Z", "phone": "01224 658 999", "sourceModifiedDate": "2022-12-07T10:48:18Z", "status": "Active", "supplierName": "AI Support"} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + responses: + "200": + application/json: {"addresses": [{"city": "London", "country": "England", "line1": "100 London Road", "line2": "Angel", "postalCode": "EC1M", "region": "Greater London", "type": "Billing"}], "contactName": "Miss Smith", "defaultCurrency": "GBP", "id": "129", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:55Z", "phone": "0728 38474", "sourceModifiedDate": "2023-04-13T01:51:08Z", "status": "Active", "supplierName": "Ally Johnson"} + Sage 200cloud: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "7110701885" + responses: + "200": + application/json: {"addresses": [{"city": "", "country": "Great Britain", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Unknown"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "776", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-14T09:35:58Z", "phone": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived", "supplierName": "Aaren", "taxNumber": ""} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + responses: + "200": + application/json: {"addresses": [{"city": "Newcastle Upon Tyne", "country": "GB", "line1": "66 New Street", "line2": "Ridgeway", "postalCode": "NE1 4GF", "region": "", "type": "Delivery"}, {"city": "Newcastle upon Tyne", "country": "GB", "line1": "66 New Street", "line2": "Ridgeway", "postalCode": "NE1 4GF", "region": "", "type": "Unknown"}], "contactName": "Mark Ramsay", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "CON001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "phone": "0191 643 4343", "sourceModifiedDate": "2022-11-25T09:43:54Z", "status": "Active", "supplierName": "Concept Stationery Supplies", "taxNumber": "GB988 3453 23"} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + responses: + "200": + application/json: {"addresses": [{"country": "United Kingdom (GB)", "type": "Billing"}], "contactName": "Main Contact", "defaultCurrency": "GBP", "id": "65179671e9ef424caff8b9006cd111c8", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "01224 658 999", "sourceModifiedDate": "2020-02-25T17:23:33Z", "status": "Active", "supplierName": "5555 Abdul's Test Name"} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "9wg4lep4ush5cxs79pl8sozmsndbaukll3ind4g7buqbm1h2" + responses: + "200": + application/json: {"addresses": [{"city": "Dallas", "country": "United States", "line1": "208 S Akard St", "line2": "", "postalCode": "75265", "region": "TX", "type": "Unknown"}], "contactName": "Jones, William", "defaultCurrency": "USD", "id": "3", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:20Z", "phone": "214-760-9491", "registrationNumber": "", "sourceModifiedDate": "2023-02-16T09:48:27", "status": "Active", "supplierName": "ADP", "taxNumber": "85-3678274"} + Wave: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "200": + application/json: {"addresses": [], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O1ZlbmRvcjo2NjA0Nzk0", "modifiedDate": "2022-11-16T18:15:24Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2020-04-07T13:28:02Z", "status": "Active", "supplierName": "Computer Shop"} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + responses: + "200": + application/json: {"addresses": [], "emailAddress": "", "id": "e4c9d0e2-c285-4e85-b579-6d28b180c730", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active", "supplierName": "24 Locks"} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "13d946f0-c5d5-42bc-b092-97ece17923ab" + responses: + "200": + application/json: {"addresses": [], "defaultCurrency": "GBP", "emailAddress": "", "id": "104957000001494001", "modifiedDate": "2022-10-03T08:40:37Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-09-16T13:09:56", "status": "Active", "supplierName": "Acme Corporation"} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + supplierId: "EILBDVJVNUAGVKRQ" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-suppliers: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"addresses": [{"city": "Bakersfield", "country": "USA", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "region": "California", "type": "Billing"}], "contactName": "Kelly's Industrial Supplies", "defaultCurrency": "string", "emailAddress": "sales@kellysupplies.com", "id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "phone": "07999 999999", "registrationNumber": "string", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "supplementalData": {"content": {"property1": {"property1": "", "property2": ""}, "property2": {"property1": "", "property2": ""}}}, "supplierName": "Kelly's Industrial Supplies", "taxNumber": "string"}], "totalResults": 1} + "400": {} + Clear Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/354a121b-855f-4d25-90ad-0905b498c1c0/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Cesarmouth", "country": "United Kingdom", "line1": "Suite 431", "line2": "289 Giles Lake", "postalCode": "BG40 9GP", "region": "Northern Ireland", "type": "Delivery"}], "contactName": "Faye Hansen", "defaultCurrency": "GBP", "emailAddress": "hello@Abshire-Kshlerin.info", "id": "owQ2Gqgj9f", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:17Z", "phone": "01338 858162", "registrationNumber": "VYL1XZXR", "sourceModifiedDate": "1660-11-28T23:18:00", "status": "Active", "supplierName": "Abshire - Kshlerin", "taxNumber": "1396267523.0914588"}, {"addresses": [{"city": "Fernandohaven", "country": "United Kingdom", "line1": "Suite 214", "line2": "8439 Lueilwitz Passage", "postalCode": "JG04 7PV", "region": "Northern Ireland", "type": "Delivery"}, {"city": "Juliochester", "country": "United Kingdom", "line1": "Suite 096", "line2": "864 Halie Course", "postalCode": "DZ8 4BF", "region": "England", "type": "Delivery"}, {"city": "Naderborough", "country": "United Kingdom", "line1": "Suite 001", "line2": "416 Stokes Fords", "postalCode": "XG25 0XX", "region": "Wales", "type": "Delivery"}], "contactName": "Werner Langworth", "defaultCurrency": "GBP", "emailAddress": "Arjun34@hotmail.com", "id": "FyUkHbZxhn", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T12:38:17Z", "phone": "0116 796 3163", "registrationNumber": "NI7JEJVM", "sourceModifiedDate": "0177-04-27T11:56:00", "status": "Active", "supplierName": "Arjun Kuvalis", "taxNumber": "7505220209.583549"}], "totalResults": 100} + Dynamics 365 Business Central: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/d6849caf-c146-41be-8335-b73346e3bd84/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "", "country": "GB", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "78623f13-931e-eb11-bbf8-0022481b3585", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:12Z", "phone": "", "sourceModifiedDate": "2020-11-04T11:44:22Z", "status": "Active", "supplierName": "", "taxNumber": ""}, {"addresses": [{"city": "", "country": "GB", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Billing"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "be49ec62-6754-ed11-946f-0022481b67d1", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-27T14:21:12Z", "phone": "", "sourceModifiedDate": "2022-10-25T13:17:36Z", "status": "Active", "supplierName": "", "taxNumber": ""}], "totalResults": 31} + Exact (Netherlands): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/b83b1923-4db6-45a8-a779-b4e320c15979/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Bakersfield", "country": "US", "line1": "Unit 51", "postalCode": "933081", "region": "California", "type": "Billing"}], "contactName": "Kelly's Contact Name", "defaultCurrency": "EUR", "emailAddress": "sales@kellysupplies.com", "id": "3150917c-1d92-4d77-9018-31b5c4758ca9", "modifiedDate": "2022-10-26T13:32:05Z", "phone": "07999 999999", "registrationNumber": "8409314368", "sourceModifiedDate": "2022-07-15T12:01:15Z", "status": "Active", "supplierName": "Abe"}, {"addresses": [{"city": "city", "country": "RU", "line1": "line1", "line2": "line2", "postalCode": "postal", "region": "region", "type": "Billing"}], "contactName": "Ann's contact name", "defaultCurrency": "USD", "emailAddress": "anna@anna888888.com", "id": "00014c12-2616-481a-a2e8-31bdf2497775", "modifiedDate": "2022-10-26T13:32:05Z", "phone": "55555555", "registrationNumber": "55566677788899944455", "sourceModifiedDate": "2021-06-09T12:04:08Z", "status": "Active", "supplierName": "Ann's test supplier 2", "taxNumber": "RU4444444"}], "totalResults": 73} + Exact (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/d95030cd-22b2-482b-9c7b-2980dcc2b1ce/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"country": "GB", "type": "Billing"}], "defaultCurrency": "GBP", "id": "0185fea2-0298-445b-909a-0db685118a9e", "modifiedDate": "2022-10-26T13:33:13Z", "phone": "01224 658 999", "sourceModifiedDate": "2017-08-02T10:58:54Z", "status": "Active", "supplierName": "a"}, {"addresses": [{"country": "GB", "type": "Billing"}], "defaultCurrency": "GBP", "id": "64ae712f-4155-48bb-9fce-98232c51d979", "modifiedDate": "2022-10-26T13:33:13Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2020-05-01T14:05:46Z", "status": "Active", "supplierName": "aa"}], "totalResults": 118} + FreeAgent: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/071ad738-68f3-4561-afd0-69bab9df0803/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "id": "11526230", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:08Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2023-04-17T06:02:46", "status": "Active", "supplierName": "-"}, {"addresses": [{"city": "London", "country": "United Kingdom", "line1": "1 Place House", "line2": "", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Test 1", "id": "9677150", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-25T14:19:08Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2023-04-24T06:19:23", "status": "Active", "supplierName": "-"}], "totalResults": 159} + FreshBooks: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/3691c49e-0db4-4172-b3ab-e4084c365013/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "id": "api vendor", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:25Z", "phone": "01224 658 999", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "api vendor"}, {"addresses": [], "id": "DUndsRykrmy8kFsc+FvYk29YkJze4zSjGecoF4YcUEhVU7auJ5JkQA0VjXptZ7XQ+D4n6WoxFIkaGY2V/t4flA==", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-24T16:07:25Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Active", "supplierName": "Chekko Test merchant 100 - Test Very long name: ORIG CO NAME:AMERICAN EXPRESS ORIG ID:9493560001 DESC DATE:220307 CO ENTRY DESCR:ACH PMT SEC:CCD TRACE#:021000023255482 EED:220307 IND ID:A4670 IND NAME:Rick Sanchez"}], "totalResults": 7} + KashFlow: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/3a707a99-89da-4b16-a5d6-595333a16352/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "", "emailAddress": "", "id": "6202387", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "", "sourceModifiedDate": "2017-05-09T00:00:00", "status": "Unknown", "supplierName": "Dell", "taxNumber": ""}, {"addresses": [], "contactName": "", "emailAddress": "", "id": "9338173", "modifiedDate": "2022-09-30T10:29:15Z", "phone": "", "sourceModifiedDate": "1990-01-01T00:00:00", "status": "Unknown", "supplierName": "Home", "taxNumber": ""}], "totalResults": 7} + Oracle NetSuite: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/d5074b08-6a34-4b06-a742-236edf5dc4f1/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "Test Vendor", "defaultCurrency": "GBP", "emailAddress": "", "id": "779", "modifiedDate": "2023-01-30T14:47:02Z", "phone": "", "sourceModifiedDate": "2022-02-04T14:24:43", "status": "Active", "supplierName": "Test Vendor"}, {"addresses": [], "contactName": "Vendor -.A", "defaultCurrency": "GBP", "emailAddress": "", "id": "726", "modifiedDate": "2023-01-30T14:47:02Z", "phone": "", "sourceModifiedDate": "2021-03-26T09:53:15", "status": "Active", "supplierName": "Vendor -.A"}], "totalResults": 6} + QuickBooks Desktop: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/fc72ba08-af13-4474-b28a-01dcfa6cfb51/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Berkeley", "line1": "A Cheung Limited, Angela Cheung", "line2": "3818 Bear Rd. West", "postalCode": "94688", "region": "CA", "type": "Billing"}], "contactName": "Angela Cheung", "defaultCurrency": "GBP", "emailAddress": "AC@CheungLimited.com", "id": "A60000-1197760912", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:09:03Z", "phone": "510 555 5723", "sourceModifiedDate": "2023-12-16T05:06:44", "status": "Active", "supplierName": "A Cheung Limited"}, {"addresses": [{"city": "Middlefield", "line1": "Bank of Anycity, Lisa Holzhauser", "line2": "1935 Main Street", "postalCode": "94482", "region": "CA", "type": "Billing"}], "contactName": "Lisa D. Holzhauser", "defaultCurrency": "GBP", "emailAddress": "lisah@samplename.com", "id": "A40000-1197774038", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:09:03Z", "phone": "415-555-9135", "sourceModifiedDate": "2023-12-16T05:06:44", "status": "Active", "supplierName": "Bank of Anycity"}], "totalResults": 54} + QuickBooks Online: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/10818b5e-6e6a-4ed4-a1c5-3e3efe626e87/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"country": "Djibouti", "line1": "test", "region": "string", "type": "Billing"}], "contactName": "AI Support", "defaultCurrency": "GBP", "id": "41", "modifiedDate": "2023-01-18T11:02:36Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-12-07T10:48:18Z", "status": "Active", "supplierName": "AI Support"}, {"addresses": [{"country": "DJ", "line1": "test", "region": "string", "type": "Billing"}], "contactName": "AI Support 2", "defaultCurrency": "GBP", "id": "42", "modifiedDate": "2023-01-18T11:02:36Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2021-08-31T08:45:02Z", "status": "Active", "supplierName": "AI Support 2"}], "totalResults": 23} + QuickBooks Online Sandbox: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/5a7f3597-36e1-4216-86fe-289ad36088a6/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "London", "country": "England", "line1": "100 London Road", "line2": "Angel", "postalCode": "EC1M", "region": "Greater London", "type": "Billing"}], "contactName": "Miss Smith", "defaultCurrency": "GBP", "id": "129", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:55Z", "phone": "0728 38474", "sourceModifiedDate": "2023-04-13T01:51:08Z", "status": "Active", "supplierName": "Ally Johnson"}, {"addresses": [], "defaultCurrency": "GBP", "id": "88", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-26T09:35:55Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-07-06T15:55:28Z", "status": "Active", "supplierName": "Andrew Haberbosch"}], "totalResults": 64} + Sage 200cloud: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/93c21e2d-049c-4d24-b41b-57e61c30b69e/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "", "country": "Great Britain", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Unknown"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "776", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-14T09:35:58Z", "phone": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived", "supplierName": "Aaren", "taxNumber": ""}, {"addresses": [{"city": "", "country": "Great Britain", "line1": "", "line2": "", "postalCode": "", "region": "", "type": "Unknown"}], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "914", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-14T09:35:58Z", "phone": "", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Archived", "supplierName": "Aaren", "taxNumber": ""}], "totalResults": 943} + Sage 50 (UK): + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/cf5f2a47-2990-4221-bae6-0c19c86ac304/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Newcastle Upon Tyne", "country": "GB", "line1": "66 New Street", "line2": "Ridgeway", "postalCode": "NE1 4GF", "region": "", "type": "Delivery"}, {"city": "Newcastle upon Tyne", "country": "GB", "line1": "66 New Street", "line2": "Ridgeway", "postalCode": "NE1 4GF", "region": "", "type": "Unknown"}], "contactName": "Mark Ramsay", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "CON001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "phone": "0191 643 4343", "sourceModifiedDate": "2022-11-25T09:43:54Z", "status": "Active", "supplierName": "Concept Stationery Supplies", "taxNumber": "GB988 3453 23"}, {"addresses": [{"city": "Chester le Street", "country": "GB", "line1": "Station Lane Ind Est", "line2": "Birtley", "postalCode": "DH1 3RG", "region": "County Durham", "type": "Delivery"}, {"city": "Chester le Street", "country": "GB", "line1": "Station Lane Ind Est", "line2": "Birtley", "postalCode": "DH1 3RG", "region": "County Durham", "type": "Unknown"}], "contactName": "Stuart Lynn", "defaultCurrency": "GBP", "emailAddress": "newbusinessadvice@sage.com", "id": "MCN001", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-30T14:42:38Z", "phone": "0191 415 3434", "sourceModifiedDate": "2022-12-05T13:37:26Z", "status": "Active", "supplierName": "McNally Computer Supplies", "taxNumber": "GB455 2385 34"}], "totalResults": 15} + Sage Business Cloud Accounting: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/390083e2-351b-407c-a3be-55081c36c182/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"country": "United Kingdom (GB)", "type": "Billing"}], "contactName": "Main Contact", "defaultCurrency": "GBP", "id": "65179671e9ef424caff8b9006cd111c8", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "01224 658 999", "sourceModifiedDate": "2020-02-25T17:23:33Z", "status": "Active", "supplierName": "5555 Abdul's Test Name"}, {"addresses": [{"city": "London", "country": "United Kingdom (GB)", "line1": "1 Place House", "postalCode": "WC1X 1AH", "type": "Billing"}], "contactName": "Abdi", "defaultCurrency": "GBP", "emailAddress": "abdisupplier@company.com", "id": "cf7f44d693904944a6a7cf3de0887964", "modifiedDate": "2022-10-24T14:52:54Z", "phone": "(877) 492-8687", "sourceModifiedDate": "2020-02-13T10:38:19Z", "status": "Active", "supplierName": "Abdi Supplier"}], "totalResults": 64} + Sage Intacct: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/df02b289-cb16-4964-ac4d-9fd60b04538e/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [{"city": "Dallas", "country": "United States", "line1": "208 S Akard St", "line2": "", "postalCode": "75265", "region": "TX", "type": "Unknown"}], "contactName": "Jones, William", "defaultCurrency": "USD", "id": "3", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:20Z", "phone": "214-760-9491", "registrationNumber": "", "sourceModifiedDate": "2023-02-16T09:48:27", "status": "Active", "supplierName": "ADP", "taxNumber": "85-3678274"}, {"addresses": [{"city": "Drayton Valley", "country": "Canada", "line1": "5 Carey Hill", "line2": "", "postalCode": "G8V", "region": "Alberta", "type": "Unknown"}], "contactName": "Roach, Nathan", "defaultCurrency": "CAD", "id": "29", "metadata": {"isDeleted": false}, "modifiedDate": "2023-04-04T16:32:20Z", "phone": "130-202-4796", "registrationNumber": "", "sourceModifiedDate": "2022-06-15T11:38:29", "status": "Active", "supplierName": "Advisor Printing", "taxNumber": ""}], "totalResults": 77} + Wave: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/0b22b59d-b4e5-4c35-b03f-88bbbcb41256/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O1ZlbmRvcjo2NjA0Nzk0", "modifiedDate": "2022-11-16T18:15:24Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2020-04-07T13:28:02Z", "status": "Active", "supplierName": "Computer Shop"}, {"addresses": [], "contactName": "", "defaultCurrency": "GBP", "emailAddress": "", "id": "QnVzaW5lc3M6ZTI0OGQyZDctMWE5Ni00YTk4LWFkOTEtMDdlMGYyMmNhNmE2O1ZlbmRvcjo2NjA0NzQx", "modifiedDate": "2022-11-16T18:15:24Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2020-04-07T13:12:40Z", "status": "Active", "supplierName": "Flour Mill"}], "totalResults": 9} + Xero: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/5ced9667-a310-443a-a711-958d36377141/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "emailAddress": "", "id": "e4c9d0e2-c285-4e85-b579-6d28b180c730", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "phone": "01224 658 999", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active", "supplierName": "24 Locks"}, {"addresses": [], "emailAddress": "", "id": "bab779bc-c5fb-42cb-a888-953e8309711c", "metadata": {"isDeleted": false}, "modifiedDate": "2023-03-15T20:36:09Z", "phone": "01224 658 999", "sourceModifiedDate": "2023-02-17T18:03:42", "status": "Active", "supplierName": "7-Eleven"}], "totalResults": 48} + Zoho Books: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/suppliers?page=1&pageSize=2"}, "next": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/suppliers?page=2&pageSize=2"}, "self": {"href": "/companies/d0b68840-db50-4bc3-b88c-96e225333fea/data/suppliers"}}, "pageNumber": 1, "pageSize": 2, "results": [{"addresses": [], "defaultCurrency": "GBP", "emailAddress": "", "id": "104957000001494001", "modifiedDate": "2022-10-03T08:40:37Z", "phone": "01224 658 999", "sourceModifiedDate": "2022-09-16T13:09:56", "status": "Active", "supplierName": "Acme Corporation"}, {"addresses": [], "contactName": "Dre", "defaultCurrency": "CAD", "emailAddress": "", "id": "104957000000648001", "modifiedDate": "2022-10-03T08:40:37Z", "phone": "+44 25691 154789", "sourceModifiedDate": "2022-06-10T09:07:16", "status": "Active", "supplierName": "Cool company"}], "totalResults": 6} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + update-supplier: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171" + supplierId: "EILBDVJVNUAGVKRQ" + query: {} + requestBody: + application/json: {"addresses": [{"city": "Bakersfield", "country": "USA", "line1": "Unit 51", "line2": "Bakersfield Industrial Estate", "region": "California", "type": "Billing"}], "contactName": "Kelly's Industrial Supplies", "defaultCurrency": "string", "emailAddress": "sales@kellysupplies.com", "id": "C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F", "metadata": {"isDeleted": true}, "modifiedDate": "2022-10-23T00:00:00Z", "phone": "07999 999999", "registrationNumber": "string", "sourceModifiedDate": "2022-10-23T00:00:00Z", "status": "Unknown", "supplementalData": {"content": {"property1": {"property1": "", "property2": ""}, "property2": {"property1": "", "property2": ""}}}, "supplierName": "Kelly's Industrial Supplies", "taxNumber": "string"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-data-status: + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "200": + application/json: {"accountTransactions": {"currentStatus": "Complete", "dataType": "accountTransactions", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "balanceSheet": {"currentStatus": "Complete", "dataType": "balanceSheet", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "bankAccounts": {"currentStatus": "Complete", "dataType": "bankAccounts", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "bankTransactions": {"currentStatus": "Complete", "dataType": "bankTransactions", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "banking-accountBalances": {"currentStatus": "Complete", "dataType": "banking-accountBalances", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "banking-accounts": {"currentStatus": "Complete", "dataType": "banking-accounts", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "banking-transactionCategories": {"currentStatus": "Complete", "dataType": "banking-transactionCategories", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "banking-transactions": {"currentStatus": "Complete", "dataType": "banking-transactions", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "billCreditNotes": {"currentStatus": "Complete", "dataType": "billCreditNotes", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "billPayments": {"currentStatus": "Complete", "dataType": "billPayments", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "bills": {"currentStatus": "Complete", "dataType": "bills", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "cashFlowStatement": {"currentStatus": "Complete", "dataType": "cashFlowStatement", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "chartOfAccounts": {"currentStatus": "Complete", "dataType": "chartOfAccounts", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-companyInfo": {"currentStatus": "Complete", "dataType": "commerce-companyInfo", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-customers": {"currentStatus": "Complete", "dataType": "commerce-customers", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-disputes": {"currentStatus": "Complete", "dataType": "commerce-disputes", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-locations": {"currentStatus": "Complete", "dataType": "commerce-locations", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-orders": {"currentStatus": "Complete", "dataType": "commerce-orders", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-paymentMethods": {"currentStatus": "Complete", "dataType": "commerce-paymentMethods", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-payments": {"currentStatus": "Complete", "dataType": "commerce-payments", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-productCategories": {"currentStatus": "Complete", "dataType": "commerce-productCategories", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-products": {"currentStatus": "Complete", "dataType": "commerce-products", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-taxComponents": {"currentStatus": "Complete", "dataType": "commerce-taxComponents", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "commerce-transactions": {"currentStatus": "Complete", "dataType": "commerce-transactions", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "company": {"currentStatus": "Complete", "dataType": "company", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "creditNotes": {"currentStatus": "Complete", "dataType": "creditNotes", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "customers": {"currentStatus": "Complete", "dataType": "customers", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "directCosts": {"currentStatus": "Complete", "dataType": "directCosts", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "directIncomes": {"currentStatus": "Complete", "dataType": "directIncomes", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "invoices": {"currentStatus": "Complete", "dataType": "invoices", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "itemReceipts": {"currentStatus": "Complete", "dataType": "itemReceipts", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "items": {"currentStatus": "Complete", "dataType": "items", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "journalEntries": {"currentStatus": "Complete", "dataType": "journalEntries", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "journals": {"currentStatus": "Complete", "dataType": "journals", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "paymentMethods": {"currentStatus": "Complete", "dataType": "paymentMethods", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "payments": {"currentStatus": "Complete", "dataType": "payments", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "profitAndLoss": {"currentStatus": "Complete", "dataType": "profitAndLoss", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "purchaseOrders": {"currentStatus": "Complete", "dataType": "purchaseOrders", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "salesOrders": {"currentStatus": "Complete", "dataType": "salesOrders", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "suppliers": {"currentStatus": "Complete", "dataType": "suppliers", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "taxRates": {"currentStatus": "Complete", "dataType": "taxRates", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "trackingCategories": {"currentStatus": "Complete", "dataType": "trackingCategories", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}, "transfers": {"currentStatus": "Complete", "dataType": "transfers", "lastSuccessfulSync": "2022-01-01T00:00:00.000Z", "latestSuccessfulSyncId": "6883bba8-514d-423f-ba7f-c38285a80b7f", "latestSyncId": "d03b6979-eb3b-447a-a27a-13cf457a9f48"}} + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-pull-operation: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + datasetId: "7911a54a-c808-4f4b-b87e-b195f52b4da5" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-pull-operations: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [{"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5", "completed": "2022-10-23T00:00:00Z", "connectionId": "51baa045-4836-4317-a42e-3542e991e581", "dataType": "invoices", "id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b", "isCompleted": false, "isErrored": false, "progress": 10, "requested": "2022-11-14T11:18:37.2798351Z", "status": "Initial", "statusDescription": "Paused until 2022-10-23T00:00:00.000Z"}], "totalResults": 1} + "400": {} + Example: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history?page=1&pageSize=2"}, "next": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history?page=2&pageSize=2"}, "self": {"href": "/companies/17129e41-5389-4f10-ac06-e0a37e47d177/data/history"}}, "pageNumber": 0, "pageSize": 0, "results": [{"companyId": "4645bd78-8988-45bc-ac9e-67ba5df6e4e5", "completed": "2022-10-23T00:00:00Z", "connectionId": "51baa045-4836-4317-a42e-3542e991e581", "dataType": "invoices", "id": "97d60846-f07a-4d42-b5a0-0bdcc6ebf56b", "isCompleted": false, "isErrored": false, "progress": 10, "requested": "2022-11-14T11:18:37.2798351Z", "status": "Initial", "statusDescription": "Paused until 2022-10-23T00:00:00.000Z"}], "totalResults": 0} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + refresh-all-data-types: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + refresh-data-type: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + dataType: "invoices" + query: {} + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-push-operation: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + pushOperationKey: "b18d8d81-fd7b-4764-a31e-475cb1f36591" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-push-operations: + "": + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "200": + application/json: {"_links": {"current": {"href": "/companies/{id}/data/{dataType}?page=1&pageSize=10"}, "self": {"href": "/companies/{id}/data/{dataType}"}}, "pageNumber": 1, "pageSize": 10, "results": [], "totalResults": 1} + "400": {} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + query: + page: 1 + pageSize: 100 + query: "id=e3334455-1aed-4e71-ab43-6bccf12092ee" + orderBy: "-modifiedDate" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + create-adjustment-transaction: + Create adjustment: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"currency": "USD", "currencyRate": 1, "date": "2024-05-21T00:00:00+00:00", "id": "3357b3df-5f2e-465d-b9ba-226519dbb8f1", "lines": [{"accountRef": {"id": "80000018-1671793811"}, "amount": 50, "description": "debit line", "invoiceTo": {"id": "80000002-1674552702", "type": "customer"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "80000003-1674553958"}]}, {"accountRef": {"id": "80000028-1671794219"}, "amount": -50, "description": "credit line", "invoiceTo": {"id": "80000002-1674552702", "type": "customer"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "80000003-1674553958"}]}], "reference": "test reference"}] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [] + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-company-configuration: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + set-company-configuration: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: {"bankAccount": {"id": "32"}} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-expense-transaction: + Payment: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"bankAccountRef": {"id": "97"}, "contactRef": {"id": "430", "type": "Supplier"}, "currency": "GBP", "currencyRate": 1, "id": "4d7c6929-7770-412b-91bb-44d3bc71d111", "issueDate": "2024-05-21T00:00:00+00:00", "lines": [{"accountRef": {"id": "35"}, "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_5"}]}], "merchantName": "Amazon UK", "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "type": "Payment"}] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Refund: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"bankAccountRef": {"id": "97"}, "contactRef": {"id": "430", "type": "Supplier"}, "currency": "GBP", "id": "7008d3f2-aeb4-11ed-afa1-0242ac120002", "issueDate": "2024-02-17T00:00:00+00:00", "lines": [{"accountRef": {"id": "42"}, "invoiceTo": {"id": "80000002-1674552702", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_6"}]}], "merchantName": "Amazon UK", "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "type": "Refund"}] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"bankAccountRef": {"id": "97"}, "contactRef": {"id": "430", "type": "Supplier"}, "currency": "GBP", "currencyRate": 1, "id": "a44135b0-6882-489a-83fe-a0c57a4afb19", "issueDate": "2024-05-21T00:00:00+00:00", "lines": [{"accountRef": {"id": "35"}, "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_3"}, {"dataType": "trackingCategories", "id": "e9a1b63d-9ff0-40e7-8038-016354b987e6"}]}], "merchantName": "Amazon UK", "notes": "amazon purchase", "type": "Payment"}] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"bankAccountRef": {"id": "97"}, "contactRef": {"id": "430", "type": "Supplier"}, "currency": "GBP", "currencyRate": 1, "id": "a44135b0-6882-489a-83fe-a0c57a4afb19", "issueDate": "2024-05-21T00:00:00+00:00", "lines": [{"accountRef": {"id": "35"}, "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_3"}, {"dataType": "trackingCategories", "id": "e9a1b63d-9ff0-40e7-8038-016354b987e6"}]}], "merchantName": "Amazon UK", "notes": "amazon purchase", "type": "Payment"}] + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + update-expense-transaction: + Payment: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"bankAccountRef": {"id": "97"}, "contactRef": {"id": "430", "type": "Supplier"}, "currency": "GBP", "currencyRate": 1, "issueDate": "2024-05-21T00:00:00+00:00", "lines": [{"accountRef": {"id": "35"}, "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_5"}]}], "merchantName": "Amazon UK", "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "type": "Payment"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"bankAccountRef": {"id": "787dfb37-5707-4dc0-8a86-8d74e4cc78ea"}, "contactRef": {"id": "40e3e57c-2322-4898-966c-ca41adfd23fd", "type": "Supplier"}, "currency": "GBP", "issueDate": "2022-06-28T00:00:00.000Z", "lines": [], "merchantName": "Amazon UK", "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "type": "Payment"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-mapping-options: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + create-reimbursable-expense-transaction: + Create reimbursable expense: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [{"contactRef": {"id": "752"}, "currency": "GBP", "currencyRate": 1, "dueDate": "2024-05-21", "id": "4d7c6929-7770-412b-91bb-44d3bc71d111", "issueDate": "2024-05-21", "lines": [{"accountRef": {"id": "35"}, "description": "Hotel", "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_5"}]}], "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "reference": "expenses w/c 01/07"}] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [] + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + requestBody: + application/json: [] + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + update-reimbursable-expense-transaction: + Update reimbursable expense: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"contactRef": {"id": "752"}, "currency": "GBP", "currencyRate": 1, "dueDate": "2024-05-21", "issueDate": "2024-05-21", "lines": [{"accountRef": {"id": "35"}, "description": "Hotel", "invoiceTo": {"id": "504", "type": "customer"}, "itemRef": {"id": "80000002-1675158984"}, "netAmount": 100, "taxAmount": 20, "taxRateRef": {"id": "23_Bills"}, "trackingRefs": [{"dataType": "trackingCategories", "id": "DEPARTMENT_5"}]}], "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590", "reference": "expenses w/c 01/07"} + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"contactRef": {"id": "40e3e57c-2322-4898-966c-ca41adfd23fd"}, "currency": "GBP", "dueDate": "2022-10-23T00:00:00Z", "issueDate": "2022-10-23T00:00:00Z", "lines": [], "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590"} + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"contactRef": {"id": "40e3e57c-2322-4898-966c-ca41adfd23fd"}, "currency": "GBP", "dueDate": "2022-10-23T00:00:00Z", "issueDate": "2022-10-23T00:00:00Z", "lines": [], "notes": "APPLE.COM/BILL - 09001077498 - Card Ending: 4590"} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + get-sync-by-id: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + syncId: "6fb40d5e-b13e-11ed-afa1-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-last-successful-sync: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-latest-sync: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-syncs: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + get-sync-transaction: + Unauthorized: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + syncId: "6fb40d5e-b13e-11ed-afa1-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + responses: + "401": + application/json: {"canBeRetried": "Unknown", "correlationId": "7eb40d6b415d7bcd99ce658268284056", "detailedErrorCode": 0, "error": "Unauthorized", "service": "PublicApi", "statusCode": 401} + list-sync-transactions: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + syncId: "6fb40d5e-b13e-11ed-afa1-0242ac120002" + query: + page: 1 + pageSize: 100 + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error parsing query - Malformed query.", "service": "ClientsApi", "statusCode": 400} + Unresolved property: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + syncId: "6fb40d5e-b13e-11ed-afa1-0242ac120002" + query: + page: 1 + pageSize: 100 + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "98457fb9956b7f9b4b2fd4f6e23bb5c8", "detailedErrorCode": 0, "error": "Error parsing query - Could not resolve property isCompleted on Dataset", "service": "PullApi", "statusCode": 400} + upload-expense-attachment: + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + syncId: "6fb40d5e-b13e-11ed-afa1-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} + create-transfer-transaction: + Create transfer: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"date": "2021-05-21T00:00:00+00:00", "description": "Sample transfer description", "from": {"accountRef": {"id": "787dfb37-5707-4dc0-8a86-8d74e4cc78ea"}, "amount": 100}, "to": {"accountRef": {"id": "777dfb37-5506-3dc0-6g86-8d34z4cc78ea"}, "amount": 100}} + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + "400": {} + Example 1: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"date": "2022-10-23T00:00:00Z", "description": "Transfer from bank account Y to bank account Z", "from": {"accountRef": {"id": ""}, "amount": "4893.82"}, "to": {"accountRef": {"id": ""}, "amount": "6384.24"}} + responses: + "200": + application/json: {"syncId": "cd937d46-8e41-43a9-9477-a79158ffd98a"} + Malformed query: + parameters: + path: + companyId: "8a210b68-6988-11ed-a1eb-0242ac120002" + transactionId: "336694d8-2dca-4cb5-a28d-3ccb83e55eee" + requestBody: + application/json: {"date": "2022-10-23T00:00:00Z", "description": "Transfer from bank account Y to bank account Z", "from": {"accountRef": {"id": ""}, "amount": "4174.58"}, "to": {"accountRef": {"id": ""}, "amount": "2884.08"}} + responses: + "400": + application/json: {"canBeRetried": "Unknown", "correlationId": "bc997528a9d7abb9161ef45f05d38599", "detailedErrorCode": 0, "error": "Error processing request - not valid.", "service": "PublicApi", "statusCode": 400} diff --git a/sync-for-expenses/.speakeasy/gen.yaml b/sync-for-expenses/.speakeasy/gen.yaml index 2f435d600..d95eb97a6 100644 --- a/sync-for-expenses/.speakeasy/gen.yaml +++ b/sync-for-expenses/.speakeasy/gen.yaml @@ -11,8 +11,9 @@ generation: oAuth2ClientCredentialsEnabled: false telemetryEnabled: true go: - version: 4.2.1 + version: 4.3.0 additionalDependencies: {} + allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true imports: @@ -25,6 +26,7 @@ go: webhooks: pkg/models/webhooks inputModelSuffix: input maxMethodParams: 0 + methodArguments: require-security-and-request outputModelSuffix: output packageName: github.com/codatio/client-sdk-go/sync-for-expenses responseFormat: envelope diff --git a/sync-for-expenses/CONTRIBUTING.md b/sync-for-expenses/CONTRIBUTING.md new file mode 100644 index 000000000..d585717fc --- /dev/null +++ b/sync-for-expenses/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/sync-for-expenses/README.md b/sync-for-expenses/README.md index d5fc77bc1..f320e46ad 100755 --- a/sync-for-expenses/README.md +++ b/sync-for-expenses/README.md @@ -4,9 +4,60 @@ Embedded accounting integrations for corporate card providers. + +## Summary + +Sync for Expenses: The API for Sync for Expenses. + +Sync for Expenses is an API and a set of supporting tools. It has been built to +enable corporate card and expense management platforms to provide high-quality +integrations with multiple accounting software through a standardized API. + +[Explore product](https://docs.codat.io/sync-for-expenses/overview) | [See our OpenAPI spec](https://github.com/codatio/oas) + +Not seeing the endpoints you're expecting? We've [reorganized our products](https://docs.codat.io/updates/230901-new-products), and you may be using a [different version of Sync for Expenses](https://docs.codat.io/sync-for-expenses-v1-api#/). + +--- + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Configuration | View and manage mapping configuration and defaults for expense transactions. | +| Sync | Monitor the status of data syncs. | +| Expenses | Create and update transactions that represent your customers' spend. | +| Transfers | Create and update transactions that represent the movement of your customers' money. | +| Reimbursements | Create and update transactions that represent your customers' repayable spend. | +| Attachments | Attach receipts to a transaction for a complete audit trail. | +| Transaction status | Monitor the status of individual transactions in data syncs. | +| Manage data | Control and monitor the retrieval of data from an integration. | +| Push operations | View historic push operations. | +| Accounts | Create accounts and view account schemas. | +| Customers | Get, create, and update customers. | +| Suppliers | Get, create, and update suppliers. | + + + + +## Table of Contents + +* [SDK Installation](#sdk-installation) +* [SDK Example Usage](#sdk-example-usage) +* [Available Resources and Operations](#available-resources-and-operations) +* [Retries](#retries) +* [Error Handling](#error-handling) +* [Server Selection](#server-selection) +* [Custom HTTP Client](#custom-http-client) +* [Authentication](#authentication) +* [Special Types](#special-types) + + ## SDK Installation +To add the SDK as a dependency to your project: ```bash go get github.com/codatio/client-sdk-go/sync-for-expenses ``` @@ -36,7 +87,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) @@ -52,6 +108,28 @@ func main() { ## Available Resources and Operations +
+Available methods + +### [Accounts](docs/sdks/accounts/README.md) + +* [Create](docs/sdks/accounts/README.md#create) - Create account +* [GetCreateModel](docs/sdks/accounts/README.md#getcreatemodel) - Get create account model + +### [Adjustments](docs/sdks/adjustments/README.md) + +* [Create](docs/sdks/adjustments/README.md#create) - Create adjustment transaction + +### [Attachments](docs/sdks/attachments/README.md) + +* [Upload](docs/sdks/attachments/README.md#upload) - Upload attachment + +### [BankAccounts](docs/sdks/bankaccounts/README.md) + +* [Create](docs/sdks/bankaccounts/README.md#create) - Create bank account +* [GetCreateModel](docs/sdks/bankaccounts/README.md#getcreatemodel) - Get create bank account model + + ### [Companies](docs/sdks/companies/README.md) * [Create](docs/sdks/companies/README.md#create) - Create company @@ -60,6 +138,11 @@ func main() { * [List](docs/sdks/companies/README.md#list) - List companies * [Update](docs/sdks/companies/README.md#update) - Update company +### [Configuration](docs/sdks/configuration/README.md) + +* [Get](docs/sdks/configuration/README.md#get) - Get company configuration +* [Set](docs/sdks/configuration/README.md#set) - Set company configuration + ### [Connections](docs/sdks/connections/README.md) * [Create](docs/sdks/connections/README.md#create) - Create connection @@ -69,11 +152,6 @@ func main() { * [List](docs/sdks/connections/README.md#list) - List connections * [Unlink](docs/sdks/connections/README.md#unlink) - Unlink connection -### [Accounts](docs/sdks/accounts/README.md) - -* [Create](docs/sdks/accounts/README.md#create) - Create account -* [GetCreateModel](docs/sdks/accounts/README.md#getcreatemodel) - Get create account model - ### [Customers](docs/sdks/customers/README.md) * [Create](docs/sdks/customers/README.md#create) - Create customer @@ -81,12 +159,10 @@ func main() { * [List](docs/sdks/customers/README.md#list) - List customers * [Update](docs/sdks/customers/README.md#update) - Update customer -### [Suppliers](docs/sdks/suppliers/README.md) +### [Expenses](docs/sdks/expenses/README.md) -* [Create](docs/sdks/suppliers/README.md#create) - Create supplier -* [Get](docs/sdks/suppliers/README.md#get) - Get supplier -* [List](docs/sdks/suppliers/README.md#list) - List suppliers -* [Update](docs/sdks/suppliers/README.md#update) - Update supplier +* [Create](docs/sdks/expenses/README.md#create) - Create expense transaction +* [Update](docs/sdks/expenses/README.md#update) - Update expense transactions ### [ManageData](docs/sdks/managedata/README.md) @@ -96,33 +172,32 @@ func main() { * [RefreshAllDataTypes](docs/sdks/managedata/README.md#refreshalldatatypes) - Refresh all data * [RefreshDataType](docs/sdks/managedata/README.md#refreshdatatype) - Refresh data type +### [MappingOptions](docs/sdks/mappingoptions/README.md) + +* [GetMappingOptions](docs/sdks/mappingoptions/README.md#getmappingoptions) - Mapping options + ### [PushOperations](docs/sdks/pushoperations/README.md) * [Get](docs/sdks/pushoperations/README.md#get) - Get push operation * [List](docs/sdks/pushoperations/README.md#list) - List push operations -### [Configuration](docs/sdks/configuration/README.md) - -* [Get](docs/sdks/configuration/README.md#get) - Get company configuration -* [GetMappingOptions](docs/sdks/configuration/README.md#getmappingoptions) - Mapping options -* [Set](docs/sdks/configuration/README.md#set) - Set company configuration - -### [Expenses](docs/sdks/expenses/README.md) - -* [Create](docs/sdks/expenses/README.md#create) - Create expense transaction -* [Update](docs/sdks/expenses/README.md#update) - Update expense transactions - ### [Reimbursements](docs/sdks/reimbursements/README.md) * [Create](docs/sdks/reimbursements/README.md#create) - Create reimbursable expense transaction * [Update](docs/sdks/reimbursements/README.md#update) - Update reimbursable expense transaction +### [Suppliers](docs/sdks/suppliers/README.md) + +* [Create](docs/sdks/suppliers/README.md#create) - Create supplier +* [Get](docs/sdks/suppliers/README.md#get) - Get supplier +* [List](docs/sdks/suppliers/README.md#list) - List suppliers +* [Update](docs/sdks/suppliers/README.md#update) - Update supplier + ### [Sync](docs/sdks/sync/README.md) * [Get](docs/sdks/sync/README.md#get) - Get sync status * [GetLastSuccessfulSync](docs/sdks/sync/README.md#getlastsuccessfulsync) - Last successful sync * [GetLatestSync](docs/sdks/sync/README.md#getlatestsync) - Latest sync status -* [InitiateSync](docs/sdks/sync/README.md#initiatesync) - Initiate sync * [List](docs/sdks/sync/README.md#list) - List sync statuses ### [TransactionStatus](docs/sdks/transactionstatus/README.md) @@ -130,13 +205,11 @@ func main() { * [Get](docs/sdks/transactionstatus/README.md#get) - Get sync transaction * [List](docs/sdks/transactionstatus/README.md#list) - List sync transactions -### [Attachments](docs/sdks/attachments/README.md) - -* [Upload](docs/sdks/attachments/README.md#upload) - Upload attachment - ### [Transfers](docs/sdks/transfers/README.md) * [Create](docs/sdks/transfers/README.md#create) - Create transfer transaction + +
@@ -154,7 +227,7 @@ func main() { Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. -To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call by using the `WithRetries` option: +To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option: ```go package main @@ -162,7 +235,7 @@ import ( "context" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "log" "pkg/models/operations" ) @@ -175,11 +248,16 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }, operations.WithRetries( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -205,16 +283,16 @@ import ( "context" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "log" ) func main() { s := syncforexpenses.New( syncforexpenses.WithRetryConfig( - utils.RetryConfig{ + retry.Config{ Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + Backoff: &retry.BackoffStrategy{ InitialInterval: 1, MaxInterval: 50, Exponent: 1.1, @@ -228,7 +306,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) @@ -273,7 +356,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { @@ -326,7 +414,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) @@ -361,7 +454,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) @@ -433,7 +531,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) diff --git a/sync-for-expenses/RELEASES.md b/sync-for-expenses/RELEASES.md index df650cf36..e15c68a69 100644 --- a/sync-for-expenses/RELEASES.md +++ b/sync-for-expenses/RELEASES.md @@ -432,4 +432,14 @@ Based on: ### Generated - [go v4.2.1] sync-for-expenses ### Releases -- [Go v4.2.1] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-expenses/v4.2.1 - sync-for-expenses \ No newline at end of file +- [Go v4.2.1] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-expenses/v4.2.1 - sync-for-expenses + +## 2024-09-14 08:55:50 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.396.9 (2.415.7) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v4.3.0] sync-for-expenses +### Releases +- [Go v4.3.0] https://github.com/codatio/client-sdk-go/releases/tag/sync-for-expenses/v4.3.0 - sync-for-expenses \ No newline at end of file diff --git a/sync-for-expenses/USAGE.md b/sync-for-expenses/USAGE.md index d80562342..c03be0159 100644 --- a/sync-for-expenses/USAGE.md +++ b/sync-for-expenses/USAGE.md @@ -17,7 +17,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) diff --git a/sync-for-expenses/accounts.go b/sync-for-expenses/accounts.go index d7d728bd1..301790f2a 100644 --- a/sync-for-expenses/accounts.go +++ b/sync-for-expenses/accounts.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Accounts +// Accounts - Create accounts and view create account options. type Accounts struct { sdkConfiguration sdkConfiguration } @@ -48,6 +49,7 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -55,6 +57,7 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/accounts", request, nil) if err != nil { @@ -66,6 +69,17 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -85,10 +99,11 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -96,33 +111,60 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -131,15 +173,19 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -149,17 +195,25 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateAccountResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -167,6 +221,11 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR res.CreateAccountResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -186,6 +245,11 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -193,17 +257,33 @@ func (s *Accounts) Create(ctx context.Context, request operations.CreateAccountR return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetCreateModel - Get create account model @@ -227,6 +307,7 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -234,12 +315,24 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/chartOfAccounts", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -254,10 +347,11 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -265,33 +359,60 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -300,15 +421,19 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -318,17 +443,25 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PushOption if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -336,6 +469,11 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre res.PushOption = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -353,6 +491,11 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -360,15 +503,31 @@ func (s *Accounts) GetCreateModel(ctx context.Context, request operations.GetCre return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/adjustments.go b/sync-for-expenses/adjustments.go new file mode 100644 index 000000000..3359597e9 --- /dev/null +++ b/sync-for-expenses/adjustments.go @@ -0,0 +1,283 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package syncforexpenses + +import ( + "bytes" + "context" + "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/internal/hooks" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "io" + "net/http" +) + +// Adjustments - Create transactions that represent your adjustments to your customers' spend. +type Adjustments struct { + sdkConfiguration sdkConfiguration +} + +func newAdjustments(sdkConfig sdkConfiguration) *Adjustments { + return &Adjustments{ + sdkConfiguration: sdkConfig, + } +} + +// Create adjustment transaction +// Use the *Create adjustment expense* endpoint to create an [adjustment](https://docs.codat.io/sync-for-expenses-api#/schemas/AdjustmentTransactionRequest) in the accounting software for a given company's connection. +// +// Adjustments represent write-offs and transaction alterations, such as foreign exchange adjustments, in the form of a journal entry. +// +// ### Supported Integrations +// +// | Integration | Supported | +// |-----------------------|-----------| +// | QuickBooks Desktop | Yes | +func (s *Adjustments) Create(ctx context.Context, request operations.CreateAdjustmentTransactionRequest, opts ...operations.Option) (*operations.CreateAdjustmentTransactionResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-adjustment-transaction", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/adjustment-transactions", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + req.Header.Set("Content-Type", reqContentType) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 3600000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateAdjustmentTransactionResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.AdjustmentTransactionResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.AdjustmentTransactionResponse = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 402: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 429: + fallthrough + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/sync-for-expenses/attachments.go b/sync-for-expenses/attachments.go index 0b557f864..697a06d77 100644 --- a/sync-for-expenses/attachments.go +++ b/sync-for-expenses/attachments.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Attachments - Upload attachmens to expenses, transfers and reimbursable expense transactions. +// Attachments - Attach receipts to a transaction for a complete audit trail. type Attachments struct { sdkConfiguration sdkConfiguration } @@ -38,7 +39,7 @@ func newAttachments(sdkConfig sdkConfiguration) *Attachments { // // | Integration | File Size | File Extension | // |-------------|-------------|--------------------------------------------------------------------------------------------------------------| -// | Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | +// | Xero | 3MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | // | QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | // | NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | // | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | @@ -53,6 +54,7 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -60,6 +62,7 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}/attachments", request, nil) if err != nil { @@ -71,6 +74,17 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -86,10 +100,11 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -97,33 +112,60 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -132,15 +174,19 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -150,17 +196,25 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Attachment if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -168,6 +222,11 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen res.Attachment = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -187,6 +246,11 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -194,15 +258,31 @@ func (s *Attachments) Upload(ctx context.Context, request operations.UploadExpen return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/bankaccounts.go b/sync-for-expenses/bankaccounts.go new file mode 100644 index 000000000..8aac95d5e --- /dev/null +++ b/sync-for-expenses/bankaccounts.go @@ -0,0 +1,533 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package syncforexpenses + +import ( + "bytes" + "context" + "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/internal/hooks" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "io" + "net/http" +) + +// BankAccounts - Create bank accounts and view create bank account options. +type BankAccounts struct { + sdkConfiguration sdkConfiguration +} + +func newBankAccounts(sdkConfig sdkConfiguration) *BankAccounts { + return &BankAccounts{ + sdkConfiguration: sdkConfig, + } +} + +// Create bank account +// The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) for a given company's connection. +// +// [Bank accounts](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. +// +// **Integration-specific behaviour** +// +// Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/sync-for-expenses-api#/operations/get-create-update-bankAccounts-model). +// +// Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating an account. +func (s *BankAccounts) Create(ctx context.Context, request operations.CreateBankAccountRequest, opts ...operations.Option) (*operations.CreateBankAccountResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "create-bank-account", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/bankAccounts", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, true, true, "BankAccount", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + req.Header.Set("Content-Type", reqContentType) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 3600000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.CreateBankAccountResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.CreateBankAccountResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.CreateBankAccountResponse = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + fallthrough + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 402: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 429: + fallthrough + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetCreateModel - Get create bank account model +// The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) for a given company and integration. +// +// [Bank accounts](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. +// +// **Integration-specific behaviour** +// +// See the *response examples* for integration-specific indicative models. +// +// Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating and updating a bank account. +func (s *BankAccounts) GetCreateModel(ctx context.Context, request operations.GetCreateBankAccountsModelRequest, opts ...operations.Option) (*operations.GetCreateBankAccountsModelResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-create-bankAccounts-model", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/options/bankAccounts", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 3600000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetCreateBankAccountsModelResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.PushOption + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PushOption = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 402: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 429: + fallthrough + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/sync-for-expenses/codatsyncexpenses.go b/sync-for-expenses/codatsyncexpenses.go index 85e787ef0..8f6095621 100644 --- a/sync-for-expenses/codatsyncexpenses.go +++ b/sync-for-expenses/codatsyncexpenses.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -7,6 +7,7 @@ import ( "fmt" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/internal/hooks" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "net/http" "time" @@ -40,6 +41,9 @@ func Float32(f float32) *float32 { return &f } // Float64 provides a helper function to return a pointer to a float64 func Float64(f float64) *float64 { return &f } +// Pointer provides a helper function to return a pointer to a type +func Pointer[T any](v T) *T { return &v } + type sdkConfiguration struct { Client HTTPClient Security func(context.Context) (interface{}, error) @@ -50,8 +54,9 @@ type sdkConfiguration struct { SDKVersion string GenVersion string UserAgent string - RetryConfig *utils.RetryConfig + RetryConfig *retry.Config Hooks *hooks.Hooks + Timeout *time.Duration } func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { @@ -66,41 +71,67 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { // // Sync for Expenses is an API and a set of supporting tools. It has been built to // enable corporate card and expense management platforms to provide high-quality -// integrations with multiple accounting platforms through a standardized API. -// -// [Read more...](https://docs.codat.io/sync-for-expenses/overview) +// integrations with multiple accounting software through a standardized API. // -// [See our OpenAPI spec](https://github.com/codatio/oas) +// [Explore product](https://docs.codat.io/sync-for-expenses/overview) | [See our OpenAPI spec](https://github.com/codatio/oas) // // Not seeing the endpoints you're expecting? We've [reorganized our products](https://docs.codat.io/updates/230901-new-products), and you may be using a [different version of Sync for Expenses](https://docs.codat.io/sync-for-expenses-v1-api#/). +// +// --- +// +// ## Endpoints +// +// | Endpoints | Description | +// | :- |:- | +// | Companies | Create and manage your SMB users' companies. | +// | Connections | Create new and manage existing data connections for a company. | +// | Configuration | View and manage mapping configuration and defaults for expense transactions. | +// | Sync | Monitor the status of data syncs. | +// | Expenses | Create and update transactions that represent your customers' spend. | +// | Transfers | Create and update transactions that represent the movement of your customers' money. | +// | Reimbursements | Create and update transactions that represent your customers' repayable spend. | +// | Attachments | Attach receipts to a transaction for a complete audit trail. | +// | Transaction status | Monitor the status of individual transactions in data syncs. | +// | Manage data | Control and monitor the retrieval of data from an integration. | +// | Push operations | View historic push operations. | +// | Accounts | Create accounts and view account schemas. | +// | Customers | Get, create, and update customers. | +// | Suppliers | Get, create, and update suppliers. | +// type CodatSyncExpenses struct { - // Create and manage your Codat companies. + // Create and manage your SMB users' companies. Companies *Companies - // Create and manage partner expense connection. + // Create new and manage existing data connections for a company. Connections *Connections - // Accounts + // Create bank accounts and view create bank account options. + BankAccounts *BankAccounts + // Create accounts and view create account options. Accounts *Accounts - // Customers + // Get, create, and update customers. Customers *Customers - // Suppliers + // Get, create, and update suppliers. Suppliers *Suppliers - // Asynchronously retrieve data from an integration to refresh data in Codat. + // Control and monitor the retrieval of data from an integration. ManageData *ManageData - // Access create, update and delete operations made to an SMB's data connection. + // View historic push operations. PushOperations *PushOperations - // Manage mapping options and sync configuration. + // Create transactions that represent your adjustments to your customers' spend. + Adjustments *Adjustments + // View and manage mapping configuration and defaults for expense transactions. Configuration *Configuration - // Create expense transactions. + // Create and update transactions that represent your customers' spend. Expenses *Expenses - // Create reimbursable expense transactions. + // Get accounts, trackingCategories and taxRates that can be used in your create and update requests. + MappingOptions *MappingOptions + // Create and update transactions that represent your customers' repayable spend. Reimbursements *Reimbursements - // Trigger and monitor expense syncs to accounting software. + // Monitor the status of data syncs. Sync *Sync - // Retrieve the status of transactions within a sync. + // Monitor the status of individual transactions in data syncs. TransactionStatus *TransactionStatus - // Upload attachmens to expenses, transfers and reimbursable expense transactions. + // Attach receipts to a transaction for a complete audit trail. Attachments *Attachments - // Create transfer transactions. + // Create and update transactions that represent the movement of your customers' money. Transfers *Transfers sdkConfiguration sdkConfiguration @@ -144,17 +175,11 @@ func WithClient(client HTTPClient) SDKOption { } } -func withSecurity(security interface{}) func(context.Context) (interface{}, error) { - return func(context.Context) (interface{}, error) { - return security, nil - } -} - // WithSecurity configures the SDK to use the provided security details func WithSecurity(authHeader string) SDKOption { return func(sdk *CodatSyncExpenses) { security := shared.Security{AuthHeader: authHeader} - sdk.sdkConfiguration.Security = withSecurity(&security) + sdk.sdkConfiguration.Security = utils.AsSecuritySource(&security) } } @@ -167,21 +192,28 @@ func WithSecuritySource(security func(context.Context) (shared.Security, error)) } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *CodatSyncExpenses) { sdk.sdkConfiguration.RetryConfig = &retryConfig } } +// WithTimeout Optional request timeout applied to each operation +func WithTimeout(timeout time.Duration) SDKOption { + return func(sdk *CodatSyncExpenses) { + sdk.sdkConfiguration.Timeout = &timeout + } +} + // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *CodatSyncExpenses { sdk := &CodatSyncExpenses{ sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "prealpha", - SDKVersion: "4.2.1", - GenVersion: "2.301.3", - UserAgent: "speakeasy-sdk/go 4.2.1 2.301.3 prealpha github.com/codatio/client-sdk-go/sync-for-expenses", + SDKVersion: "4.3.0", + GenVersion: "2.415.7", + UserAgent: "speakeasy-sdk/go 4.3.0 2.415.7 prealpha github.com/codatio/client-sdk-go/sync-for-expenses", Hooks: hooks.New(), }, } @@ -205,6 +237,8 @@ func New(opts ...SDKOption) *CodatSyncExpenses { sdk.Connections = newConnections(sdk.sdkConfiguration) + sdk.BankAccounts = newBankAccounts(sdk.sdkConfiguration) + sdk.Accounts = newAccounts(sdk.sdkConfiguration) sdk.Customers = newCustomers(sdk.sdkConfiguration) @@ -215,10 +249,14 @@ func New(opts ...SDKOption) *CodatSyncExpenses { sdk.PushOperations = newPushOperations(sdk.sdkConfiguration) + sdk.Adjustments = newAdjustments(sdk.sdkConfiguration) + sdk.Configuration = newConfiguration(sdk.sdkConfiguration) sdk.Expenses = newExpenses(sdk.sdkConfiguration) + sdk.MappingOptions = newMappingOptions(sdk.sdkConfiguration) + sdk.Reimbursements = newReimbursements(sdk.sdkConfiguration) sdk.Sync = newSync(sdk.sdkConfiguration) diff --git a/sync-for-expenses/companies.go b/sync-for-expenses/companies.go index 60f844261..ef2acb483 100644 --- a/sync-for-expenses/companies.go +++ b/sync-for-expenses/companies.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,13 +11,14 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" "net/url" ) -// Companies - Create and manage your Codat companies. +// Companies - Create and manage your SMB users' companies. type Companies struct { sdkConfiguration sdkConfiguration } @@ -46,6 +47,7 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -53,6 +55,7 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/companies") if err != nil { @@ -64,6 +67,17 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -79,10 +93,11 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -90,33 +105,60 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -125,15 +167,19 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -143,17 +189,25 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Company if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -161,6 +215,11 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo res.Company = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -178,6 +237,11 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -185,17 +249,33 @@ func (s *Companies) Create(ctx context.Context, request *shared.CompanyRequestBo return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Delete a company @@ -214,6 +294,7 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -221,12 +302,24 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -241,10 +334,11 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -252,33 +346,60 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -287,15 +408,19 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -305,12 +430,15 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: @@ -329,6 +457,11 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -336,17 +469,33 @@ func (s *Companies) Delete(ctx context.Context, request operations.DeleteCompany return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Get company @@ -365,6 +514,7 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -372,12 +522,24 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -392,10 +554,11 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -403,33 +566,60 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -438,15 +628,19 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -456,17 +650,25 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Company if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -474,6 +676,11 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques res.Company = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -491,6 +698,11 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -498,17 +710,33 @@ func (s *Companies) Get(ctx context.Context, request operations.GetCompanyReques return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List companies @@ -527,6 +755,7 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -534,12 +763,24 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/companies") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -558,10 +799,11 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -569,33 +811,60 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -604,15 +873,19 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -622,17 +895,25 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Companies if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -640,6 +921,11 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe res.Companies = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -659,6 +945,11 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -666,17 +957,33 @@ func (s *Companies) List(ctx context.Context, request operations.ListCompaniesRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Update company @@ -696,6 +1003,7 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -703,6 +1011,7 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}", request, nil) if err != nil { @@ -714,6 +1023,17 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -729,10 +1049,11 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -740,33 +1061,60 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -775,15 +1123,19 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -793,17 +1145,25 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Company if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -811,6 +1171,11 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany res.Company = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -828,6 +1193,11 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -835,15 +1205,31 @@ func (s *Companies) Update(ctx context.Context, request operations.UpdateCompany return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/configuration.go b/sync-for-expenses/configuration.go index 5c3b36bb5..b769ba176 100644 --- a/sync-for-expenses/configuration.go +++ b/sync-for-expenses/configuration.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Configuration - Manage mapping options and sync configuration. +// Configuration - View and manage mapping configuration and defaults for expense transactions. type Configuration struct { sdkConfiguration sdkConfiguration } @@ -28,7 +29,7 @@ func newConfiguration(sdkConfig sdkConfiguration) *Configuration { } // Get company configuration -// Gets a companies expense sync configuration +// Gets a company's expense sync configuration func (s *Configuration) Get(ctx context.Context, request operations.GetCompanyConfigurationRequest, opts ...operations.Option) (*operations.GetCompanyConfigurationResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -40,6 +41,7 @@ func (s *Configuration) Get(ctx context.Context, request operations.GetCompanyCo o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -47,12 +49,24 @@ func (s *Configuration) Get(ctx context.Context, request operations.GetCompanyCo return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/config", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -67,10 +81,11 @@ func (s *Configuration) Get(ctx context.Context, request operations.GetCompanyCo globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -78,192 +93,60 @@ func (s *Configuration) Get(ctx context.Context, request operations.GetCompanyCo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody } - req.Body = copyBody - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, backoff.Permanent(err) - } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") + return nil, backoff.Permanent(err) } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } - res := &operations.GetCompanyConfigurationResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out shared.CompanyConfiguration - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } + return httpRes, err + }) - res.CompanyConfiguration = &out - default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 401: - fallthrough - case httpRes.StatusCode == 402: - fallthrough - case httpRes.StatusCode == 403: - fallthrough - case httpRes.StatusCode == 404: - fallthrough - case httpRes.StatusCode == 429: - fallthrough - case httpRes.StatusCode == 500: - fallthrough - case httpRes.StatusCode == 503: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - return nil, &out - default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil -} - -// GetMappingOptions - Mapping options -// Gets the expense mapping options for a companies accounting software -func (s *Configuration) GetMappingOptions(ctx context.Context, request operations.GetMappingOptionsRequest, opts ...operations.Option) (*operations.GetMappingOptionsResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "get-mapping-options", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/mappingOptions", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } + if err != nil { + return nil, err } else { - retryConfig = globalRetryConfig - } - } - - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -272,42 +155,59 @@ func (s *Configuration) GetMappingOptions(ctx context.Context, request operation } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } - res := &operations.GetMappingOptionsResponse{ + res := &operations.GetCompanyConfigurationResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out shared.MappingOptions + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.CompanyConfiguration if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.MappingOptions = &out + res.CompanyConfiguration = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -325,6 +225,11 @@ func (s *Configuration) GetMappingOptions(ctx context.Context, request operation case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -332,21 +237,37 @@ func (s *Configuration) GetMappingOptions(ctx context.Context, request operation return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Set company configuration -// Sets a companies expense sync configuration +// Sets a company's expense sync configuration func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyConfigurationRequest, opts ...operations.Option) (*operations.SetCompanyConfigurationResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -358,6 +279,7 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -365,6 +287,7 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/config", request, nil) if err != nil { @@ -376,6 +299,17 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -391,10 +325,11 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -402,33 +337,60 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -437,15 +399,19 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -455,17 +421,25 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CompanyConfiguration if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -473,6 +447,11 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo res.CompanyConfiguration = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -492,6 +471,11 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -499,15 +483,31 @@ func (s *Configuration) Set(ctx context.Context, request operations.SetCompanyCo return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/connections.go b/sync-for-expenses/connections.go index 30f66356d..653ef1556 100644 --- a/sync-for-expenses/connections.go +++ b/sync-for-expenses/connections.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Connections - Create and manage partner expense connection. +// Connections - Create new and manage existing data connections for a company. type Connections struct { sdkConfiguration sdkConfiguration } @@ -42,6 +43,7 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -49,6 +51,7 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections", request, nil) if err != nil { @@ -60,6 +63,17 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -75,10 +89,11 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,33 +101,60 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -121,15 +163,19 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -139,17 +185,25 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Connection if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -157,6 +211,11 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne res.Connection = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -174,6 +233,11 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -181,17 +245,33 @@ func (s *Connections) Create(ctx context.Context, request operations.CreateConne return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // CreatePartnerExpenseConnection - Create partner expense connection @@ -207,6 +287,7 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -214,12 +295,24 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/connections/partnerExpense", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -234,10 +327,11 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -245,33 +339,60 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -280,15 +401,19 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -298,17 +423,25 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Connection if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -316,6 +449,11 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques res.Connection = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -335,6 +473,11 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -342,17 +485,33 @@ func (s *Connections) CreatePartnerExpenseConnection(ctx context.Context, reques return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Delete connection @@ -369,6 +528,7 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -376,12 +536,24 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -396,10 +568,11 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -407,33 +580,60 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -442,15 +642,19 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -460,12 +664,15 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: @@ -484,6 +691,11 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -491,17 +703,33 @@ func (s *Connections) Delete(ctx context.Context, request operations.DeleteConne return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Get connection @@ -517,6 +745,7 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -524,12 +753,24 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -544,10 +785,11 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -555,33 +797,60 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -590,15 +859,19 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -608,17 +881,25 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Connection if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -626,6 +907,11 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR res.Connection = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -643,6 +929,11 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -650,17 +941,33 @@ func (s *Connections) Get(ctx context.Context, request operations.GetConnectionR return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List connections @@ -676,6 +983,7 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -683,12 +991,24 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -707,10 +1027,11 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -718,33 +1039,60 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -753,15 +1101,19 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -771,17 +1123,25 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Connections if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -789,6 +1149,11 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio res.Connections = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -808,6 +1173,11 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -815,17 +1185,33 @@ func (s *Connections) List(ctx context.Context, request operations.ListConnectio return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Unlink connection @@ -841,6 +1227,7 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -848,6 +1235,7 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}", request, nil) if err != nil { @@ -859,6 +1247,17 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PATCH", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -874,10 +1273,11 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -885,33 +1285,60 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -920,15 +1347,19 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -938,17 +1369,25 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Connection if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -956,6 +1395,11 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne res.Connection = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -973,6 +1417,11 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -980,15 +1429,31 @@ func (s *Connections) Unlink(ctx context.Context, request operations.UnlinkConne return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/customers.go b/sync-for-expenses/customers.go index c29febc22..fbb08a4fa 100644 --- a/sync-for-expenses/customers.go +++ b/sync-for-expenses/customers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Customers +// Customers - Get, create, and update customers. type Customers struct { sdkConfiguration sdkConfiguration } @@ -48,6 +49,7 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -55,6 +57,7 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/customers", request, nil) if err != nil { @@ -66,6 +69,17 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -85,10 +99,11 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -96,33 +111,60 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -131,15 +173,19 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -149,17 +195,25 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateCustomerResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -167,6 +221,11 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome res.CreateCustomerResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -186,6 +245,11 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -193,17 +257,33 @@ func (s *Customers) Create(ctx context.Context, request operations.CreateCustome return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Get customer @@ -225,6 +305,7 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -232,12 +313,24 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/customers/{customerId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -252,10 +345,11 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -263,33 +357,60 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -298,15 +419,19 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "409", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -316,17 +441,25 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Customer if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -334,6 +467,11 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque res.Customer = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -353,6 +491,11 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -360,17 +503,33 @@ func (s *Customers) Get(ctx context.Context, request operations.GetCustomerReque return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List customers @@ -390,6 +549,7 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -397,12 +557,24 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/customers", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -421,10 +593,11 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -432,33 +605,60 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -467,15 +667,19 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "409", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -485,17 +689,25 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Customers if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -503,6 +715,11 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe res.Customers = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -524,6 +741,11 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -531,17 +753,33 @@ func (s *Customers) List(ctx context.Context, request operations.ListCustomersRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Update customer @@ -565,6 +803,7 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -572,6 +811,7 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/customers/{customerId}", request, nil) if err != nil { @@ -583,6 +823,17 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -602,10 +853,11 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -613,33 +865,60 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -648,15 +927,19 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -666,17 +949,25 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.UpdateCustomerResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -684,6 +975,11 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome res.UpdateCustomerResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -703,6 +999,11 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -710,15 +1011,31 @@ func (s *Customers) Update(ctx context.Context, request operations.UpdateCustome return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionrequest.md b/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionrequest.md new file mode 100644 index 000000000..d4c32d742 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionrequest.md @@ -0,0 +1,9 @@ +# CreateAdjustmentTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `RequestBody` | [][shared.AdjustmentTransactionRequest](../../../pkg/models/shared/adjustmenttransactionrequest.md) | :heavy_minus_sign: | N/A | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionresponse.md b/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionresponse.md new file mode 100644 index 000000000..6dd097157 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/createadjustmenttransactionresponse.md @@ -0,0 +1,11 @@ +# CreateAdjustmentTransactionResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `AdjustmentTransactionResponse` | [*shared.AdjustmentTransactionResponse](../../../pkg/models/shared/adjustmenttransactionresponse.md) | :heavy_minus_sign: | OK | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createbankaccountrequest.md b/sync-for-expenses/docs/pkg/models/operations/createbankaccountrequest.md new file mode 100644 index 000000000..4db774742 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/createbankaccountrequest.md @@ -0,0 +1,12 @@ +# CreateBankAccountRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `BankAccount` | [*shared.BankAccount](../../../pkg/models/shared/bankaccount.md) | :heavy_minus_sign: | N/A | | +| `AllowSyncOnPushComplete` | **bool* | :heavy_minus_sign: | Allow a sync upon push completion. | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `TimeoutInMinutes` | **int* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createbankaccountresponse.md b/sync-for-expenses/docs/pkg/models/operations/createbankaccountresponse.md new file mode 100644 index 000000000..a17aa195b --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/createbankaccountresponse.md @@ -0,0 +1,11 @@ +# CreateBankAccountResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `CreateBankAccountResponse` | [*shared.CreateBankAccountResponse](../../../pkg/models/shared/createbankaccountresponse.md) | :heavy_minus_sign: | Success | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createcompanyresponse.md b/sync-for-expenses/docs/pkg/models/operations/createcompanyresponse.md index f9192e76a..134636626 100644 --- a/sync-for-expenses/docs/pkg/models/operations/createcompanyresponse.md +++ b/sync-for-expenses/docs/pkg/models/operations/createcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createexpensetransactionrequest.md b/sync-for-expenses/docs/pkg/models/operations/createexpensetransactionrequest.md index 909f046d7..9d651357f 100644 --- a/sync-for-expenses/docs/pkg/models/operations/createexpensetransactionrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/createexpensetransactionrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `CreateExpenseRequest` | [*shared.CreateExpenseRequest](../../../pkg/models/shared/createexpenserequest.md) | :heavy_minus_sign: | N/A | | -| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `RequestBody` | [][shared.ExpenseTransaction](../../../pkg/models/shared/expensetransaction.md) | :heavy_minus_sign: | N/A | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md b/sync-for-expenses/docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md index 9181bdb7d..4feae2b8a 100644 --- a/sync-for-expenses/docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/createreimbursableexpensetransactionrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `CreateReimbursableExpenseRequest` | [*shared.CreateReimbursableExpenseRequest](../../../pkg/models/shared/createreimbursableexpenserequest.md) | :heavy_minus_sign: | N/A | | -| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `RequestBody` | [][shared.ReimbursableExpenseTransaction](../../../pkg/models/shared/reimbursableexpensetransaction.md) | :heavy_minus_sign: | N/A | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionrequest.md b/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionrequest.md index 8bd0da451..92f50635b 100644 --- a/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `CreateTransferRequest` | [*shared.CreateTransferRequest](../../../pkg/models/shared/createtransferrequest.md) | :heavy_minus_sign: | N/A | | -| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `TransactionID` | *string* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `TransferTransactionRequest` | [*shared.TransferTransactionRequest](../../../pkg/models/shared/transfertransactionrequest.md) | :heavy_minus_sign: | N/A | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `TransactionID` | *string* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionresponse.md b/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionresponse.md index 3901074d4..0ba0800e2 100644 --- a/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionresponse.md +++ b/sync-for-expenses/docs/pkg/models/operations/createtransfertransactionresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `CreateTransferResponse` | [*shared.CreateTransferResponse](../../../pkg/models/shared/createtransferresponse.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `TransferTransactionResponse` | [*shared.TransferTransactionResponse](../../../pkg/models/shared/transfertransactionresponse.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/getcompanyresponse.md b/sync-for-expenses/docs/pkg/models/operations/getcompanyresponse.md index 0a2b5ef0b..8bc3efda8 100644 --- a/sync-for-expenses/docs/pkg/models/operations/getcompanyresponse.md +++ b/sync-for-expenses/docs/pkg/models/operations/getcompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelrequest.md b/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelrequest.md new file mode 100644 index 000000000..60158548e --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelrequest.md @@ -0,0 +1,9 @@ +# GetCreateBankAccountsModelRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelresponse.md b/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelresponse.md new file mode 100644 index 000000000..80ccff7dd --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/getcreatebankaccountsmodelresponse.md @@ -0,0 +1,11 @@ +# GetCreateBankAccountsModelResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `PushOption` | [*shared.PushOption](../../../pkg/models/shared/pushoption.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/getdatastatusdatastatuses.md b/sync-for-expenses/docs/pkg/models/operations/getdatastatusdatastatuses.md new file mode 100644 index 000000000..9b20b4637 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/operations/getdatastatusdatastatuses.md @@ -0,0 +1,52 @@ +# GetDataStatusDataStatuses + +OK + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BalanceSheet` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingAccountBalances` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingTransactionCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BankingTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BillCreditNotes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `BillPayments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Bills` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CashFlowStatement` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ChartOfAccounts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceCompanyInfo` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceCustomers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceDisputes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceLocations` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommercePaymentMethods` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommercePayments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceProductCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceProducts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceTaxComponents` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CommerceTransactions` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Company` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `CreditNotes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Customers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `DirectCosts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `DirectIncomes` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Invoices` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ItemReceipts` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Items` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `JournalEntries` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Journals` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `PaymentMethods` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Payments` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `ProfitAndLoss` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `PurchaseOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `SalesOrders` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Suppliers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `TaxRates` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `TrackingCategories` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | +| `Transfers` | [*shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | Describes the state of data in the Codat cache for a company and data type | {
"dataType": "string",
"lastSuccessfulSync": "2022-01-01T13:00:00.000Z",
"currentStatus": "string",
"latestSyncId": "ad474a37-2003-478e-baee-9af9f1ec2fe3",
"latestSuccessfulSyncId": "8220fc90-55b6-47bc-9417-48ac6ea93101"
} | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/getdatastatusresponse.md b/sync-for-expenses/docs/pkg/models/operations/getdatastatusresponse.md index 28fc68ffa..9416981a4 100644 --- a/sync-for-expenses/docs/pkg/models/operations/getdatastatusresponse.md +++ b/sync-for-expenses/docs/pkg/models/operations/getdatastatusresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `DataStatuses` | map[string][shared.DataStatus](../../../pkg/models/shared/datastatus.md) | :heavy_minus_sign: | OK | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `DataStatuses` | [*operations.GetDataStatusDataStatuses](../../../pkg/models/operations/getdatastatusdatastatuses.md) | :heavy_minus_sign: | OK | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/initiatesyncrequest.md b/sync-for-expenses/docs/pkg/models/operations/initiatesyncrequest.md deleted file mode 100644 index 8247076fe..000000000 --- a/sync-for-expenses/docs/pkg/models/operations/initiatesyncrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# InitiateSyncRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `InitiateSync` | [*shared.InitiateSync](../../../pkg/models/shared/initiatesync.md) | :heavy_minus_sign: | N/A | | -| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/initiatesyncresponse.md b/sync-for-expenses/docs/pkg/models/operations/initiatesyncresponse.md deleted file mode 100644 index f45f061e6..000000000 --- a/sync-for-expenses/docs/pkg/models/operations/initiatesyncresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# InitiateSyncResponse - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `SyncInitiated` | [*shared.SyncInitiated](../../../pkg/models/shared/syncinitiated.md) | :heavy_minus_sign: | Returns the newly created syncId | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listcompaniesrequest.md b/sync-for-expenses/docs/pkg/models/operations/listcompaniesrequest.md index ee176cc37..cccb983e3 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listcompaniesrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listcompaniesrequest.md @@ -8,4 +8,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listconnectionsrequest.md b/sync-for-expenses/docs/pkg/models/operations/listconnectionsrequest.md index df5ebd3fc..c28099519 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listconnectionsrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listconnectionsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listcustomersrequest.md b/sync-for-expenses/docs/pkg/models/operations/listcustomersrequest.md index 758223d57..e59f11abd 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listcustomersrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listcustomersrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listpulloperationsrequest.md b/sync-for-expenses/docs/pkg/models/operations/listpulloperationsrequest.md index 6c5f80bfc..bfea8f9b6 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listpulloperationsrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listpulloperationsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listpushoperationsrequest.md b/sync-for-expenses/docs/pkg/models/operations/listpushoperationsrequest.md index bfd4ea0f6..faba95832 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listpushoperationsrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listpushoperationsrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/listsuppliersrequest.md b/sync-for-expenses/docs/pkg/models/operations/listsuppliersrequest.md index e95a0715a..0948e64d3 100644 --- a/sync-for-expenses/docs/pkg/models/operations/listsuppliersrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/listsuppliersrequest.md @@ -9,4 +9,4 @@ | `OrderBy` | **string* | :heavy_minus_sign: | Field to order results by. [Read more](https://docs.codat.io/using-the-api/ordering-results). | -modifiedDate | | `Page` | **int* | :heavy_minus_sign: | Page number. [Read more](https://docs.codat.io/using-the-api/paging). | 1 | | `PageSize` | **int* | :heavy_minus_sign: | Number of records to return in a page. [Read more](https://docs.codat.io/using-the-api/paging). | 100 | -| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | | \ No newline at end of file +| `Query` | **string* | :heavy_minus_sign: | Codat query string. [Read more](https://docs.codat.io/using-the-api/querying). | id=e3334455-1aed-4e71-ab43-6bccf12092ee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/option.md b/sync-for-expenses/docs/pkg/models/operations/option.md index 9167702bf..35d8a1e2a 100644 --- a/sync-for-expenses/docs/pkg/models/operations/option.md +++ b/sync-for-expenses/docs/pkg/models/operations/option.md @@ -24,9 +24,9 @@ operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{ WithRetries allows customizing the default retry configuration. Only usable with methods that mention they support retries. ```go -operations.WithRetries(utils.RetryConfig{ +operations.WithRetries(retry.Config{ Strategy: "backoff", - Backoff: utils.BackoffStrategy{ + Backoff: retry.BackoffStrategy{ InitialInterval: 500 * time.Millisecond, MaxInterval: 60 * time.Second, Exponent: 1.5, diff --git a/sync-for-expenses/docs/pkg/models/operations/updatecompanyresponse.md b/sync-for-expenses/docs/pkg/models/operations/updatecompanyresponse.md index 2aad7f4a0..30b2e9856 100644 --- a/sync-for-expenses/docs/pkg/models/operations/updatecompanyresponse.md +++ b/sync-for-expenses/docs/pkg/models/operations/updatecompanyresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"platform": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
],
"groups": [
{
"id": "d7a6c4b4-dc87-45f6-b803-62f466398680"
}
]
} | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Company` | [*shared.Company](../../../pkg/models/shared/company.md) | :heavy_minus_sign: | OK | {
"id": "0498e921-9b53-4396-a412-4f2f5983b0a2",
"name": "string",
"redirect": "https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739",
"lastSync": "2022-01-01T12:00:00.000Z",
"created": "2022-01-01T12:00:00.000Z",
"createdByUserName": "string",
"tags": {
"region": "us",
"uid": "f6b0c253-16c7-4da1-a0c5-9c871e9c9d6c"
},
"dataConnections": [
{
"id": "ee2eb431-c0fa-4dc9-93fa-d29781c12bcd",
"integrationId": "bf083d72-62c7-493e-aec9-81b4dbba7e2c",
"integrationKey": "dfxm",
"sourceId": "bdd831ce-eebd-4896-89a7-20e5ee8989ee",
"platformName": "Basiq",
"linkUrl": "https://link-api.codat.io/companies/86bd88cb-44ab-4dfb-b32f-87b19b14287f/connections/ee2eb431-c0fa-4dc9-93fa-d29781c12bcd/start",
"status": "Linked",
"lastSync": "2022-10-27T10:22:43.6464237Z",
"created": "2022-10-27T09:53:29Z",
"sourceType": "Banking"
}
]
} | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/updatecustomerrequest.md b/sync-for-expenses/docs/pkg/models/operations/updatecustomerrequest.md index fd5cd67fb..abc8d0234 100644 --- a/sync-for-expenses/docs/pkg/models/operations/updatecustomerrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/updatecustomerrequest.md @@ -10,5 +10,5 @@ | `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | | `CustomerID` | *string* | :heavy_check_mark: | Unique identifier for a customer. | | -| `ForceUpdate` | **bool* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | | +| `ForceUpdate` | **bool* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting software, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | | | `TimeoutInMinutes` | **int* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/updatereimbursableexpensetransactionrequest.md b/sync-for-expenses/docs/pkg/models/operations/updatereimbursableexpensetransactionrequest.md index 6e0382479..9e94b9b64 100644 --- a/sync-for-expenses/docs/pkg/models/operations/updatereimbursableexpensetransactionrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/updatereimbursableexpensetransactionrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `CreateReimbursableExpenseRequest` | [*shared.CreateReimbursableExpenseRequest](../../../pkg/models/shared/createreimbursableexpenserequest.md) | :heavy_minus_sign: | N/A | | -| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `TransactionID` | *string* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `UpdateReimbursableExpenseTransactionRequest` | [*shared.UpdateReimbursableExpenseTransactionRequest](../../../pkg/models/shared/updatereimbursableexpensetransactionrequest.md) | :heavy_minus_sign: | N/A | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `TransactionID` | *string* | :heavy_check_mark: | The unique identifier for your SMB's transaction. | 336694d8-2dca-4cb5-a28d-3ccb83e55eee | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/operations/updatesupplierrequest.md b/sync-for-expenses/docs/pkg/models/operations/updatesupplierrequest.md index 88bd7e61a..42c64f285 100644 --- a/sync-for-expenses/docs/pkg/models/operations/updatesupplierrequest.md +++ b/sync-for-expenses/docs/pkg/models/operations/updatesupplierrequest.md @@ -9,6 +9,6 @@ | `AllowSyncOnPushComplete` | **bool* | :heavy_minus_sign: | Allow a sync upon push completion. | | | `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for a company. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier for a connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | -| `ForceUpdate` | **bool* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | | +| `ForceUpdate` | **bool* | :heavy_minus_sign: | When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting software, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. | | | `SupplierID` | *string* | :heavy_check_mark: | Unique identifier for a supplier. | 13d946f0-c5d5-42bc-b092-97ece17923ab | | `TimeoutInMinutes` | **int* | :heavy_minus_sign: | Time limit for the push operation to complete before it is timed out. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountingaccount.md b/sync-for-expenses/docs/pkg/models/shared/accountingaccount.md index f4ef94310..3d598aa43 100644 --- a/sync-for-expenses/docs/pkg/models/shared/accountingaccount.md +++ b/sync-for-expenses/docs/pkg/models/shared/accountingaccount.md @@ -49,6 +49,6 @@ To determine the list of allowed categories for a specific integration, you can: | `NominalCode` | **string* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [*shared.AccountStatus](../../../pkg/models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the account | Active | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `Type` | [*shared.AccountType](../../../pkg/models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | | `ValidDatatypeLinks` | [][shared.CreateAccountResponseValidDataTypeLinks](../../../pkg/models/shared/createaccountresponsevaliddatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/sync-for-expenses-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountingbankaccount.md b/sync-for-expenses/docs/pkg/models/shared/accountingbankaccount.md new file mode 100644 index 000000000..6b2f07db9 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/accountingbankaccount.md @@ -0,0 +1,43 @@ +# ~~AccountingBankAccount~~ + +> **Accessing Bank Accounts through Banking API** +> +> This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. +> +> To view bank account data through the Banking API, please refer to the new datatype [here](https://docs.codat.io/sync-for-expenses-api#/schemas/Account) + +> View the coverage for bank accounts in the Data coverage explorer. + +## Overview + +A list of bank accounts associated with a company and a specific data connection. + +Bank accounts data includes: +* The name and ID of the account in the accounting software. +* The currency and balance of the account. +* The sort code and account number. + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountName` | **string* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | +| `AccountNumber` | **string* | :heavy_minus_sign: | Account number for the bank account.

Xero integrations
Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | +| `AccountType` | [*shared.CreateBankAccountResponseBankAccountType](../../../pkg/models/shared/createbankaccountresponsebankaccounttype.md) | :heavy_minus_sign: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | +| `AvailableBalance` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | +| `Balance` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Balance of the bank account. | | +| `Currency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `IBan` | **string* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | | +| `Institution` | **string* | :heavy_minus_sign: | The institution of the bank account. | | +| `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | +| `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `NominalCode` | **string* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `OverdraftLimit` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | +| `SortCode` | **string* | :heavy_minus_sign: | Sort code for the bank account.

Xero integrations
The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [*shared.BankAccountStatus](../../../pkg/models/shared/bankaccountstatus.md) | :heavy_minus_sign: | Status of the bank account. | Active | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountingcustomer.md b/sync-for-expenses/docs/pkg/models/shared/accountingcustomer.md index 6c7d98374..4ca29050f 100644 --- a/sync-for-expenses/docs/pkg/models/shared/accountingcustomer.md +++ b/sync-for-expenses/docs/pkg/models/shared/accountingcustomer.md @@ -22,12 +22,12 @@ Customers' data links to accounts receivable [invoices](https://docs.codat.io/sy | `CustomerName` | **string* | :heavy_minus_sign: | Name of the customer as recorded in the accounting system, typically the company name. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address the customer can be contacted by. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number the customer can be contacted by. | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number. In the UK, this is typically the Companies House company registration number. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.CustomerStatus](../../../pkg/models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountingsupplier.md b/sync-for-expenses/docs/pkg/models/shared/accountingsupplier.md index 2f5e71bdc..40d59ef11 100644 --- a/sync-for-expenses/docs/pkg/models/shared/accountingsupplier.md +++ b/sync-for-expenses/docs/pkg/models/shared/accountingsupplier.md @@ -17,13 +17,13 @@ From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers | `ContactName` | **string* | :heavy_minus_sign: | Name of the main contact for the supplier. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +44 25691 154789 | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.SupplierStatus](../../../pkg/models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `SupplierName` | **string* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Supplier's company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountmappinginfo.md b/sync-for-expenses/docs/pkg/models/shared/accountmappinginfo.md index f9761ee76..e366cb0bc 100644 --- a/sync-for-expenses/docs/pkg/models/shared/accountmappinginfo.md +++ b/sync-for-expenses/docs/pkg/models/shared/accountmappinginfo.md @@ -7,6 +7,9 @@ | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `AccountType` | [*shared.AccountMappingInfoAccountType](../../../pkg/models/shared/accountmappinginfoaccounttype.md) | :heavy_minus_sign: | Type of the account. | Expense | | `Currency` | **string* | :heavy_minus_sign: | Currency of the account. | GBP | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier of account. | 6 | -| `Name` | **string* | :heavy_minus_sign: | Name of the account as it appears in the companies accounting software. | Purchases | +| `FullyQualifiedCategory` | **string* | :heavy_minus_sign: | Full account type and category of the account | Expense.DirectCosts | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of account. | 127f3b99-8dc2-4b7e-854c-91ef9bd2757b | +| `IsBankAccount` | **bool* | :heavy_minus_sign: | Confirms whether the account is a bank account or not. | | +| `Name` | **string* | :heavy_minus_sign: | Name of the account as it appears in the company's accounting software. | Purchases | +| `NominalCode` | **string* | :heavy_minus_sign: | Code used to identify each nominal account in the accounting software. | 300 | | `ValidTransactionTypes` | [][shared.ValidTransactionTypes](../../../pkg/models/shared/validtransactiontypes.md) | :heavy_minus_sign: | Supported transaction types for the account. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountprototype.md b/sync-for-expenses/docs/pkg/models/shared/accountprototype.md index 30b0cea01..0879ee391 100644 --- a/sync-for-expenses/docs/pkg/models/shared/accountprototype.md +++ b/sync-for-expenses/docs/pkg/models/shared/accountprototype.md @@ -14,6 +14,6 @@ | `Name` | **string* | :heavy_minus_sign: | Name of the account. | Accounts Receivable | | `NominalCode` | **string* | :heavy_minus_sign: | Reference given to each nominal account for a business. It ensures money is allocated to the correct account. This code isn't a unique identifier in the Codat system. | 610 | | `Status` | [*shared.AccountStatus](../../../pkg/models/shared/accountstatus.md) | :heavy_minus_sign: | Status of the account | Active | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `Type` | [*shared.AccountType](../../../pkg/models/shared/accounttype.md) | :heavy_minus_sign: | Type of account | Asset | | `ValidDatatypeLinks` | [][shared.ValidDataTypeLinks](../../../pkg/models/shared/validdatatypelinks.md) | :heavy_minus_sign: | The validDatatypeLinks can be used to determine whether an account can be correctly mapped to another object; for example, accounts with a `type` of `income` might only support being used on an Invoice and Direct Income. For more information, see [Valid Data Type Links](/sync-for-expenses-api#/schemas/ValidDataTypeLinks). | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountref.md b/sync-for-expenses/docs/pkg/models/shared/accountref.md deleted file mode 100644 index affa6910f..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/accountref.md +++ /dev/null @@ -1,11 +0,0 @@ -# AccountRef - -Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `ID` | **string* | :heavy_minus_sign: | 'id' from the Accounts data type. | -| `Name` | **string* | :heavy_minus_sign: | 'name' from the Accounts data type. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/accountreference.md b/sync-for-expenses/docs/pkg/models/shared/accountreference.md new file mode 100644 index 000000000..c82c2632a --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/accountreference.md @@ -0,0 +1,10 @@ +# AccountReference + +Reference of the account you are transferring money from. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `ID` | *string* | :heavy_check_mark: | 'id' from the Accounts data type. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionline.md b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionline.md new file mode 100644 index 000000000..4aa37659b --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionline.md @@ -0,0 +1,12 @@ +# AdjustmentTransactionLine + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountRef` | [shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_check_mark: | N/A | | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the line. A positive line represents a debit; a negative line represents a credit. | 50 | +| `Description` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `InvoiceTo` | [*shared.InvoiceTo](../../../pkg/models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. | | +| `TrackingRefs` | [][shared.TrackingRefAdjustmentTransaction](../../../pkg/models/shared/trackingrefadjustmenttransaction.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionrequest.md b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionrequest.md new file mode 100644 index 000000000..e859b8253 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionrequest.md @@ -0,0 +1,13 @@ +# AdjustmentTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | | +| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `Date` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `ID` | *string* | :heavy_check_mark: | Your unique identifier for the transaction. | | +| `Lines` | [][shared.AdjustmentTransactionLine](../../../pkg/models/shared/adjustmenttransactionline.md) | :heavy_check_mark: | Array of transaction lines. | | +| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the adjustment transaction. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/groupitems.md b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionresponse.md similarity index 74% rename from sync-for-expenses/docs/pkg/models/shared/groupitems.md rename to sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionresponse.md index ba6f96d9b..2f25f4ea6 100644 --- a/sync-for-expenses/docs/pkg/models/shared/groupitems.md +++ b/sync-for-expenses/docs/pkg/models/shared/adjustmenttransactionresponse.md @@ -1,8 +1,8 @@ -# GroupItems +# AdjustmentTransactionResponse ## Fields | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the group. | 60d2fa12-8a04-11ee-b9d1-0242ac120002 | \ No newline at end of file +| `SyncID` | **string* | :heavy_minus_sign: | Unique id of sync created | cd937d46-8e41-43a9-9477-a79158ffd98a | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/bankaccount.md b/sync-for-expenses/docs/pkg/models/shared/bankaccount.md index 26103f6af..42e9704d6 100644 --- a/sync-for-expenses/docs/pkg/models/shared/bankaccount.md +++ b/sync-for-expenses/docs/pkg/models/shared/bankaccount.md @@ -1,8 +1,41 @@ # BankAccount +> **Accessing Bank Accounts through Banking API** +> +> This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. +> +> To view bank account data through the Banking API, please refer to the new datatype [here](https://docs.codat.io/sync-for-expenses-api#/schemas/Account) + +> View the coverage for bank accounts in the Data coverage explorer. + +## Overview + +A list of bank accounts associated with a company and a specific data connection. + +Bank accounts data includes: +* The name and ID of the account in the accounting software. +* The currency and balance of the account. +* The sort code and account number. + ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `ID` | **string* | :heavy_minus_sign: | The id of the account from which purchases are made | 32 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountName` | **string* | :heavy_minus_sign: | Name of the bank account in the accounting software. | | +| `AccountNumber` | **string* | :heavy_minus_sign: | Account number for the bank account.

Xero integrations
Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated.

FreeAgent integrations
For Credit accounts, only the last four digits are required. For other types, the field is optional. | | +| `AccountType` | [*shared.BankAccountType](../../../pkg/models/shared/bankaccounttype.md) | :heavy_minus_sign: | The type of transactions and balances on the account.
For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities.
For Debit accounts, positive balances are assets, and positive transactions **increase** assets. | | +| `AvailableBalance` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. | | +| `Balance` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Balance of the bank account. | | +| `Currency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | +| `IBan` | **string* | :heavy_minus_sign: | International bank account number of the account. Often used when making or receiving international payments. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the account, unique for the company in the accounting software. | | +| `Institution` | **string* | :heavy_minus_sign: | The institution of the bank account. | | +| `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | +| `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `NominalCode` | **string* | :heavy_minus_sign: | Code used to identify each nominal account for a business. | | +| `OverdraftLimit` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Pre-arranged overdraft limit of the account.

The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. | | +| `SortCode` | **string* | :heavy_minus_sign: | Sort code for the bank account.

Xero integrations
The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. | | +| `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [*shared.BankAccountStatus](../../../pkg/models/shared/bankaccountstatus.md) | :heavy_minus_sign: | Status of the bank account. | Active | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/bankaccountdetails.md b/sync-for-expenses/docs/pkg/models/shared/bankaccountdetails.md new file mode 100644 index 000000000..393c2d396 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/bankaccountdetails.md @@ -0,0 +1,8 @@ +# BankAccountDetails + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | The id of the account from which purchases are made | 32 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/bankaccountstatus.md b/sync-for-expenses/docs/pkg/models/shared/bankaccountstatus.md new file mode 100644 index 000000000..40d8b757e --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/bankaccountstatus.md @@ -0,0 +1,13 @@ +# BankAccountStatus + +Status of the bank account. + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `BankAccountStatusUnknown` | Unknown | +| `BankAccountStatusActive` | Active | +| `BankAccountStatusArchived` | Archived | +| `BankAccountStatusPending` | Pending | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/bankaccounttype.md b/sync-for-expenses/docs/pkg/models/shared/bankaccounttype.md new file mode 100644 index 000000000..5a1ed85a0 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/bankaccounttype.md @@ -0,0 +1,14 @@ +# BankAccountType + +The type of transactions and balances on the account. +For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + + +## Values + +| Name | Value | +| ------------------------ | ------------------------ | +| `BankAccountTypeUnknown` | Unknown | +| `BankAccountTypeCredit` | Credit | +| `BankAccountTypeDebit` | Debit | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhook.md b/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhook.md new file mode 100644 index 000000000..99c7948dd --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhook.md @@ -0,0 +1,11 @@ +# ClientRateLimitWebhook + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `EventType` | **string* | :heavy_minus_sign: | The type of event. | client.rateLimit.reset | +| `GeneratedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the event. | 743ec94a-8aa4-44bb-8bd4-e1855ee0e74b | +| `Payload` | [*shared.ClientRateLimitWebhookPayload](../../../pkg/models/shared/clientratelimitwebhookpayload.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhookpayload.md b/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhookpayload.md new file mode 100644 index 000000000..1688f2650 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/clientratelimitwebhookpayload.md @@ -0,0 +1,10 @@ +# ClientRateLimitWebhookPayload + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DailyQuota` | **int64* | :heavy_minus_sign: | The number of available requests per day. | | +| `ExpiryDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `QuotaRemaining` | **int64* | :heavy_minus_sign: | Total number of requests remaining for your client. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/codatfile.md b/sync-for-expenses/docs/pkg/models/shared/codatfile.md index 0f76ad4e2..27ca6f0e2 100644 --- a/sync-for-expenses/docs/pkg/models/shared/codatfile.md +++ b/sync-for-expenses/docs/pkg/models/shared/codatfile.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `Content` | *[]byte* | :heavy_check_mark: | N/A | +| `Content` | *any* | :heavy_check_mark: | N/A | | `FileName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/company.md b/sync-for-expenses/docs/pkg/models/shared/company.md index 3d7d485f3..8284a74bf 100644 --- a/sync-for-expenses/docs/pkg/models/shared/company.md +++ b/sync-for-expenses/docs/pkg/models/shared/company.md @@ -15,9 +15,8 @@ When you create a company, you can specify a `name` and we will automatically ge | `CreatedByUserName` | **string* | :heavy_minus_sign: | Name of user that created the company in Codat. | | | `DataConnections` | [][shared.Connection](../../../pkg/models/shared/connection.md) | :heavy_minus_sign: | N/A | | | `Description` | **string* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | -| `Groups` | [][shared.GroupReference](../../../pkg/models/shared/groupreference.md) | :heavy_minus_sign: | An array of groups the company has been assigned to. | | | `ID` | *string* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | | `LastSync` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `Name` | *string* | :heavy_check_mark: | The name of the company | Codat Ltd. | -| ~~`Platform`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

`platformKeys` name used when creating the company. | Xero | -| `Redirect` | *string* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | \ No newline at end of file +| `Redirect` | *string* | :heavy_check_mark: | The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. | https://link.codat.io/company/27628208-459c-46a2-a705-5641ce25f739 | +| `Tags` | [*shared.Tags](../../../pkg/models/shared/tags.md) | :heavy_minus_sign: | A collection of user-defined key-value pairs that store custom metadata against the company. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/companyconfiguration.md b/sync-for-expenses/docs/pkg/models/shared/companyconfiguration.md index eeae01004..3ee1f7242 100644 --- a/sync-for-expenses/docs/pkg/models/shared/companyconfiguration.md +++ b/sync-for-expenses/docs/pkg/models/shared/companyconfiguration.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `BankAccount` | [shared.BankAccount](../../../pkg/models/shared/bankaccount.md) | :heavy_check_mark: | N/A | -| `Customer` | [shared.CustomerDetails](../../../pkg/models/shared/customerdetails.md) | :heavy_check_mark: | N/A | -| `Supplier` | [shared.SupplierDetails](../../../pkg/models/shared/supplierdetails.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `BankAccount` | [shared.BankAccountDetails](../../../pkg/models/shared/bankaccountdetails.md) | :heavy_check_mark: | N/A | +| `Customer` | [shared.CustomerDetails](../../../pkg/models/shared/customerdetails.md) | :heavy_check_mark: | N/A | +| `Supplier` | [shared.SupplierDetails](../../../pkg/models/shared/supplierdetails.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/companyrequestbody.md b/sync-for-expenses/docs/pkg/models/shared/companyrequestbody.md index 088e413d3..0b7b5533c 100644 --- a/sync-for-expenses/docs/pkg/models/shared/companyrequestbody.md +++ b/sync-for-expenses/docs/pkg/models/shared/companyrequestbody.md @@ -6,5 +6,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | `Description` | **string* | :heavy_minus_sign: | Additional information about the company. This can be used to store foreign IDs, references, etc. | Requested early access to the new financing scheme. | -| `Groups` | [][shared.GroupItems](../../../pkg/models/shared/groupitems.md) | :heavy_minus_sign: | Reference to the groups that the company is assigned to. | | +| `Groups` | [][shared.GroupReference](../../../pkg/models/shared/groupreference.md) | :heavy_minus_sign: | Reference to the groups that the company is assigned to. | | | `Name` | *string* | :heavy_check_mark: | Name of company being connected. | Bank of Dave | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/companysyncstatus.md b/sync-for-expenses/docs/pkg/models/shared/companysyncstatus.md index 4b49df3a9..41275f9ea 100644 --- a/sync-for-expenses/docs/pkg/models/shared/companysyncstatus.md +++ b/sync-for-expenses/docs/pkg/models/shared/companysyncstatus.md @@ -10,6 +10,6 @@ | `ErrorMessage` | **string* | :heavy_minus_sign: | Error message of the sync. | | | `SyncExceptionMessage` | **string* | :heavy_minus_sign: | Exception message of the sync. | | | `SyncID` | **string* | :heavy_minus_sign: | Unique identifier of the sync. | a6a22aff-a43a-411d-a910-2dae73217cce | -| `SyncStatus` | **string* | :heavy_minus_sign: | Text status of the sync. | Completed | +| `SyncStatus` | **string* | :heavy_minus_sign: | Text status of the sync. | Complete | | `SyncStatusCode` | **int* | :heavy_minus_sign: | Status code of the sync. | 2000 | | `SyncUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/connection.md b/sync-for-expenses/docs/pkg/models/shared/connection.md index 5cfc73be2..d55a41ffe 100644 --- a/sync-for-expenses/docs/pkg/models/shared/connection.md +++ b/sync-for-expenses/docs/pkg/models/shared/connection.md @@ -16,7 +16,7 @@ Before you can use a data connection to pull or push data, the company must gran | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AdditionalProperties` | *interface{}* | :heavy_minus_sign: | N/A | | +| `AdditionalProperties` | *any* | :heavy_minus_sign: | N/A | | | `ConnectionInfo` | map[string]*string* | :heavy_minus_sign: | N/A | | | `Created` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `DataConnectionErrors` | [][shared.DataConnectionError](../../../pkg/models/shared/dataconnectionerror.md) | :heavy_minus_sign: | N/A | | diff --git a/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponse.md b/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponse.md new file mode 100644 index 000000000..6a65587f1 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponse.md @@ -0,0 +1,21 @@ +# CreateBankAccountResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Changes` | [][shared.PushOperationChange](../../../pkg/models/shared/pushoperationchange.md) | :heavy_minus_sign: | Contains a single entry that communicates which record has changed and the manner in which it changed. | | +| `CompanyID` | *string* | :heavy_check_mark: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | +| `CompletedOnUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Data` | [*shared.AccountingBankAccount](../../../pkg/models/shared/accountingbankaccount.md) | :heavy_minus_sign: | N/A | | +| `DataConnectionKey` | *string* | :heavy_check_mark: | Unique identifier for a company's data connection. | 2e9d2c44-f675-40ba-8049-353bfcb5e171 | +| `DataType` | [*shared.DataType](../../../pkg/models/shared/datatype.md) | :heavy_minus_sign: | Available data types | invoices | +| `ErrorMessage` | **string* | :heavy_minus_sign: | A message about the error. | | +| `PushOperationKey` | *string* | :heavy_check_mark: | A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. | | +| `RequestedOnUtc` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [shared.PushOperationStatus](../../../pkg/models/shared/pushoperationstatus.md) | :heavy_check_mark: | The current status of the push operation. | | +| `StatusCode` | *int64* | :heavy_check_mark: | Push status code. | | +| `TimeoutInMinutes` | **int* | :heavy_minus_sign: | Number of minutes the push operation must complete within before it times out. | | +| ~~`TimeoutInSeconds`~~ | **int* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Number of seconds the push operation must complete within before it times out. | | +| `Validation` | [*shared.Validation](../../../pkg/models/shared/validation.md) | :heavy_minus_sign: | A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponsebankaccounttype.md b/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponsebankaccounttype.md new file mode 100644 index 000000000..fab1ba2c4 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/createbankaccountresponsebankaccounttype.md @@ -0,0 +1,14 @@ +# CreateBankAccountResponseBankAccountType + +The type of transactions and balances on the account. +For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + + +## Values + +| Name | Value | +| ------------------------------------------------- | ------------------------------------------------- | +| `CreateBankAccountResponseBankAccountTypeUnknown` | Unknown | +| `CreateBankAccountResponseBankAccountTypeCredit` | Credit | +| `CreateBankAccountResponseBankAccountTypeDebit` | Debit | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createexpenserequest.md b/sync-for-expenses/docs/pkg/models/shared/createexpenserequest.md deleted file mode 100644 index ed682bac5..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/createexpenserequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# CreateExpenseRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `Items` | [][shared.ExpenseTransaction](../../../pkg/models/shared/expensetransaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createexpenseresponse.md b/sync-for-expenses/docs/pkg/models/shared/createexpenseresponse.md index e746ac696..e250b1c31 100644 --- a/sync-for-expenses/docs/pkg/models/shared/createexpenseresponse.md +++ b/sync-for-expenses/docs/pkg/models/shared/createexpenseresponse.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `DatasetID` | **string* | :heavy_minus_sign: | Unique id of dataset created | cd937d46-8e41-43a9-9477-a79158ffd98a | \ No newline at end of file +| `SyncID` | **string* | :heavy_minus_sign: | Unique id of sync created | cd937d46-8e41-43a9-9477-a79158ffd98a | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createreimbursableexpenserequest.md b/sync-for-expenses/docs/pkg/models/shared/createreimbursableexpenserequest.md deleted file mode 100644 index f4af70359..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/createreimbursableexpenserequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# CreateReimbursableExpenseRequest - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| `Items` | [][][shared.ReimbursableExpenseTransaction](../../../pkg/models/shared/reimbursableexpensetransaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createtransferrequest.md b/sync-for-expenses/docs/pkg/models/shared/createtransferrequest.md deleted file mode 100644 index 30b6ee2d2..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/createtransferrequest.md +++ /dev/null @@ -1,11 +0,0 @@ -# CreateTransferRequest - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `Date` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | -| `Description` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | -| `From` | [*shared.TransferDetails](../../../pkg/models/shared/transferdetails.md) | :heavy_minus_sign: | N/A | | -| `To` | [*shared.TransferDetails](../../../pkg/models/shared/transferdetails.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/customer.md b/sync-for-expenses/docs/pkg/models/shared/customer.md index 5a33a0f78..a10b0ad9c 100644 --- a/sync-for-expenses/docs/pkg/models/shared/customer.md +++ b/sync-for-expenses/docs/pkg/models/shared/customer.md @@ -20,12 +20,12 @@ Customers' data links to accounts receivable [invoices](https://docs.codat.io/sy | `CustomerName` | **string* | :heavy_minus_sign: | Name of the customer as recorded in the accounting system, typically the company name. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address the customer can be contacted by. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number the customer can be contacted by. | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number. In the UK, this is typically the Companies House company registration number. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.CustomerStatus](../../../pkg/models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/customerdetails.md b/sync-for-expenses/docs/pkg/models/shared/customerdetails.md index 772d7a459..96e52a6ec 100644 --- a/sync-for-expenses/docs/pkg/models/shared/customerdetails.md +++ b/sync-for-expenses/docs/pkg/models/shared/customerdetails.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting platform. | \ No newline at end of file +| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/data.md b/sync-for-expenses/docs/pkg/models/shared/data.md deleted file mode 100644 index 2657cd9ef..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/data.md +++ /dev/null @@ -1,9 +0,0 @@ -# Data - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -------------------------------------- | -| `SyncID` | **string* | :heavy_minus_sign: | Unique identifier for the failed sync. | a9367074-b5c3-42c4-9be4-be129f43577e | -| `SyncType` | **string* | :heavy_minus_sign: | The type of sync being performed. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/dataconnectionerror.md b/sync-for-expenses/docs/pkg/models/shared/dataconnectionerror.md index 350df632c..1d234b89a 100644 --- a/sync-for-expenses/docs/pkg/models/shared/dataconnectionerror.md +++ b/sync-for-expenses/docs/pkg/models/shared/dataconnectionerror.md @@ -5,7 +5,9 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ErrorMessage` | **string* | :heavy_minus_sign: | A brief message about the error. | | +| `ErrorMessage` | **string* | :heavy_minus_sign: | A message about a error returned by Codat. | | | `ErroredOnUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `StatusCode` | **string* | :heavy_minus_sign: | The HTTP status code returned by the error. | | -| `StatusText` | **string* | :heavy_minus_sign: | A non-numeric status code/text. | | \ No newline at end of file +| `ResolvedOnUtc` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Status` | [*shared.ErrorStatus](../../../pkg/models/shared/errorstatus.md) | :heavy_minus_sign: | The current status of a transient error. Null statuses indicate that the error is not transient. | | +| `StatusCode` | **string* | :heavy_minus_sign: | The HTTP status code returned by the source platform when the error occurred. | | +| `StatusText` | **string* | :heavy_minus_sign: | A non-numeric status code/text returned by the source platform when the error occurred. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/datasetstatus.md b/sync-for-expenses/docs/pkg/models/shared/datasetstatus.md new file mode 100644 index 000000000..c9fa2f03b --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/datasetstatus.md @@ -0,0 +1,30 @@ +# DatasetStatus + +The current status of the dataset. + + +## Values + +| Name | Value | +| --------------------------------- | --------------------------------- | +| `DatasetStatusInitial` | Initial | +| `DatasetStatusQueued` | Queued | +| `DatasetStatusFetching` | Fetching | +| `DatasetStatusMapQueued` | MapQueued | +| `DatasetStatusMapping` | Mapping | +| `DatasetStatusComplete` | Complete | +| `DatasetStatusFetchError` | FetchError | +| `DatasetStatusMapError` | MapError | +| `DatasetStatusInternalError` | InternalError | +| `DatasetStatusProcessingQueued` | ProcessingQueued | +| `DatasetStatusProcessing` | Processing | +| `DatasetStatusProcessingError` | ProcessingError | +| `DatasetStatusValidationQueued` | ValidationQueued | +| `DatasetStatusValidating` | Validating | +| `DatasetStatusValidationError` | ValidationError | +| `DatasetStatusAuthError` | AuthError | +| `DatasetStatusCancelled` | Cancelled | +| `DatasetStatusNotSupported` | NotSupported | +| `DatasetStatusRateLimitError` | RateLimitError | +| `DatasetStatusPermissionsError` | PermissionsError | +| `DatasetStatusPrerequisiteNotMet` | PrerequisiteNotMet | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/datastatus.md b/sync-for-expenses/docs/pkg/models/shared/datastatus.md index 3e55d112d..08183a434 100644 --- a/sync-for-expenses/docs/pkg/models/shared/datastatus.md +++ b/sync-for-expenses/docs/pkg/models/shared/datastatus.md @@ -7,7 +7,7 @@ Describes the state of data in the Codat cache for a company and data type | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `CurrentStatus` | *string* | :heavy_check_mark: | The current status of the dataset in Codat's cache. | | +| `CurrentStatus` | [shared.Status](../../../pkg/models/shared/status.md) | :heavy_check_mark: | The current status of the dataset. | | | `DataType` | [shared.DataTypes](../../../pkg/models/shared/datatypes.md) | :heavy_check_mark: | Available data types | invoices | | `LastSuccessfulSync` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `LatestSuccessfulSyncID` | **string* | :heavy_minus_sign: | Unique identifier for the most recent successful sync of data type. | 8220fc90-55b6-47bc-9417-48ac6ea93101 | diff --git a/sync-for-expenses/docs/pkg/models/shared/errorstatus.md b/sync-for-expenses/docs/pkg/models/shared/errorstatus.md new file mode 100644 index 000000000..0164bbe93 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/errorstatus.md @@ -0,0 +1,11 @@ +# ErrorStatus + +The current status of a transient error. Null statuses indicate that the error is not transient. + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `ErrorStatusActive` | Active | +| `ErrorStatusResolved` | Resolved | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/contactref.md b/sync-for-expenses/docs/pkg/models/shared/expensecontactref.md similarity index 86% rename from sync-for-expenses/docs/pkg/models/shared/contactref.md rename to sync-for-expenses/docs/pkg/models/shared/expensecontactref.md index a47b81c76..78b433886 100644 --- a/sync-for-expenses/docs/pkg/models/shared/contactref.md +++ b/sync-for-expenses/docs/pkg/models/shared/expensecontactref.md @@ -1,9 +1,9 @@ -# ContactRef +# ExpenseContactRef ## Fields | Field | Type | Required | Description | Example | | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `ID` | **string* | :heavy_minus_sign: | Identifier of supplier or customer. | 40e3e57c-2322-4898-966c-ca41adfd23fd | +| `ID` | *string* | :heavy_check_mark: | Identifier of supplier or customer. | 40e3e57c-2322-4898-966c-ca41adfd23fd | | `Type` | [*shared.Type](../../../pkg/models/shared/type.md) | :heavy_minus_sign: | The type of contact. | Supplier | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/expensetransaction.md b/sync-for-expenses/docs/pkg/models/shared/expensetransaction.md index 688e29be4..1238994e1 100644 --- a/sync-for-expenses/docs/pkg/models/shared/expensetransaction.md +++ b/sync-for-expenses/docs/pkg/models/shared/expensetransaction.md @@ -3,16 +3,16 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `BankAccountRef` | [*shared.ExpenseTransactionBankAccountReference](../../../pkg/models/shared/expensetransactionbankaccountreference.md) | :heavy_minus_sign: | N/A | | -| `ContactRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | -| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. \| | | -| `ID` | *string* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | -| `IssueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `Lines` | [][shared.ExpenseTransactionLine](../../../pkg/models/shared/expensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | -| `MerchantName` | **string* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | -| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | -| `PostAsDraft` | **bool* | :heavy_minus_sign: | For supported accouting platforms, setting this optional property to true will post the transaction to a drafted state. | | -| `Type` | [shared.ExpenseTransactionType](../../../pkg/models/shared/expensetransactiontype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `BankAccountRef` | [*shared.BankAccountReference](../../../pkg/models/shared/bankaccountreference.md) | :heavy_minus_sign: | N/A | | +| `ContactRef` | [*shared.ExpenseContactRef](../../../pkg/models/shared/expensecontactref.md) | :heavy_minus_sign: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | +| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `ID` | *string* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | +| `IssueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Lines` | [][shared.ExpenseTransactionLine](../../../pkg/models/shared/expensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | +| `MerchantName` | **string* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | +| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `PostAsDraft` | **bool* | :heavy_minus_sign: | This optional property, when set to true, posts the transaction to a drafted state. Note that postAsDraft is only supported in Microsoft Dynamics 365 Business Central. | | +| `Type` | [shared.ExpenseTransactionType](../../../pkg/models/shared/expensetransactiontype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/expensetransactionline.md b/sync-for-expenses/docs/pkg/models/shared/expensetransactionline.md index 40f04d435..a964a66f6 100644 --- a/sync-for-expenses/docs/pkg/models/shared/expensetransactionline.md +++ b/sync-for-expenses/docs/pkg/models/shared/expensetransactionline.md @@ -3,11 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `AccountRef` | [shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_check_mark: | N/A | | -| `InvoiceTo` | [*shared.InvoiceTo](../../../pkg/models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. | | -| `NetAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the line, exclusive of tax. | 110.42 | -| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | 14.43 | -| `TaxRateRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | -| `TrackingRefs` | [][shared.TrackingRef](../../../pkg/models/shared/trackingref.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | +| `InvoiceTo` | [*shared.InvoiceTo](../../../pkg/models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. | | +| `ItemRef` | [*shared.ItemRef](../../../pkg/models/shared/itemref.md) | :heavy_minus_sign: | N/A | | +| `NetAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the line, exclusive of tax. | 100 | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | 20 | +| `TaxRateRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | +| `TrackingRefs` | [][shared.TrackingRef](../../../pkg/models/shared/trackingref.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/expensetransactiontype.md b/sync-for-expenses/docs/pkg/models/shared/expensetransactiontype.md index 581d8c9eb..bdbe25a76 100644 --- a/sync-for-expenses/docs/pkg/models/shared/expensetransactiontype.md +++ b/sync-for-expenses/docs/pkg/models/shared/expensetransactiontype.md @@ -5,13 +5,9 @@ The type of transaction. ## Values -| Name | Value | -| ------------------------------------- | ------------------------------------- | -| `ExpenseTransactionTypePayment` | Payment | -| `ExpenseTransactionTypeRefund` | Refund | -| `ExpenseTransactionTypeReward` | Reward | -| `ExpenseTransactionTypeChargeback` | Chargeback | -| `ExpenseTransactionTypeTransferIn` | TransferIn | -| `ExpenseTransactionTypeTransferOut` | TransferOut | -| `ExpenseTransactionTypeAdjustmentIn` | AdjustmentIn | -| `ExpenseTransactionTypeAdjustmentOut` | AdjustmentOut | \ No newline at end of file +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `ExpenseTransactionTypePayment` | Payment | +| `ExpenseTransactionTypeRefund` | Refund | +| `ExpenseTransactionTypeReward` | Reward | +| `ExpenseTransactionTypeChargeback` | Chargeback | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/from.md b/sync-for-expenses/docs/pkg/models/shared/from.md new file mode 100644 index 000000000..463f0ea39 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/from.md @@ -0,0 +1,9 @@ +# From + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `AccountRef` | [shared.AccountReference](../../../pkg/models/shared/accountreference.md) | :heavy_check_mark: | Reference of the account you are transferring money from. | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount that has been transferred from the account in the native currency of the account. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/initiatesync.md b/sync-for-expenses/docs/pkg/models/shared/initiatesync.md deleted file mode 100644 index 3e2b41a58..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/initiatesync.md +++ /dev/null @@ -1,8 +0,0 @@ -# InitiateSync - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `DatasetIds` | []*string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/invoiceto.md b/sync-for-expenses/docs/pkg/models/shared/invoiceto.md index c9ec9bc01..3343fdd2a 100644 --- a/sync-for-expenses/docs/pkg/models/shared/invoiceto.md +++ b/sync-for-expenses/docs/pkg/models/shared/invoiceto.md @@ -1,11 +1,11 @@ # InvoiceTo -Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. +Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `DataType` | [*shared.InvoiceToDataType](../../../pkg/models/shared/invoicetodatatype.md) | :heavy_minus_sign: | The type of contact. | customers | -| `ID` | **string* | :heavy_minus_sign: | identifier of customer. | 80000002-1674552702 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | identifier of customer. | 80000002-1674552702 | +| `Type` | [*shared.InvoiceToType](../../../pkg/models/shared/invoicetotype.md) | :heavy_minus_sign: | The type of contact. | customer | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/invoicetodatatype.md b/sync-for-expenses/docs/pkg/models/shared/invoicetodatatype.md deleted file mode 100644 index ae606d666..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/invoicetodatatype.md +++ /dev/null @@ -1,10 +0,0 @@ -# InvoiceToDataType - -The type of contact. - - -## Values - -| Name | Value | -| ---------------------------- | ---------------------------- | -| `InvoiceToDataTypeCustomers` | customers | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/invoicetotype.md b/sync-for-expenses/docs/pkg/models/shared/invoicetotype.md new file mode 100644 index 000000000..30aaad1aa --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/invoicetotype.md @@ -0,0 +1,10 @@ +# InvoiceToType + +The type of contact. + + +## Values + +| Name | Value | +| ----------------------- | ----------------------- | +| `InvoiceToTypeCustomer` | customer | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/itemref.md b/sync-for-expenses/docs/pkg/models/shared/itemref.md new file mode 100644 index 000000000..7962c710d --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/itemref.md @@ -0,0 +1,8 @@ +# ItemRef + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier for the item associated with the transaction. The `itemRef` object is currently supported only for QuickBooks Desktop. You can specify either `itemRef` or `accountRef`, but not both. | 80000002-1675158984 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/pulloperation.md b/sync-for-expenses/docs/pkg/models/shared/pulloperation.md index b2cc04319..e2cf3dce8 100644 --- a/sync-for-expenses/docs/pkg/models/shared/pulloperation.md +++ b/sync-for-expenses/docs/pkg/models/shared/pulloperation.md @@ -12,11 +12,11 @@ Information about a queued, in progress or completed pull operation. | `Completed` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | | `ConnectionID` | *string* | :heavy_check_mark: | Unique identifier of the connection associated to this pull operation. | 50830828-7d39-4367-b0eb-5ddb2de5faa5 | | `DataType` | *string* | :heavy_check_mark: | The data type you are requesting in a pull operation. | | -| `ErrorMessage` | **string* | :heavy_minus_sign: | A message about a transient or persistent error. | | +| `ErrorMessage` | **string* | :heavy_minus_sign: | A message about a transient or persistent error returned by Codat or the source platform. | | | `ID` | *string* | :heavy_check_mark: | Unique identifier of the pull operation. | 943accd0-4247-42d8-865b-363c8629e1da | | `IsCompleted` | *bool* | :heavy_check_mark: | `True` if the pull operation is completed successfully. The `isCompleted` property is not queryable. To filter failed pull operations, query by `status!=Complete&&status!=NotSupported` instead. | | | `IsErrored` | *bool* | :heavy_check_mark: | `True` if the pull operation entered an error state. | | | `Progress` | *int64* | :heavy_check_mark: | An integer signifying the progress of the pull operation. | | | `Requested` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `Status` | [shared.Status](../../../pkg/models/shared/status.md) | :heavy_check_mark: | The current status of the pull operation. | Complete | +| `Status` | [shared.DatasetStatus](../../../pkg/models/shared/datasetstatus.md) | :heavy_check_mark: | The current status of the dataset. | | | `StatusDescription` | **string* | :heavy_minus_sign: | Additional information about the dataset status. | Paused until 2022-10-23T00:00:00.000Z | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransaction.md b/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransaction.md index 025ddf3ea..767ecaea1 100644 --- a/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransaction.md +++ b/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransaction.md @@ -3,16 +3,14 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AllOf` | *interface{}* | :heavy_minus_sign: | N/A | | -| `BankAccountRef` | [*shared.BankAccountReference](../../../pkg/models/shared/bankaccountreference.md) | :heavy_minus_sign: | N/A | | -| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | -| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. \| | | -| `DueDate` | *interface{}* | :heavy_check_mark: | N/A | | -| `ID` | *string* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | -| `IssueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `Lines` | [][shared.ReimbursableExpenseTransactionLine](../../../pkg/models/shared/reimbursableexpensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | -| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | -| `RecordRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the reimbursable expense. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContactRef` | [shared.ReimbursementContactRef](../../../pkg/models/shared/reimbursementcontactref.md) | :heavy_check_mark: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | +| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `DueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `ID` | *string* | :heavy_check_mark: | Your unique identifier for the transaction. | 4d7c6929-7770-412b-91bb-44d3bc71d111 | +| `IssueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Lines` | [][shared.ReimbursableExpenseTransactionLine](../../../pkg/models/shared/reimbursableexpensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | +| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the reimbursable expense. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransactionline.md b/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransactionline.md index df6dfb9ee..a90291121 100644 --- a/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransactionline.md +++ b/sync-for-expenses/docs/pkg/models/shared/reimbursableexpensetransactionline.md @@ -3,11 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `AccountRef` | [shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_check_mark: | N/A | | -| `InvoiceTo` | [*shared.InvoiceTo](../../../pkg/models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. | | -| `NetAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the line, exclusive of tax. | 110.42 | -| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | 14.43 | -| `TaxRateRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | -| `TrackingRefs` | [][shared.TrackingRef](../../../pkg/models/shared/trackingref.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AccountRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | +| `Description` | **string* | :heavy_minus_sign: | line description | 2-night hotel stay | +| `InvoiceTo` | [*shared.InvoiceTo](../../../pkg/models/shared/invoiceto.md) | :heavy_minus_sign: | Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. | | +| `ItemRef` | [*shared.ItemRef](../../../pkg/models/shared/itemref.md) | :heavy_minus_sign: | N/A | | +| `NetAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount of the line, exclusive of tax. | 100 | +| `TaxAmount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of tax for the line. | 20 | +| `TaxRateRef` | [*shared.RecordRef](../../../pkg/models/shared/recordref.md) | :heavy_minus_sign: | N/A | | +| `TrackingRefs` | [][shared.TrackingRef](../../../pkg/models/shared/trackingref.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/expensetransactionbankaccountreference.md b/sync-for-expenses/docs/pkg/models/shared/reimbursementcontactref.md similarity index 63% rename from sync-for-expenses/docs/pkg/models/shared/expensetransactionbankaccountreference.md rename to sync-for-expenses/docs/pkg/models/shared/reimbursementcontactref.md index 9a2f7b059..6a4bd4a72 100644 --- a/sync-for-expenses/docs/pkg/models/shared/expensetransactionbankaccountreference.md +++ b/sync-for-expenses/docs/pkg/models/shared/reimbursementcontactref.md @@ -1,8 +1,8 @@ -# ExpenseTransactionBankAccountReference +# ReimbursementContactRef ## Fields | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | Identifier of the bank account. | 787dfb37-5707-4dc0-8a86-8d74e4cc78ea | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | Identifier of contact. | 40e3e57c-2322-4898-966c-ca41adfd23fd | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/status.md b/sync-for-expenses/docs/pkg/models/shared/status.md index 60edaf201..8d44ab0c2 100644 --- a/sync-for-expenses/docs/pkg/models/shared/status.md +++ b/sync-for-expenses/docs/pkg/models/shared/status.md @@ -1,6 +1,6 @@ # Status -The current status of the pull operation. +The current status of the dataset. ## Values @@ -24,8 +24,6 @@ The current status of the pull operation. | `StatusValidationError` | ValidationError | | `StatusAuthError` | AuthError | | `StatusCancelled` | Cancelled | -| `StatusRouting` | Routing | -| `StatusRoutingError` | RoutingError | | `StatusNotSupported` | NotSupported | | `StatusRateLimitError` | RateLimitError | | `StatusPermissionsError` | PermissionsError | diff --git a/sync-for-expenses/docs/pkg/models/shared/supplementaldata.md b/sync-for-expenses/docs/pkg/models/shared/supplementaldata.md index 691487372..48a2c1fe3 100644 --- a/sync-for-expenses/docs/pkg/models/shared/supplementaldata.md +++ b/sync-for-expenses/docs/pkg/models/shared/supplementaldata.md @@ -2,11 +2,11 @@ Supplemental data is additional data you can include in our standard data types. -It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. +It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `Content` | map[string]map[string]*interface{}* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------- | --------------------------- | --------------------------- | --------------------------- | +| `Content` | map[string]map[string]*any* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/supplier.md b/sync-for-expenses/docs/pkg/models/shared/supplier.md index 61d304862..dae4a5778 100644 --- a/sync-for-expenses/docs/pkg/models/shared/supplier.md +++ b/sync-for-expenses/docs/pkg/models/shared/supplier.md @@ -15,13 +15,13 @@ From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers | `ContactName` | **string* | :heavy_minus_sign: | Name of the main contact for the supplier. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +44 25691 154789 | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.SupplierStatus](../../../pkg/models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `SupplierName` | **string* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Supplier's company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/supplierdetails.md b/sync-for-expenses/docs/pkg/models/shared/supplierdetails.md index bcabc20a6..ee2f51157 100644 --- a/sync-for-expenses/docs/pkg/models/shared/supplierdetails.md +++ b/sync-for-expenses/docs/pkg/models/shared/supplierdetails.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting platform. | \ No newline at end of file +| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/syncinitiated.md b/sync-for-expenses/docs/pkg/models/shared/syncinitiated.md deleted file mode 100644 index b526a1871..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/syncinitiated.md +++ /dev/null @@ -1,8 +0,0 @@ -# SyncInitiated - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| `SyncID` | **string* | :heavy_minus_sign: | Unique identifier for the sync initiated. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/syncstartedwebhook.md b/sync-for-expenses/docs/pkg/models/shared/syncstartedwebhook.md deleted file mode 100644 index 12daa7371..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/syncstartedwebhook.md +++ /dev/null @@ -1,17 +0,0 @@ -# SyncStartedWebhook - -Webhook request body used to notify that a sync has started. - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AlertID` | **string* | :heavy_minus_sign: | Unique identifier of the webhook event. | | -| `ClientID` | **string* | :heavy_minus_sign: | Unique identifier for your client in Codat. | | -| `ClientName` | **string* | :heavy_minus_sign: | Name of your client in Codat. | | -| `CompanyID` | **string* | :heavy_minus_sign: | Unique identifier for your SMB in Codat. | 8a210b68-6988-11ed-a1eb-0242ac120002 | -| `Data` | [*shared.Data](../../../pkg/models/shared/data.md) | :heavy_minus_sign: | N/A | | -| `Message` | **string* | :heavy_minus_sign: | A human-readable message about the webhook. | | -| ~~`RuleID`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Unique identifier for the rule. | | -| `RuleType` | **string* | :heavy_minus_sign: | The type of rule. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/tags.md b/sync-for-expenses/docs/pkg/models/shared/tags.md new file mode 100644 index 000000000..6de993aa8 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/tags.md @@ -0,0 +1,9 @@ +# Tags + +A collection of user-defined key-value pairs that store custom metadata against the company. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfo.md b/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfo.md index fd5ec3816..aa6bda8f3 100644 --- a/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfo.md +++ b/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfo.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `Code` | **string* | :heavy_minus_sign: | Code for the tax rate from the accounting platform. | UK Standard Rate (Bills) | -| `EffectiveTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Effective tax rate. | 20 | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier of tax rate. | 59_Bills | -| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting platform. | UK Standard Rate (Bills) Bills | -| `TotalTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total (not compounded) sum of the components of a tax rate. | 20 | -| `ValidTransactionTypes` | [][shared.TaxRateMappingInfoValidTransactionTypes](../../../pkg/models/shared/taxratemappinginfovalidtransactiontypes.md) | :heavy_minus_sign: | Supported transaction types for the account. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `Code` | **string* | :heavy_minus_sign: | Code for the tax rate from the accounting software. | 20% Bill tax | +| `EffectiveTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Effective tax rate. | 20 | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of tax rate. | 23_Bills | +| `Name` | **string* | :heavy_minus_sign: | Name of the tax rate in the accounting software. | 20% Bill tax Bills | +| `TotalTaxRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Total (not compounded) sum of the components of a tax rate. | 20 | +| `ValidTransactionTypes` | [][shared.ValidTransactionTypes](../../../pkg/models/shared/validtransactiontypes.md) | :heavy_minus_sign: | Supported transaction types for the account. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfovalidtransactiontypes.md b/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfovalidtransactiontypes.md deleted file mode 100644 index a0e2c390e..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/taxratemappinginfovalidtransactiontypes.md +++ /dev/null @@ -1,15 +0,0 @@ -# TaxRateMappingInfoValidTransactionTypes - - -## Values - -| Name | Value | -| ------------------------------------------------------ | ------------------------------------------------------ | -| `TaxRateMappingInfoValidTransactionTypesPayment` | Payment | -| `TaxRateMappingInfoValidTransactionTypesRefund` | Refund | -| `TaxRateMappingInfoValidTransactionTypesReward` | Reward | -| `TaxRateMappingInfoValidTransactionTypesChargeback` | Chargeback | -| `TaxRateMappingInfoValidTransactionTypesTransferIn` | TransferIn | -| `TaxRateMappingInfoValidTransactionTypesTransferOut` | TransferOut | -| `TaxRateMappingInfoValidTransactionTypesAdjustmentIn` | AdjustmentIn | -| `TaxRateMappingInfoValidTransactionTypesAdjustmentOut` | AdjustmentOut | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/to.md b/sync-for-expenses/docs/pkg/models/shared/to.md new file mode 100644 index 000000000..8d298c3fd --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/to.md @@ -0,0 +1,9 @@ +# To + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `AccountRef` | [shared.TransferTransactionRequestAccountReference](../../../pkg/models/shared/transfertransactionrequestaccountreference.md) | :heavy_check_mark: | Reference of the account you are transferring money to. | +| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_check_mark: | Amount that has been transferred to the account in the native currency of the account. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/trackingcategorymappinginfo.md b/sync-for-expenses/docs/pkg/models/shared/trackingcategorymappinginfo.md index ab6253bed..a82c37fc7 100644 --- a/sync-for-expenses/docs/pkg/models/shared/trackingcategorymappinginfo.md +++ b/sync-for-expenses/docs/pkg/models/shared/trackingcategorymappinginfo.md @@ -3,10 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `HasChildren` | **bool* | :heavy_minus_sign: | Boolean of whether the tracking category has child categories. | | -| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the tracking category. | DEPARTMENT_2 | -| `ModifiedDate` | **string* | :heavy_minus_sign: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | -| `Name` | **string* | :heavy_minus_sign: | Name of the tracking category as it appears in the accounting software. | New York | -| `ParentID` | **string* | :heavy_minus_sign: | ID of the parent tracking category | DEPARTMENTS | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `HasChildren` | **bool* | :heavy_minus_sign: | Boolean of whether the tracking category has child categories. | | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the tracking category. | DEPARTMENT_2 | +| `Name` | **string* | :heavy_minus_sign: | Name of the tracking category as it appears in the accounting software. | New York | +| `ParentID` | **string* | :heavy_minus_sign: | ID of the parent tracking category | DEPARTMENTS | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransaction.md b/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransaction.md new file mode 100644 index 000000000..ed84c73d7 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransaction.md @@ -0,0 +1,9 @@ +# TrackingRefAdjustmentTransaction + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `DataType` | [*shared.TrackingRefAdjustmentTransactionDataType](../../../pkg/models/shared/trackingrefadjustmenttransactiondatatype.md) | :heavy_minus_sign: | The type of the linked reference | trackingCategories | +| `ID` | **string* | :heavy_minus_sign: | Unique identifier of the linked reference from mapping options or the unique identifier of the linked customer or supplier. | e9a1b63d-9ff0-40e7-8038-016354b987e6 | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransactiondatatype.md b/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransactiondatatype.md new file mode 100644 index 000000000..27aabda5e --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/trackingrefadjustmenttransactiondatatype.md @@ -0,0 +1,12 @@ +# TrackingRefAdjustmentTransactionDataType + +The type of the linked reference + + +## Values + +| Name | Value | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| `TrackingRefAdjustmentTransactionDataTypeTrackingCategories` | trackingCategories | +| `TrackingRefAdjustmentTransactionDataTypeCustomers` | customers | +| `TrackingRefAdjustmentTransactionDataTypeSuppliers` | suppliers | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/transferdetails.md b/sync-for-expenses/docs/pkg/models/shared/transferdetails.md deleted file mode 100644 index 563b2cf57..000000000 --- a/sync-for-expenses/docs/pkg/models/shared/transferdetails.md +++ /dev/null @@ -1,9 +0,0 @@ -# TransferDetails - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AccountRef` | [*shared.AccountRef](../../../pkg/models/shared/accountref.md) | :heavy_minus_sign: | Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. | -| `Amount` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Amount of the transfer. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequest.md b/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequest.md new file mode 100644 index 000000000..ca5ade291 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequest.md @@ -0,0 +1,11 @@ +# TransferTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `Date` | *string* | :heavy_check_mark: | N/A | 2022-10-23 00:00:00 +0000 UTC | +| `Description` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | Transfer from bank account Y to bank account Z | +| `From` | [shared.From](../../../pkg/models/shared/from.md) | :heavy_check_mark: | N/A | | +| `To` | [shared.To](../../../pkg/models/shared/to.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequestaccountreference.md b/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequestaccountreference.md new file mode 100644 index 000000000..3340d41ca --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/transfertransactionrequestaccountreference.md @@ -0,0 +1,10 @@ +# TransferTransactionRequestAccountReference + +Reference of the account you are transferring money to. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `ID` | *string* | :heavy_check_mark: | 'id' from the Accounts data type. | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/createtransferresponse.md b/sync-for-expenses/docs/pkg/models/shared/transfertransactionresponse.md similarity index 95% rename from sync-for-expenses/docs/pkg/models/shared/createtransferresponse.md rename to sync-for-expenses/docs/pkg/models/shared/transfertransactionresponse.md index 1cab8e5ad..62e7be7f8 100644 --- a/sync-for-expenses/docs/pkg/models/shared/createtransferresponse.md +++ b/sync-for-expenses/docs/pkg/models/shared/transfertransactionresponse.md @@ -1,4 +1,4 @@ -# CreateTransferResponse +# TransferTransactionResponse ## Fields diff --git a/sync-for-expenses/docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md b/sync-for-expenses/docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md index 8d6b73655..f982fa657 100644 --- a/sync-for-expenses/docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md +++ b/sync-for-expenses/docs/pkg/models/shared/updatecustomerresponseaccountingcustomer.md @@ -22,12 +22,12 @@ Customers' data links to accounts receivable [invoices](https://docs.codat.io/sy | `CustomerName` | **string* | :heavy_minus_sign: | Name of the customer as recorded in the accounting system, typically the company name. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_.

## Unknown currencies

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

There are only a very small number of edge cases where this currency code is returned by the Codat system. | GBP | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address the customer can be contacted by. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the customer, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number the customer can be contacted by. | | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number. In the UK, this is typically the Companies House company registration number. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.CustomerStatus](../../../pkg/models/shared/customerstatus.md) | :heavy_check_mark: | Status of customer. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/updateexpenserequest.md b/sync-for-expenses/docs/pkg/models/shared/updateexpenserequest.md index 3dd295ce8..7c7fdef59 100644 --- a/sync-for-expenses/docs/pkg/models/shared/updateexpenserequest.md +++ b/sync-for-expenses/docs/pkg/models/shared/updateexpenserequest.md @@ -3,14 +3,14 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `BankAccountRef` | [*shared.UpdateExpenseRequestBankAccountReference](../../../pkg/models/shared/updateexpenserequestbankaccountreference.md) | :heavy_minus_sign: | N/A | | -| `ContactRef` | [*shared.ContactRef](../../../pkg/models/shared/contactref.md) | :heavy_minus_sign: | N/A | | -| `Currency` | **string* | :heavy_minus_sign: | Currency the transaction was recorded in. | GBP | -| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. \| | | -| `IssueDate` | *string* | :heavy_check_mark: | Date the transaction was recorded. | 2022-06-28T00:00:00.000Z | -| `Lines` | [][shared.ExpenseTransactionLine](../../../pkg/models/shared/expensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | -| `MerchantName` | **string* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | -| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | -| `Type` | *interface{}* | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `BankAccountRef` | [*shared.UpdateExpenseRequestBankAccountReference](../../../pkg/models/shared/updateexpenserequestbankaccountreference.md) | :heavy_minus_sign: | N/A | | +| `ContactRef` | [*shared.ExpenseContactRef](../../../pkg/models/shared/expensecontactref.md) | :heavy_minus_sign: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | +| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `IssueDate` | *string* | :heavy_check_mark: | Date the transaction was recorded. | 2022-06-28T00:00:00.000Z | +| `Lines` | [][shared.ExpenseTransactionLine](../../../pkg/models/shared/expensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | +| `MerchantName` | **string* | :heavy_minus_sign: | Name of the merchant where the purchase took place | Amazon UK | +| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `Type` | [shared.UpdateExpenseRequestType](../../../pkg/models/shared/updateexpenserequesttype.md) | :heavy_check_mark: | The type of transaction. | Payment | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/updateexpenserequesttype.md b/sync-for-expenses/docs/pkg/models/shared/updateexpenserequesttype.md new file mode 100644 index 000000000..58b092efa --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/updateexpenserequesttype.md @@ -0,0 +1,13 @@ +# UpdateExpenseRequestType + +The type of transaction. + + +## Values + +| Name | Value | +| ------------------------------------ | ------------------------------------ | +| `UpdateExpenseRequestTypePayment` | Payment | +| `UpdateExpenseRequestTypeRefund` | Refund | +| `UpdateExpenseRequestTypeReward` | Reward | +| `UpdateExpenseRequestTypeChargeback` | Chargeback | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/updatereimbursableexpensetransactionrequest.md b/sync-for-expenses/docs/pkg/models/shared/updatereimbursableexpensetransactionrequest.md new file mode 100644 index 000000000..683287126 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/shared/updatereimbursableexpensetransactionrequest.md @@ -0,0 +1,15 @@ +# UpdateReimbursableExpenseTransactionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContactRef` | [shared.ReimbursementContactRef](../../../pkg/models/shared/reimbursementcontactref.md) | :heavy_check_mark: | N/A | | +| `Currency` | *string* | :heavy_check_mark: | Currency the transaction was recorded in. | GBP | +| `CurrencyRate` | [*decimal.Big](https://pkg.go.dev/github.com/ericlagergren/decimal#Big) | :heavy_minus_sign: | Rate to convert the total amount of the payment into the base currency for the company at the time of the payment.

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

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

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

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

## Examples with base currency of GBP

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

## Examples with base currency of USD

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


### Integration-specific details

\| Integration \| Scenario \| System behavior \|
\|-------------------\|-------------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------\|
\| QuickBooks Online \| Transaction currency differs from base currency \| If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. \| | | +| `DueDate` | *string* | :heavy_check_mark: | In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example:

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



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

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

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

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



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

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

> Time zones
>
> Not all dates from Codat will contain information about time zones.
> Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. | 2022-10-23 00:00:00 +0000 UTC | +| `Lines` | [][shared.ReimbursableExpenseTransactionLine](../../../pkg/models/shared/reimbursableexpensetransactionline.md) | :heavy_minus_sign: | Array of transaction lines. | | +| `Notes` | **string* | :heavy_minus_sign: | Any private, company notes about the transaction. | APPLE.COM/BILL - 09001077498 - Card Ending: 4590 | +| `Reference` | **string* | :heavy_minus_sign: | User-friendly reference for the reimbursable expense. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md b/sync-for-expenses/docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md index e6967e141..846abaf29 100644 --- a/sync-for-expenses/docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md +++ b/sync-for-expenses/docs/pkg/models/shared/updatesupplierresponseaccountingsupplier.md @@ -17,13 +17,13 @@ From the **Suppliers** endpoints, you can retrieve a list of [all the suppliers | `ContactName` | **string* | :heavy_minus_sign: | Name of the main contact for the supplier. | | | `DefaultCurrency` | **string* | :heavy_minus_sign: | Default currency the supplier's transactional data is recorded in. | | | `EmailAddress` | **string* | :heavy_minus_sign: | Email address that the supplier may be contacted on. | | -| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting platform. | | +| `ID` | **string* | :heavy_minus_sign: | Identifier for the supplier, unique to the company in the accounting software. | | | `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | N/A | | | `ModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Phone` | **string* | :heavy_minus_sign: | Phone number that the supplier may be contacted on. | +44 25691 154789 | | `RegistrationNumber` | **string* | :heavy_minus_sign: | Company number of the supplier. In the UK, this is typically the company registration number issued by Companies House. | | | `SourceModifiedDate` | **string* | :heavy_minus_sign: | N/A | 2022-10-23 00:00:00 +0000 UTC | | `Status` | [shared.SupplierStatus](../../../pkg/models/shared/supplierstatus.md) | :heavy_check_mark: | Status of the supplier. | | -| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | +| `SupplementalData` | [*shared.SupplementalData](../../../pkg/models/shared/supplementaldata.md) | :heavy_minus_sign: | Supplemental data is additional data you can include in our standard data types.

It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. | | | `SupplierName` | **string* | :heavy_minus_sign: | Name of the supplier as recorded in the accounting system, typically the company name. | | | `TaxNumber` | **string* | :heavy_minus_sign: | Supplier's company tax number. | | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/shared/validtransactiontypes.md b/sync-for-expenses/docs/pkg/models/shared/validtransactiontypes.md index 7354b0fa1..accfd4c63 100644 --- a/sync-for-expenses/docs/pkg/models/shared/validtransactiontypes.md +++ b/sync-for-expenses/docs/pkg/models/shared/validtransactiontypes.md @@ -3,13 +3,9 @@ ## Values -| Name | Value | -| ------------------------------------ | ------------------------------------ | -| `ValidTransactionTypesPayment` | Payment | -| `ValidTransactionTypesRefund` | Refund | -| `ValidTransactionTypesReward` | Reward | -| `ValidTransactionTypesChargeback` | Chargeback | -| `ValidTransactionTypesTransferIn` | TransferIn | -| `ValidTransactionTypesTransferOut` | TransferOut | -| `ValidTransactionTypesAdjustmentIn` | AdjustmentIn | -| `ValidTransactionTypesAdjustmentOut` | AdjustmentOut | \ No newline at end of file +| Name | Value | +| --------------------------------- | --------------------------------- | +| `ValidTransactionTypesPayment` | Payment | +| `ValidTransactionTypesRefund` | Refund | +| `ValidTransactionTypesReward` | Reward | +| `ValidTransactionTypesChargeback` | Chargeback | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md b/sync-for-expenses/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md new file mode 100644 index 000000000..b6367e569 --- /dev/null +++ b/sync-for-expenses/docs/pkg/models/webhooks/clientratelimitreachedresponse1.md @@ -0,0 +1,10 @@ +# ClientRateLimitReachedResponse1 + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/sync-for-expenses/docs/pkg/models/webhooks/syncstartedresponse.md b/sync-for-expenses/docs/pkg/models/webhooks/clientratelimitresetresponse1.md similarity index 97% rename from sync-for-expenses/docs/pkg/models/webhooks/syncstartedresponse.md rename to sync-for-expenses/docs/pkg/models/webhooks/clientratelimitresetresponse1.md index 64bb63729..5590e98f1 100644 --- a/sync-for-expenses/docs/pkg/models/webhooks/syncstartedresponse.md +++ b/sync-for-expenses/docs/pkg/models/webhooks/clientratelimitresetresponse1.md @@ -1,4 +1,4 @@ -# SyncStartedResponse +# ClientRateLimitResetResponse1 ## Fields diff --git a/sync-for-expenses/docs/sdks/accounts/README.md b/sync-for-expenses/docs/sdks/accounts/README.md index 01384fb89..482128401 100644 --- a/sync-for-expenses/docs/sdks/accounts/README.md +++ b/sync-for-expenses/docs/sdks/accounts/README.md @@ -3,7 +3,7 @@ ## Overview -Accounts +Create accounts and view create account options. ### Available Operations @@ -29,9 +29,10 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -43,6 +44,17 @@ func main() { ctx := context.Background() res, err := s.Accounts.Create(ctx, operations.CreateAccountRequest{ + AccountPrototype: &shared.AccountPrototype{ + Currency: syncforexpenses.String("USD"), + CurrentBalance: types.MustNewDecimalFromString("0"), + Description: syncforexpenses.String("Invoices the business has issued but has not yet collected payment on."), + FullyQualifiedCategory: syncforexpenses.String("Asset.Current"), + FullyQualifiedName: syncforexpenses.String("Cash On Hand"), + Name: syncforexpenses.String("Accounts Receivable"), + NominalCode: syncforexpenses.String("610"), + Status: shared.AccountStatusActive.ToPointer(), + Type: shared.AccountTypeAsset.ToPointer(), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) @@ -63,15 +75,18 @@ func main() { | `request` | [operations.CreateAccountRequest](../../pkg/models/operations/createaccountrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateAccountResponse](../../pkg/models/operations/createaccountresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetCreateModel The *Get create account model* endpoint returns the expected data for the request payload when creating an [account](https://docs.codat.io/sync-for-expenses-api#/schemas/Account) for a given company and integration. @@ -91,7 +106,6 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -125,10 +139,12 @@ func main() { | `request` | [operations.GetCreateChartOfAccountsModelRequest](../../pkg/models/operations/getcreatechartofaccountsmodelrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetCreateChartOfAccountsModelResponse](../../pkg/models/operations/getcreatechartofaccountsmodelresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/adjustments/README.md b/sync-for-expenses/docs/sdks/adjustments/README.md new file mode 100644 index 000000000..fcfec1e40 --- /dev/null +++ b/sync-for-expenses/docs/sdks/adjustments/README.md @@ -0,0 +1,118 @@ +# Adjustments +(*Adjustments*) + +## Overview + +Create transactions that represent your adjustments to your customers' spend. + +### Available Operations + +* [Create](#create) - Create adjustment transaction + +## Create + +Use the *Create adjustment expense* endpoint to create an [adjustment](https://docs.codat.io/sync-for-expenses-api#/schemas/AdjustmentTransactionRequest) in the accounting software for a given company's connection. + +Adjustments represent write-offs and transaction alterations, such as foreign exchange adjustments, in the form of a journal entry. + +### Supported Integrations + +| Integration | Supported | +|-----------------------|-----------| +| QuickBooks Desktop | Yes | + +### Example Usage + +```go +package main + +import( + syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" + "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "log" +) + +func main() { + s := syncforexpenses.New( + syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), + ) + + ctx := context.Background() + res, err := s.Adjustments.Create(ctx, operations.CreateAdjustmentTransactionRequest{ + RequestBody: []shared.AdjustmentTransactionRequest{ + shared.AdjustmentTransactionRequest{ + Currency: "USD", + CurrencyRate: types.MustNewDecimalFromString("1"), + Date: "2024-05-21T00:00:00+00:00", + ID: "3357b3df-5f2e-465d-b9ba-226519dbb8f1", + Lines: []shared.AdjustmentTransactionLine{ + shared.AdjustmentTransactionLine{ + AccountRef: shared.RecordRef{ + ID: syncforexpenses.String("80000018-1671793811"), + }, + Amount: types.MustNewDecimalFromString("50"), + Description: syncforexpenses.String("debit line"), + InvoiceTo: &shared.InvoiceTo{ + ID: syncforexpenses.String("80000002-1674552702"), + Type: shared.InvoiceToTypeCustomer.ToPointer(), + }, + TrackingRefs: []shared.TrackingRefAdjustmentTransaction{ + shared.TrackingRefAdjustmentTransaction{ + DataType: shared.TrackingRefAdjustmentTransactionDataTypeTrackingCategories.ToPointer(), + ID: syncforexpenses.String("80000003-1674553958"), + }, + }, + }, + shared.AdjustmentTransactionLine{ + AccountRef: shared.RecordRef{ + ID: syncforexpenses.String("80000028-1671794219"), + }, + Amount: types.MustNewDecimalFromString("-50"), + Description: syncforexpenses.String("credit line"), + InvoiceTo: &shared.InvoiceTo{ + ID: syncforexpenses.String("80000002-1674552702"), + Type: shared.InvoiceToTypeCustomer.ToPointer(), + }, + TrackingRefs: []shared.TrackingRefAdjustmentTransaction{ + shared.TrackingRefAdjustmentTransaction{ + DataType: shared.TrackingRefAdjustmentTransactionDataTypeTrackingCategories.ToPointer(), + ID: syncforexpenses.String("80000003-1674553958"), + }, + }, + }, + }, + Reference: syncforexpenses.String("test reference"), + }, + }, + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + if err != nil { + log.Fatal(err) + } + if res.AdjustmentTransactionResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.CreateAdjustmentTransactionRequest](../../pkg/models/operations/createadjustmenttransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateAdjustmentTransactionResponse](../../pkg/models/operations/createadjustmenttransactionresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------- | ------------------------------- | ------------------------------- | +| sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/attachments/README.md b/sync-for-expenses/docs/sdks/attachments/README.md index b69c875dd..e34968d35 100644 --- a/sync-for-expenses/docs/sdks/attachments/README.md +++ b/sync-for-expenses/docs/sdks/attachments/README.md @@ -3,7 +3,7 @@ ## Overview -Upload attachmens to expenses, transfers and reimbursable expense transactions. +Attach receipts to a transaction for a complete audit trail. ### Available Operations @@ -21,7 +21,7 @@ Each accounting software supports different file formats and sizes. | Integration | File Size | File Extension | |-------------|-------------|--------------------------------------------------------------------------------------------------------------| -| Xero | 4MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | +| Xero | 3MB | 7Z, BMP, CSV, DOC, DOCX, EML, GIF, JPEG, JPG, KEYNOTE, MSG, NUMBERS, ODF, ODS, ODT, PAGES, PDF, PNG, PPT, PPTX, RAR, RTF, TIF, TIFF, TXT, XLS, XLSX, ZIP | | QuickBooks Online | 100MB | AI, CSV, DOC, DOCX, EPS, GIF, JPEG, JPG, ODS, PAGES, PDF, PNG, RTF, TIF, TXT, XLS, XLSX, XML | | NetSuite | 100MB | BMP, CSV, XLS, XLSX, JSON, PDF, PJPG, PJPEG, PNG, TXT, SVG, TIF, TIFF, DOC, DOCX, ZIP | | Dynamics 365 Business Central | 350 MB | Dynamics do not explicitly outline which file types are supported but they do state here that "You can attach any type of file, such as text, image, or video files". | @@ -32,8 +32,8 @@ Each accounting software supports different file formats and sizes. package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" + "os" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" @@ -44,6 +44,11 @@ func main() { syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), ) + content, fileErr := os.Open("example.file") + if fileErr != nil { + panic(fileErr) + } + ctx := context.Background() res, err := s.Attachments.Upload(ctx, operations.UploadExpenseAttachmentRequest{ CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", @@ -67,10 +72,12 @@ func main() { | `request` | [operations.UploadExpenseAttachmentRequest](../../pkg/models/operations/uploadexpenseattachmentrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UploadExpenseAttachmentResponse](../../pkg/models/operations/uploadexpenseattachmentresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/bankaccounts/README.md b/sync-for-expenses/docs/sdks/bankaccounts/README.md new file mode 100644 index 000000000..2ae25fc3b --- /dev/null +++ b/sync-for-expenses/docs/sdks/bankaccounts/README.md @@ -0,0 +1,147 @@ +# BankAccounts +(*BankAccounts*) + +## Overview + +Create bank accounts and view create bank account options. + +### Available Operations + +* [Create](#create) - Create bank account +* [GetCreateModel](#getcreatemodel) - Get create bank account model + +## Create + +The *Create bank account* endpoint creates a new [bank account](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) for a given company's connection. + +[Bank accounts](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +**Integration-specific behaviour** + +Required data may vary by integration. To see what data to post, first call [Get create/update bank account model](https://docs.codat.io/sync-for-expenses-api#/operations/get-create-update-bankAccounts-model). + +Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating an account. + +### Example Usage + +```go +package main + +import( + syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" + "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "log" +) + +func main() { + s := syncforexpenses.New( + syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), + ) + + ctx := context.Background() + res, err := s.BankAccounts.Create(ctx, operations.CreateBankAccountRequest{ + BankAccount: &shared.BankAccount{ + AccountName: syncforexpenses.String("GBP Bank Account"), + AccountNumber: syncforexpenses.String("12345678"), + AccountType: shared.BankAccountTypeDebit.ToPointer(), + Currency: syncforexpenses.String("GBP"), + ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + SourceModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + Status: shared.BankAccountStatusActive.ToPointer(), + }, + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + if err != nil { + log.Fatal(err) + } + if res.CreateBankAccountResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.CreateBankAccountRequest](../../pkg/models/operations/createbankaccountrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.CreateBankAccountResponse](../../pkg/models/operations/createbankaccountresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------- | ------------------------------- | ------------------------------- | +| sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetCreateModel + +The *Get create/update bank account model* endpoint returns the expected data for the request payload when creating and updating a [bank account](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) for a given company and integration. + +[Bank accounts](https://docs.codat.io/sync-for-expenses-api#/schemas/BankAccount) are financial accounts maintained by a bank or other financial institution. + +**Integration-specific behaviour** + +See the *response examples* for integration-specific indicative models. + +Check out our [coverage explorer](https://knowledge.codat.io/supported-features/accounting?view=tab-by-data-type&dataType=bankAccounts) for integrations that support creating and updating a bank account. + + +### Example Usage + +```go +package main + +import( + syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" + "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "log" +) + +func main() { + s := syncforexpenses.New( + syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), + ) + + ctx := context.Background() + res, err := s.BankAccounts.GetCreateModel(ctx, operations.GetCreateBankAccountsModelRequest{ + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", + }) + if err != nil { + log.Fatal(err) + } + if res.PushOption != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetCreateBankAccountsModelRequest](../../pkg/models/operations/getcreatebankaccountsmodelrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetCreateBankAccountsModelResponse](../../pkg/models/operations/getcreatebankaccountsmodelresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/codatsyncexpenses/README.md b/sync-for-expenses/docs/sdks/codatsyncexpenses/README.md index b56efefd0..3297e0bc7 100644 --- a/sync-for-expenses/docs/sdks/codatsyncexpenses/README.md +++ b/sync-for-expenses/docs/sdks/codatsyncexpenses/README.md @@ -1,19 +1,35 @@ # CodatSyncExpenses SDK - ## Overview Sync for Expenses: The API for Sync for Expenses. Sync for Expenses is an API and a set of supporting tools. It has been built to enable corporate card and expense management platforms to provide high-quality -integrations with multiple accounting platforms through a standardized API. - -[Read more...](https://docs.codat.io/sync-for-expenses/overview) +integrations with multiple accounting software through a standardized API. -[See our OpenAPI spec](https://github.com/codatio/oas) +[Explore product](https://docs.codat.io/sync-for-expenses/overview) | [See our OpenAPI spec](https://github.com/codatio/oas) Not seeing the endpoints you're expecting? We've [reorganized our products](https://docs.codat.io/updates/230901-new-products), and you may be using a [different version of Sync for Expenses](https://docs.codat.io/sync-for-expenses-v1-api#/). -### Available Operations - +--- + +## Endpoints + +| Endpoints | Description | +| :- |:- | +| Companies | Create and manage your SMB users' companies. | +| Connections | Create new and manage existing data connections for a company. | +| Configuration | View and manage mapping configuration and defaults for expense transactions. | +| Sync | Monitor the status of data syncs. | +| Expenses | Create and update transactions that represent your customers' spend. | +| Transfers | Create and update transactions that represent the movement of your customers' money. | +| Reimbursements | Create and update transactions that represent your customers' repayable spend. | +| Attachments | Attach receipts to a transaction for a complete audit trail. | +| Transaction status | Monitor the status of individual transactions in data syncs. | +| Manage data | Control and monitor the retrieval of data from an integration. | +| Push operations | View historic push operations. | +| Accounts | Create accounts and view account schemas. | +| Customers | Get, create, and update customers. | +| Suppliers | Get, create, and update suppliers. | + \ No newline at end of file diff --git a/sync-for-expenses/docs/sdks/companies/README.md b/sync-for-expenses/docs/sdks/companies/README.md index a82028400..97205361b 100644 --- a/sync-for-expenses/docs/sdks/companies/README.md +++ b/sync-for-expenses/docs/sdks/companies/README.md @@ -3,7 +3,7 @@ ## Overview -Create and manage your Codat companies. +Create and manage your SMB users' companies. ### Available Operations @@ -28,9 +28,9 @@ If forbidden characters (see `name` pattern) are present in the request, a compa package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "log" ) @@ -42,7 +42,12 @@ func main() { ctx := context.Background() res, err := s.Companies.Create(ctx, &shared.CompanyRequestBody{ Description: syncforexpenses.String("Requested early access to the new financing scheme."), - Name: "Bank of Dave", + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "Technicalium", }) if err != nil { log.Fatal(err) @@ -61,15 +66,18 @@ func main() { | `request` | [shared.CompanyRequestBody](../../pkg/models/shared/companyrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateCompanyResponse](../../pkg/models/operations/createcompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Delete The *Delete company* endpoint permanently deletes a [company](https://docs.codat.io/sync-for-expenses-api#/schemas/Company), its [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) and any cached data. This operation is irreversible. @@ -84,7 +92,6 @@ Each company can have multiple [connections](https://docs.codat.io/sync-for-expe package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -117,15 +124,18 @@ func main() { | `request` | [operations.DeleteCompanyRequest](../../pkg/models/operations/deletecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.DeleteCompanyResponse](../../pkg/models/operations/deletecompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get company* endpoint returns a single company for a given `companyId`. @@ -140,7 +150,6 @@ Each company can have multiple [connections](https://docs.codat.io/sync-for-expe package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -173,15 +182,18 @@ func main() { | `request` | [operations.GetCompanyRequest](../../pkg/models/operations/getcompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetCompanyResponse](../../pkg/models/operations/getcompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List companies* endpoint returns a list of [companies] associated to your instances. @@ -195,7 +207,6 @@ Each company can have multiple [connections](https://docs.codat.io/sync-for-expe package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -212,6 +223,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -230,15 +242,18 @@ func main() { | `request` | [operations.ListCompaniesRequest](../../pkg/models/operations/listcompaniesrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListCompaniesResponse](../../pkg/models/operations/listcompaniesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Update Use the *Update company* endpoint to update both the name and description of the company. @@ -253,9 +268,9 @@ Each company can have multiple [connections](https://docs.codat.io/sync-for-expe package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -267,6 +282,15 @@ func main() { ctx := context.Background() res, err := s.Companies.Update(ctx, operations.UpdateCompanyRequest{ + CompanyRequestBody: &shared.CompanyRequestBody{ + Description: syncforexpenses.String("Requested early access to the new financing scheme."), + Groups: []shared.GroupReference{ + shared.GroupReference{ + ID: syncforexpenses.String("60d2fa12-8a04-11ee-b9d1-0242ac120002"), + }, + }, + Name: "New Name", + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { @@ -286,10 +310,12 @@ func main() { | `request` | [operations.UpdateCompanyRequest](../../pkg/models/operations/updatecompanyrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateCompanyResponse](../../pkg/models/operations/updatecompanyresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/configuration/README.md b/sync-for-expenses/docs/sdks/configuration/README.md index 75b34c9e3..6c191f574 100644 --- a/sync-for-expenses/docs/sdks/configuration/README.md +++ b/sync-for-expenses/docs/sdks/configuration/README.md @@ -3,17 +3,16 @@ ## Overview -Manage mapping options and sync configuration. +View and manage mapping configuration and defaults for expense transactions. ### Available Operations * [Get](#get) - Get company configuration -* [GetMappingOptions](#getmappingoptions) - Mapping options * [Set](#set) - Set company configuration ## Get -Gets a companies expense sync configuration +Gets a company's expense sync configuration ### Example Usage @@ -21,7 +20,6 @@ Gets a companies expense sync configuration package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -54,70 +52,21 @@ func main() { | `request` | [operations.GetCompanyConfigurationRequest](../../pkg/models/operations/getcompanyconfigurationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetCompanyConfigurationResponse](../../pkg/models/operations/getcompanyconfigurationresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------- | --------------------------- | --------------------------- | -| sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - -## GetMappingOptions - -Gets the expense mapping options for a companies accounting software - -### Example Usage - -```go -package main - -import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" - syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" - "context" - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" - "log" -) - -func main() { - s := syncforexpenses.New( - syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), - ) - - ctx := context.Background() - res, err := s.Configuration.GetMappingOptions(ctx, operations.GetMappingOptionsRequest{ - CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - if err != nil { - log.Fatal(err) - } - if res.MappingOptions != nil { - // handle response - } -} -``` - -### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [operations.GetMappingOptionsRequest](../../pkg/models/operations/getmappingoptionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - - -### Response +### Errors -**[*operations.GetMappingOptionsResponse](../../pkg/models/operations/getmappingoptionsresponse.md), error** | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Set -Sets a companies expense sync configuration +Sets a company's expense sync configuration ### Example Usage @@ -125,9 +74,9 @@ Sets a companies expense sync configuration package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -139,6 +88,13 @@ func main() { ctx := context.Background() res, err := s.Configuration.Set(ctx, operations.SetCompanyConfigurationRequest{ + CompanyConfiguration: &shared.CompanyConfiguration{ + BankAccount: shared.BankAccountDetails{ + ID: syncforexpenses.String("32"), + }, + Customer: shared.CustomerDetails{}, + Supplier: shared.SupplierDetails{}, + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { @@ -158,10 +114,12 @@ func main() { | `request` | [operations.SetCompanyConfigurationRequest](../../pkg/models/operations/setcompanyconfigurationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.SetCompanyConfigurationResponse](../../pkg/models/operations/setcompanyconfigurationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/connections/README.md b/sync-for-expenses/docs/sdks/connections/README.md index aee9132bd..9180c0d36 100644 --- a/sync-for-expenses/docs/sdks/connections/README.md +++ b/sync-for-expenses/docs/sdks/connections/README.md @@ -3,7 +3,7 @@ ## Overview -Create and manage partner expense connection. +Create new and manage existing data connections for a company. ### Available Operations @@ -26,7 +26,6 @@ Use the [List Integrations](https://docs.codat.io/sync-for-expenses-api#/operati package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -40,6 +39,9 @@ func main() { ctx := context.Background() res, err := s.Connections.Create(ctx, operations.CreateConnectionRequest{ + RequestBody: &operations.CreateConnectionRequestBody{ + PlatformKey: syncforexpenses.String("gbol"), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { @@ -59,15 +61,18 @@ func main() { | `request` | [operations.CreateConnectionRequest](../../pkg/models/operations/createconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateConnectionResponse](../../pkg/models/operations/createconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## CreatePartnerExpenseConnection Creates a partner expense data connection @@ -78,7 +83,6 @@ Creates a partner expense data connection package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -111,15 +115,18 @@ func main() { | `request` | [operations.CreatePartnerExpenseConnectionRequest](../../pkg/models/operations/createpartnerexpenseconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreatePartnerExpenseConnectionResponse](../../pkg/models/operations/createpartnerexpenseconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Delete Revoke and remove a connection from a company. @@ -131,7 +138,6 @@ This operation is not reversible. The end user would need to reauthorize a new d package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -165,15 +171,18 @@ func main() { | `request` | [operations.DeleteConnectionRequest](../../pkg/models/operations/deleteconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.DeleteConnectionResponse](../../pkg/models/operations/deleteconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get Returns a specific connection for a company when valid identifiers are provided. If the identifiers are for a deleted company and/or connection, a not found response is returned. @@ -184,7 +193,6 @@ func main() { package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -218,15 +226,18 @@ func main() { | `request` | [operations.GetConnectionRequest](../../pkg/models/operations/getconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetConnectionResponse](../../pkg/models/operations/getconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List List the connections for a company. @@ -237,7 +248,6 @@ func main() { package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -255,6 +265,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -273,15 +284,18 @@ func main() { | `request` | [operations.ListConnectionsRequest](../../pkg/models/operations/listconnectionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListConnectionsResponse](../../pkg/models/operations/listconnectionsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Unlink This allows you to deauthorize a connection, without deleting it from Codat. This means you can still view any data that has previously been pulled into Codat, and also lets you re-authorize in future if your customer wishes to resume sharing their data. @@ -292,9 +306,9 @@ func main() { package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -306,6 +320,9 @@ func main() { ctx := context.Background() res, err := s.Connections.Unlink(ctx, operations.UnlinkConnectionRequest{ + RequestBody: &operations.UnlinkConnectionUpdateConnection{ + Status: shared.DataConnectionStatusUnlinked.ToPointer(), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) @@ -326,10 +343,12 @@ func main() { | `request` | [operations.UnlinkConnectionRequest](../../pkg/models/operations/unlinkconnectionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UnlinkConnectionResponse](../../pkg/models/operations/unlinkconnectionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/customers/README.md b/sync-for-expenses/docs/sdks/customers/README.md index c10a08820..5eb90cd13 100644 --- a/sync-for-expenses/docs/sdks/customers/README.md +++ b/sync-for-expenses/docs/sdks/customers/README.md @@ -3,7 +3,7 @@ ## Overview -Customers +Get, create, and update customers. ### Available Operations @@ -31,9 +31,9 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -45,6 +45,24 @@ func main() { ctx := context.Background() res, err := s.Customers.Create(ctx, operations.CreateCustomerRequest{ + Customer: &shared.Customer{ + Contacts: []shared.Contact{ + shared.Contact{ + ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + Phone: []shared.Phone{ + shared.Phone{ + Number: syncforexpenses.String("01224 658 999"), + Type: shared.PhoneNumberTypeMobile, + }, + }, + Status: shared.CustomerStatusUnknown, + }, + }, + DefaultCurrency: syncforexpenses.String("USD"), + ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + SourceModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + Status: shared.CustomerStatusArchived, + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", }) @@ -65,15 +83,18 @@ func main() { | `request` | [operations.CreateCustomerRequest](../../pkg/models/operations/createcustomerrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateCustomerResponse](../../pkg/models/operations/createcustomerresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get customer* endpoint returns a single customer for a given customerId. @@ -91,7 +112,6 @@ Before using this endpoint, you must have [retrieved data for the company](https package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -125,15 +145,18 @@ func main() { | `request` | [operations.GetCustomerRequest](../../pkg/models/operations/getcustomerrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetCustomerResponse](../../pkg/models/operations/getcustomerresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List customers* endpoint returns a list of [customers](https://docs.codat.io/sync-for-expenses-api#/schemas/Customer) for a given company's connection. @@ -149,7 +172,6 @@ Before using this endpoint, you must have [retrieved data for the company](https package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -167,6 +189,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -185,15 +208,18 @@ func main() { | `request` | [operations.ListCustomersRequest](../../pkg/models/operations/listcustomersrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListCustomersResponse](../../pkg/models/operations/listcustomersresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Update The *Update customer* endpoint updates an existing [customer](https://docs.codat.io/sync-for-expenses-api#/schemas/Customer) for a given company's connection. @@ -213,9 +239,9 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -227,6 +253,24 @@ func main() { ctx := context.Background() res, err := s.Customers.Update(ctx, operations.UpdateCustomerRequest{ + Customer: &shared.Customer{ + Contacts: []shared.Contact{ + shared.Contact{ + ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + Phone: []shared.Phone{ + shared.Phone{ + Number: syncforexpenses.String("+44 25691 154789"), + Type: shared.PhoneNumberTypeLandline, + }, + }, + Status: shared.CustomerStatusArchived, + }, + }, + DefaultCurrency: syncforexpenses.String("EUR"), + ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + SourceModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), + Status: shared.CustomerStatusUnknown, + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", CustomerID: "", @@ -248,10 +292,12 @@ func main() { | `request` | [operations.UpdateCustomerRequest](../../pkg/models/operations/updatecustomerrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateCustomerResponse](../../pkg/models/operations/updatecustomerresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/expenses/README.md b/sync-for-expenses/docs/sdks/expenses/README.md index 96c201f04..4c4abb7cf 100644 --- a/sync-for-expenses/docs/sdks/expenses/README.md +++ b/sync-for-expenses/docs/sdks/expenses/README.md @@ -3,7 +3,7 @@ ## Overview -Create expense transactions. +Create and update transactions that represent your customers' spend. ### Available Operations @@ -12,21 +12,20 @@ Create expense transactions. ## Create -The *Create expense* endpoint creates an [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting platform for a given company's connection. +The *Create expense* endpoint creates an [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting software for a given company's connection. [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. +### Supported Integrations -**Integration-specific behaviour** - -Some accounting platforms support the option of pushing transactions to a draft state. This can be done by setting the postAsDraft property on the transaction to true. For platforms without this feature, the postAsDraft property should be ignored or set to false. - -| Integration | Draft State | Details | -|-------------|-------------|--------------------------------------------------------------------------------------------------------------| -| Dynamics 365 Business Central | Yes | Setting postAsDraft to true will push the transactions to a drafted state rather than posting directly to the ledger. For transactions in a draft state, they can then be approved and posted within the accounting platform. | -| Quickbooks Online | No | - | -| Xero | No | - | -| NetSuite | No | - | +| Integration | Supported | +|-------------------------------|-----------| +| Dynamics 365 Business Central | Yes | +| FreeAgent | Yes | +| QuickBooks Desktop | Yes | +| QuickBooks Online | Yes | +| Oracle NetSuite | Yes | +| Xero | Yes | ### Example Usage @@ -34,9 +33,9 @@ Some accounting platforms support the option of pushing transactions to a draft package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -48,6 +47,9 @@ func main() { ctx := context.Background() res, err := s.Expenses.Create(ctx, operations.CreateExpenseTransactionRequest{ + RequestBody: []shared.ExpenseTransaction{ + + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { @@ -67,25 +69,32 @@ func main() { | `request` | [operations.CreateExpenseTransactionRequest](../../pkg/models/operations/createexpensetransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateExpenseTransactionResponse](../../pkg/models/operations/createexpensetransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | -## Update -The *Update expense* endpoint updates an existing [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting platform for a given company's connection. - -[Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. +## Update +The *Update expense* endpoint updates an existing [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateExpenseRequest) in the accounting software for a given company's connection. -**Integration-specific behaviour** +[Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateExpenseRequest) represent transactions made with a company debit or credit card. -At the moment you can update expenses only for Xero ([Payment](https://docs.codat.io/expenses/sync-process/expense-transactions#transaction-types) transaction type only). +### Supported Integrations +The following integrations are supported for the [Payment](https://docs.codat.io/expenses/sync-process/expense-transactions#transaction-types) transaction `type` only: +| Integration | Supported | +|-----------------------|-----------| +| FreeAgent | Yes | +| QuickBooks Online | Yes | +| Oracle NetSuite | Yes | +| Xero | Yes | ### Example Usage @@ -93,9 +102,10 @@ At the moment you can update expenses only for Xero ([Payment](https://docs.coda package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -107,6 +117,24 @@ func main() { ctx := context.Background() res, err := s.Expenses.Update(ctx, operations.UpdateExpenseTransactionRequest{ + UpdateExpenseRequest: &shared.UpdateExpenseRequest{ + BankAccountRef: &shared.UpdateExpenseRequestBankAccountReference{ + ID: syncforexpenses.String("97"), + }, + ContactRef: &shared.ExpenseContactRef{ + ID: "430", + Type: shared.TypeSupplier.ToPointer(), + }, + Currency: "GBP", + CurrencyRate: types.MustNewDecimalFromString("1"), + IssueDate: "2024-05-21T00:00:00+00:00", + Lines: []shared.ExpenseTransactionLine{ + + }, + MerchantName: syncforexpenses.String("Amazon UK"), + Notes: syncforexpenses.String("APPLE.COM/BILL - 09001077498 - Card Ending: 4590"), + Type: shared.UpdateExpenseRequestTypePayment, + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", TransactionID: "336694d8-2dca-4cb5-a28d-3ccb83e55eee", }) @@ -127,10 +155,12 @@ func main() { | `request` | [operations.UpdateExpenseTransactionRequest](../../pkg/models/operations/updateexpensetransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateExpenseTransactionResponse](../../pkg/models/operations/updateexpensetransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,422,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/managedata/README.md b/sync-for-expenses/docs/sdks/managedata/README.md index a7a7651d0..6ea90f5dd 100644 --- a/sync-for-expenses/docs/sdks/managedata/README.md +++ b/sync-for-expenses/docs/sdks/managedata/README.md @@ -3,7 +3,7 @@ ## Overview -Asynchronously retrieve data from an integration to refresh data in Codat. +Control and monitor the retrieval of data from an integration. ### Available Operations @@ -23,7 +23,6 @@ Get the state of each data type for a company package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -56,15 +55,18 @@ func main() { | `request` | [operations.GetDataStatusRequest](../../pkg/models/operations/getdatastatusrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetDataStatusResponse](../../pkg/models/operations/getdatastatusresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPullOperation Retrieve information about a single dataset or pull operation. @@ -75,7 +77,6 @@ Retrieve information about a single dataset or pull operation. package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -109,15 +110,18 @@ func main() { | `request` | [operations.GetPullOperationRequest](../../pkg/models/operations/getpulloperationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetPullOperationResponse](../../pkg/models/operations/getpulloperationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## ListPullOperations Gets the pull operation history (datasets) for a given company. @@ -128,7 +132,6 @@ Gets the pull operation history (datasets) for a given company. package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -146,6 +149,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -164,15 +168,18 @@ func main() { | `request` | [operations.ListPullOperationsRequest](../../pkg/models/operations/listpulloperationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListPullOperationsResponse](../../pkg/models/operations/listpulloperationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## RefreshAllDataTypes Refreshes all data types with `fetch on first link` set to `true` for a given company. @@ -187,7 +194,6 @@ This is an asynchronous operation, and will bring updated data into Codat from t package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -220,15 +226,18 @@ func main() { | `request` | [operations.RefreshAllDataTypesRequest](../../pkg/models/operations/refreshalldatatypesrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.RefreshAllDataTypesResponse](../../pkg/models/operations/refreshalldatatypesresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## RefreshDataType Refreshes a given data type for a given company. @@ -241,9 +250,9 @@ This is an asynchronous operation, and will bring updated data into Codat from t package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -275,10 +284,12 @@ func main() { | `request` | [operations.RefreshDataTypeRequest](../../pkg/models/operations/refreshdatatyperequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.RefreshDataTypeResponse](../../pkg/models/operations/refreshdatatyperesponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/mappingoptions/README.md b/sync-for-expenses/docs/sdks/mappingoptions/README.md new file mode 100644 index 000000000..18ce88dc0 --- /dev/null +++ b/sync-for-expenses/docs/sdks/mappingoptions/README.md @@ -0,0 +1,63 @@ +# MappingOptions +(*MappingOptions*) + +## Overview + +Get accounts, trackingCategories and taxRates that can be used in your create and update requests. + +### Available Operations + +* [GetMappingOptions](#getmappingoptions) - Mapping options + +## GetMappingOptions + +Gets the mapping options (accounts, trackingCategories and taxRates) for a company's accounting software + +### Example Usage + +```go +package main + +import( + syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" + "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "log" +) + +func main() { + s := syncforexpenses.New( + syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), + ) + + ctx := context.Background() + res, err := s.MappingOptions.GetMappingOptions(ctx, operations.GetMappingOptionsRequest{ + CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", + }) + if err != nil { + log.Fatal(err) + } + if res.MappingOptions != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetMappingOptionsRequest](../../pkg/models/operations/getmappingoptionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetMappingOptionsResponse](../../pkg/models/operations/getmappingoptionsresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------- | --------------------------- | --------------------------- | +| sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/sync-for-expenses/docs/sdks/pushoperations/README.md b/sync-for-expenses/docs/sdks/pushoperations/README.md index 9c4c2c38b..87f6a0fcf 100644 --- a/sync-for-expenses/docs/sdks/pushoperations/README.md +++ b/sync-for-expenses/docs/sdks/pushoperations/README.md @@ -3,7 +3,7 @@ ## Overview -Access create, update and delete operations made to an SMB's data connection. +View historic push operations. ### Available Operations @@ -20,7 +20,6 @@ Retrieve push operation. package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -54,15 +53,18 @@ func main() { | `request` | [operations.GetPushOperationRequest](../../pkg/models/operations/getpushoperationrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetPushOperationResponse](../../pkg/models/operations/getpushoperationresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List List push operation records. @@ -73,7 +75,6 @@ List push operation records. package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -91,6 +92,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -109,10 +111,12 @@ func main() { | `request` | [operations.ListPushOperationsRequest](../../pkg/models/operations/listpushoperationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListPushOperationsResponse](../../pkg/models/operations/listpushoperationsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/reimbursements/README.md b/sync-for-expenses/docs/sdks/reimbursements/README.md index 5c8860ff1..e0cc7ae54 100644 --- a/sync-for-expenses/docs/sdks/reimbursements/README.md +++ b/sync-for-expenses/docs/sdks/reimbursements/README.md @@ -3,7 +3,7 @@ ## Overview -Create reimbursable expense transactions. +Create and update transactions that represent your customers' repayable spend. ### Available Operations @@ -12,9 +12,17 @@ Create reimbursable expense transactions. ## Create -Use the *Create reimbursable expense* endpoint to create a [reimbursement request](https://docs.codat.io/sync-for-expenses-api#/schemas/Reimburseable-Expense-Transactions) in the accounting platform for a given company's connection. +Use the *Create reimbursable expense* endpoint to submit an employee expense claim in the accounting platform for a given company's connection. -Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. +[Reimbursable expense requests](https://docs.codat.io/sync-for-expenses-api#/schemas/ReimbursableExpenseTransactionRequest) are reflected in the accounting software in the form of **Bills** against an employee (who exists as a supplier in the accounting platform). + +### Supported Integrations +| Integration | Supported | +|-----------------------|-----------| +| FreeAgent | Yes | +| QuickBooks Desktop | Yes | +| QuickBooks Online | Yes | +| Oracle NetSuite | Yes | ### Example Usage @@ -22,9 +30,9 @@ Employee reimbursement requests are reflected in the accounting system in the fo package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -36,6 +44,9 @@ func main() { ctx := context.Background() res, err := s.Reimbursements.Create(ctx, operations.CreateReimbursableExpenseTransactionRequest{ + RequestBody: []shared.ReimbursableExpenseTransaction{ + + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", }) if err != nil { @@ -55,20 +66,31 @@ func main() { | `request` | [operations.CreateReimbursableExpenseTransactionRequest](../../pkg/models/operations/createreimbursableexpensetransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateReimbursableExpenseTransactionResponse](../../pkg/models/operations/createreimbursableexpensetransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Update -The *Update reimbursable expense* endpoint updates an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/operations/create-reimbursable-expense-transaction) in the accounting platform for a given company's connection. +The *Update reimbursable expense* endpoint updates an existing employee expense claim in the accounting platform for a given company's connection. + +Updating an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateReimbursableExpenseTransactionRequest) will update the existing **bill** against an employee (who exists as a supplier in the accounting software). -Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. +### Supported Integrations +| Integration | Supported | +|-----------------------|-----------| +| FreeAgent | Yes | +| QuickBooks Desktop | Yes | +| QuickBooks Online | Yes | +| Oracle NetSuite | Yes | ### Example Usage @@ -76,9 +98,10 @@ Employee reimbursement requests are reflected in the accounting system in the fo package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -90,6 +113,20 @@ func main() { ctx := context.Background() res, err := s.Reimbursements.Update(ctx, operations.UpdateReimbursableExpenseTransactionRequest{ + UpdateReimbursableExpenseTransactionRequest: &shared.UpdateReimbursableExpenseTransactionRequest{ + ContactRef: shared.ReimbursementContactRef{ + ID: "752", + }, + Currency: "GBP", + CurrencyRate: types.MustNewDecimalFromString("1"), + DueDate: "2024-05-21", + IssueDate: "2024-05-21", + Lines: []shared.ReimbursableExpenseTransactionLine{ + + }, + Notes: syncforexpenses.String("APPLE.COM/BILL - 09001077498 - Card Ending: 4590"), + Reference: syncforexpenses.String("expenses w/c 01/07"), + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", TransactionID: "336694d8-2dca-4cb5-a28d-3ccb83e55eee", }) @@ -110,10 +147,12 @@ func main() { | `request` | [operations.UpdateReimbursableExpenseTransactionRequest](../../pkg/models/operations/updatereimbursableexpensetransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateReimbursableExpenseTransactionResponse](../../pkg/models/operations/updatereimbursableexpensetransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/suppliers/README.md b/sync-for-expenses/docs/sdks/suppliers/README.md index 02a8cbdb8..062cc032e 100644 --- a/sync-for-expenses/docs/sdks/suppliers/README.md +++ b/sync-for-expenses/docs/sdks/suppliers/README.md @@ -3,7 +3,7 @@ ## Overview -Suppliers +Get, create, and update suppliers. ### Available Operations @@ -31,9 +31,9 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -46,42 +46,13 @@ func main() { ctx := context.Background() res, err := s.Suppliers.Create(ctx, operations.CreateSupplierRequest{ Supplier: &shared.Supplier{ - Addresses: []shared.Items{ - shared.Items{ - City: syncforexpenses.String("Bakersfield"), - Country: syncforexpenses.String("USA"), - Line1: syncforexpenses.String("Unit 51"), - Line2: syncforexpenses.String("Bakersfield Industrial Estate"), - Region: syncforexpenses.String("California"), - Type: shared.AccountingAddressTypeBilling, - }, - }, - ContactName: syncforexpenses.String("Kelly's Industrial Supplies"), - DefaultCurrency: syncforexpenses.String("string"), - EmailAddress: syncforexpenses.String("sales@kellysupplies.com"), - ID: syncforexpenses.String("C520FFD4-F6F6-4FC2-A6D2-5D7088B2B14F"), - Metadata: &shared.Metadata{ - IsDeleted: syncforexpenses.Bool(true), - }, + ContactName: syncforexpenses.String("Joe Bloggs"), + ID: syncforexpenses.String("73593"), ModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), - Phone: syncforexpenses.String("07999 999999"), - RegistrationNumber: syncforexpenses.String("string"), + Phone: syncforexpenses.String("(877) 492-8687"), SourceModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), - Status: shared.SupplierStatusUnknown, - SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "property1": map[string]interface{}{ - "property1": nil, - "property2": nil, - }, - "property2": map[string]interface{}{ - "property1": nil, - "property2": nil, - }, - }, - }, - SupplierName: syncforexpenses.String("Kelly's Industrial Supplies"), - TaxNumber: syncforexpenses.String("string"), + Status: shared.SupplierStatusActive, + SupplierName: syncforexpenses.String("test 20230420 1004"), }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", ConnectionID: "2e9d2c44-f675-40ba-8049-353bfcb5e171", @@ -103,15 +74,18 @@ func main() { | `request` | [operations.CreateSupplierRequest](../../pkg/models/operations/createsupplierrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateSupplierResponse](../../pkg/models/operations/createsupplierresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Get The *Get supplier* endpoint returns a single supplier for a given supplierId. @@ -129,7 +103,6 @@ Before using this endpoint, you must have [retrieved data for the company](https package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -163,15 +136,18 @@ func main() { | `request` | [operations.GetSupplierRequest](../../pkg/models/operations/getsupplierrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetSupplierResponse](../../pkg/models/operations/getsupplierresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List The *List suppliers* endpoint returns a list of [suppliers](https://docs.codat.io/sync-for-expenses-api#/schemas/Supplier) for a given company's connection. @@ -187,7 +163,6 @@ Before using this endpoint, you must have [retrieved data for the company](https package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -205,6 +180,7 @@ func main() { OrderBy: syncforexpenses.String("-modifiedDate"), Page: syncforexpenses.Int(1), PageSize: syncforexpenses.Int(100), + Query: syncforexpenses.String("id=e3334455-1aed-4e71-ab43-6bccf12092ee"), }) if err != nil { log.Fatal(err) @@ -223,15 +199,18 @@ func main() { | `request` | [operations.ListSuppliersRequest](../../pkg/models/operations/listsuppliersrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListSuppliersResponse](../../pkg/models/operations/listsuppliersresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ----------------------------------- | ----------------------------------- | ----------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,409,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## Update The *Update supplier* endpoint updates an existing [supplier](https://docs.codat.io/sync-for-expenses-api#/schemas/Supplier) for a given company's connection. @@ -251,9 +230,9 @@ Check out our [coverage explorer](https://knowledge.codat.io/supported-features/ package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -289,14 +268,14 @@ func main() { SourceModifiedDate: syncforexpenses.String("2022-10-23T00:00:00Z"), Status: shared.SupplierStatusUnknown, SupplementalData: &shared.SupplementalData{ - Content: map[string]map[string]interface{}{ - "property1": map[string]interface{}{ - "property1": nil, - "property2": nil, + Content: map[string]map[string]any{ + "property1": map[string]any{ + "property1": "", + "property2": "", }, - "property2": map[string]interface{}{ - "property1": nil, - "property2": nil, + "property2": map[string]any{ + "property1": "", + "property2": "", }, }, }, @@ -324,10 +303,12 @@ func main() { | `request` | [operations.UpdateSupplierRequest](../../pkg/models/operations/updatesupplierrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.UpdateSupplierResponse](../../pkg/models/operations/updatesupplierresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/sync/README.md b/sync-for-expenses/docs/sdks/sync/README.md index 649f145e7..0cb596619 100644 --- a/sync-for-expenses/docs/sdks/sync/README.md +++ b/sync-for-expenses/docs/sdks/sync/README.md @@ -3,14 +3,13 @@ ## Overview -Trigger and monitor expense syncs to accounting software. +Monitor the status of data syncs. ### Available Operations * [Get](#get) - Get sync status * [GetLastSuccessfulSync](#getlastsuccessfulsync) - Last successful sync * [GetLatestSync](#getlatestsync) - Latest sync status -* [InitiateSync](#initiatesync) - Initiate sync * [List](#list) - List sync statuses ## Get @@ -23,7 +22,6 @@ Get the sync status for a specified sync package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -57,15 +55,18 @@ func main() { | `request` | [operations.GetSyncByIDRequest](../../pkg/models/operations/getsyncbyidrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetSyncByIDResponse](../../pkg/models/operations/getsyncbyidresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetLastSuccessfulSync Gets the status of the last successful sync @@ -76,7 +77,6 @@ Gets the status of the last successful sync package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -109,15 +109,18 @@ func main() { | `request` | [operations.GetLastSuccessfulSyncRequest](../../pkg/models/operations/getlastsuccessfulsyncrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetLastSuccessfulSyncResponse](../../pkg/models/operations/getlastsuccessfulsyncresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetLatestSync Gets the latest sync status @@ -128,7 +131,6 @@ Gets the latest sync status package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -161,66 +163,17 @@ func main() { | `request` | [operations.GetLatestSyncRequest](../../pkg/models/operations/getlatestsyncrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetLatestSyncResponse](../../pkg/models/operations/getlatestsyncresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | -## InitiateSync - -Initiate sync of pending transactions. - -### Example Usage - -```go -package main - -import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" - syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" - "context" - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" - "log" -) - -func main() { - s := syncforexpenses.New( - syncforexpenses.WithSecurity("Basic BASE_64_ENCODED(API_KEY)"), - ) - - ctx := context.Background() - res, err := s.Sync.InitiateSync(ctx, operations.InitiateSyncRequest{ - CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", - }) - if err != nil { - log.Fatal(err) - } - if res.SyncInitiated != nil { - // handle response - } -} -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [operations.InitiateSyncRequest](../../pkg/models/operations/initiatesyncrequest.md) | :heavy_check_mark: | The request object to use for the request. | -| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - - -### Response - -**[*operations.InitiateSyncResponse](../../pkg/models/operations/initiatesyncresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.ErrorMessage | 400,401,402,403,404,422,429,500,503 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | ## List @@ -232,7 +185,6 @@ Gets a list of sync statuses package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -265,10 +217,12 @@ func main() { | `request` | [operations.ListSyncsRequest](../../pkg/models/operations/listsyncsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListSyncsResponse](../../pkg/models/operations/listsyncsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/transactionstatus/README.md b/sync-for-expenses/docs/sdks/transactionstatus/README.md index fa1dba4df..275cde85b 100644 --- a/sync-for-expenses/docs/sdks/transactionstatus/README.md +++ b/sync-for-expenses/docs/sdks/transactionstatus/README.md @@ -3,7 +3,7 @@ ## Overview -Retrieve the status of transactions within a sync. +Monitor the status of individual transactions in data syncs. ### Available Operations @@ -20,7 +20,6 @@ Gets the status of a transaction for a sync package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -55,15 +54,18 @@ func main() { | `request` | [operations.GetSyncTransactionRequest](../../pkg/models/operations/getsynctransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.GetSyncTransactionResponse](../../pkg/models/operations/getsynctransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------- | --------------------------- | --------------------------- | | sdkerrors.ErrorMessage | 401,402,403,404,429,500,503 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## List Gets the transactions and status for a sync @@ -74,7 +76,6 @@ Gets the transactions and status for a sync package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" @@ -110,10 +111,12 @@ func main() { | `request` | [operations.ListSyncTransactionsRequest](../../pkg/models/operations/listsynctransactionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.ListSyncTransactionsResponse](../../pkg/models/operations/listsynctransactionsresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/docs/sdks/transfers/README.md b/sync-for-expenses/docs/sdks/transfers/README.md index 9feaabeea..2d55d7cd9 100644 --- a/sync-for-expenses/docs/sdks/transfers/README.md +++ b/sync-for-expenses/docs/sdks/transfers/README.md @@ -3,7 +3,7 @@ ## Overview -Create transfer transactions. +Create and update transactions that represent the movement of your customers' money. ### Available Operations @@ -11,12 +11,19 @@ Create transfer transactions. ## Create -Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransaction) in the accounting platform for a given company's connection. +Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransactionRequest) in the accounting software for a given company's connection. Transfers record the movement of money between two bank accounts, or between a bank account and a nominal account. Use them to represent actions such as topping up a debit card account or a balance transfer to another credit card. The `from.amount` and `to.amount` fields are in the native currency of the account. - + +### Supported Integrations +| Integration | Supported | +|-----------------------|-----------| +| FreeAgent | Yes | +| QuickBooks Desktop | Yes | +| QuickBooks Online | Yes | +| Xero | Yes | ### Example Usage @@ -24,9 +31,10 @@ The `from.amount` and `to.amount` fields are in the native currency of the accou package main import( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" syncforexpenses "github.com/codatio/client-sdk-go/sync-for-expenses/v4" "context" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "log" ) @@ -38,13 +46,29 @@ func main() { ctx := context.Background() res, err := s.Transfers.Create(ctx, operations.CreateTransferTransactionRequest{ + TransferTransactionRequest: &shared.TransferTransactionRequest{ + Date: "2021-05-21T00:00:00+00:00", + Description: syncforexpenses.String("Sample transfer description"), + From: shared.From{ + AccountRef: shared.AccountReference{ + ID: "787dfb37-5707-4dc0-8a86-8d74e4cc78ea", + }, + Amount: types.MustNewDecimalFromString("100"), + }, + To: shared.To{ + AccountRef: shared.TransferTransactionRequestAccountReference{ + ID: "777dfb37-5506-3dc0-6g86-8d34z4cc78ea", + }, + Amount: types.MustNewDecimalFromString("100"), + }, + }, CompanyID: "8a210b68-6988-11ed-a1eb-0242ac120002", TransactionID: "336694d8-2dca-4cb5-a28d-3ccb83e55eee", }) if err != nil { log.Fatal(err) } - if res.CreateTransferResponse != nil { + if res.TransferTransactionResponse != nil { // handle response } } @@ -58,10 +82,12 @@ func main() { | `request` | [operations.CreateTransferTransactionRequest](../../pkg/models/operations/createtransfertransactionrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response **[*operations.CreateTransferTransactionResponse](../../pkg/models/operations/createtransfertransactionresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ------------------------------- | ------------------------------- | ------------------------------- | | sdkerrors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json | diff --git a/sync-for-expenses/expenses.go b/sync-for-expenses/expenses.go index 25a2fc619..1ea8884f5 100644 --- a/sync-for-expenses/expenses.go +++ b/sync-for-expenses/expenses.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Expenses - Create expense transactions. +// Expenses - Create and update transactions that represent your customers' spend. type Expenses struct { sdkConfiguration sdkConfiguration } @@ -28,20 +29,20 @@ func newExpenses(sdkConfig sdkConfiguration) *Expenses { } // Create expense transaction -// The *Create expense* endpoint creates an [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting platform for a given company's connection. +// The *Create expense* endpoint creates an [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting software for a given company's connection. // // [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. // -// **Integration-specific behaviour** +// ### Supported Integrations // -// Some accounting platforms support the option of pushing transactions to a draft state. This can be done by setting the postAsDraft property on the transaction to true. For platforms without this feature, the postAsDraft property should be ignored or set to false. -// -// | Integration | Draft State | Details | -// |-------------|-------------|--------------------------------------------------------------------------------------------------------------| -// | Dynamics 365 Business Central | Yes | Setting postAsDraft to true will push the transactions to a drafted state rather than posting directly to the ledger. For transactions in a draft state, they can then be approved and posted within the accounting platform. | -// | Quickbooks Online | No | - | -// | Xero | No | - | -// | NetSuite | No | - | +// | Integration | Supported | +// |-------------------------------|-----------| +// | Dynamics 365 Business Central | Yes | +// | FreeAgent | Yes | +// | QuickBooks Desktop | Yes | +// | QuickBooks Online | Yes | +// | Oracle NetSuite | Yes | +// | Xero | Yes | func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseTransactionRequest, opts ...operations.Option) (*operations.CreateExpenseTransactionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -53,6 +54,7 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -60,17 +62,29 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/data/expense-transactions", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/expense-transactions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateExpenseRequest", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -86,10 +100,11 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -97,33 +112,60 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -132,15 +174,19 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -150,17 +196,25 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateExpenseResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -168,6 +222,11 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT res.CreateExpenseResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -187,6 +246,11 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -194,27 +258,48 @@ func (s *Expenses) Create(ctx context.Context, request operations.CreateExpenseT return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Update expense transactions -// The *Update expense* endpoint updates an existing [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) in the accounting platform for a given company's connection. +// The *Update expense* endpoint updates an existing [expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateExpenseRequest) in the accounting software for a given company's connection. // -// [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/ExpenseTransaction) represent transactions made with a company debit or credit card. +// [Expense transactions](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateExpenseRequest) represent transactions made with a company debit or credit card. // -// **Integration-specific behaviour** -// -// At the moment you can update expenses only for Xero ([Payment](https://docs.codat.io/expenses/sync-process/expense-transactions#transaction-types) transaction type only). +// ### Supported Integrations +// The following integrations are supported for the [Payment](https://docs.codat.io/expenses/sync-process/expense-transactions#transaction-types) transaction `type` only: +// | Integration | Supported | +// |-----------------------|-----------| +// | FreeAgent | Yes | +// | QuickBooks Online | Yes | +// | Oracle NetSuite | Yes | +// | Xero | Yes | func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseTransactionRequest, opts ...operations.Option) (*operations.UpdateExpenseTransactionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -226,6 +311,7 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -233,6 +319,7 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/expense-transactions/{transactionId}", request, nil) if err != nil { @@ -244,6 +331,17 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -259,10 +357,11 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -270,33 +369,60 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -305,15 +431,19 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "422", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -323,17 +453,25 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 202: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.UpdateExpenseResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -341,6 +479,11 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT res.UpdateExpenseResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -362,6 +505,11 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -369,15 +517,31 @@ func (s *Expenses) Update(ctx context.Context, request operations.UpdateExpenseT return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/internal/hooks/hooks.go b/sync-for-expenses/internal/hooks/hooks.go index ee9718261..8ea491aeb 100644 --- a/sync-for-expenses/internal/hooks/hooks.go +++ b/sync-for-expenses/internal/hooks/hooks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package hooks diff --git a/sync-for-expenses/managedata.go b/sync-for-expenses/managedata.go index c92a60ba2..637a52a97 100644 --- a/sync-for-expenses/managedata.go +++ b/sync-for-expenses/managedata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// ManageData - Asynchronously retrieve data from an integration to refresh data in Codat. +// ManageData - Control and monitor the retrieval of data from an integration. type ManageData struct { sdkConfiguration sdkConfiguration } @@ -40,6 +41,7 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -47,12 +49,24 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/dataStatus", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -67,10 +81,11 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -78,33 +93,60 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -113,15 +155,19 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -131,24 +177,37 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out map[string]shared.DataStatus + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetDataStatusDataStatuses if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.DataStatuses = out + res.DataStatuses = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -166,6 +225,11 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -173,17 +237,33 @@ func (s *ManageData) Get(ctx context.Context, request operations.GetDataStatusRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetPullOperation - Get pull operation @@ -199,6 +279,7 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -206,12 +287,24 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/history/{datasetId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -226,10 +319,11 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -237,33 +331,60 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -272,15 +393,19 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -290,17 +415,25 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PullOperation if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -308,6 +441,11 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge res.PullOperation = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -325,6 +463,11 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -332,17 +475,33 @@ func (s *ManageData) GetPullOperation(ctx context.Context, request operations.Ge return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // ListPullOperations - List pull operations @@ -358,6 +517,7 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -365,12 +525,24 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/history", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -389,10 +561,11 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -400,33 +573,60 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -435,15 +635,19 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -453,17 +657,25 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PullOperations if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -471,6 +683,11 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. res.PullOperations = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -490,6 +707,11 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -497,17 +719,33 @@ func (s *ManageData) ListPullOperations(ctx context.Context, request operations. return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // RefreshAllDataTypes - Refresh all data @@ -527,6 +765,7 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -534,12 +773,24 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/all", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -554,10 +805,11 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -565,33 +817,60 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -600,15 +879,19 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -618,12 +901,15 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: @@ -642,6 +928,11 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -649,17 +940,33 @@ func (s *ManageData) RefreshAllDataTypes(ctx context.Context, request operations return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // RefreshDataType - Refresh data type @@ -677,6 +984,7 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -684,12 +992,24 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/queue/{dataType}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -708,10 +1028,11 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -719,33 +1040,60 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -754,15 +1102,19 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -772,17 +1124,25 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PullOperation if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -790,6 +1150,11 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref res.PullOperation = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -807,6 +1172,11 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -814,15 +1184,31 @@ func (s *ManageData) RefreshDataType(ctx context.Context, request operations.Ref return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/mappingoptions.go b/sync-for-expenses/mappingoptions.go new file mode 100644 index 000000000..0c721f9b3 --- /dev/null +++ b/sync-for-expenses/mappingoptions.go @@ -0,0 +1,267 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package syncforexpenses + +import ( + "bytes" + "context" + "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/internal/hooks" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "io" + "net/http" +) + +// MappingOptions - Get accounts, trackingCategories and taxRates that can be used in your create and update requests. +type MappingOptions struct { + sdkConfiguration sdkConfiguration +} + +func newMappingOptions(sdkConfig sdkConfiguration) *MappingOptions { + return &MappingOptions{ + sdkConfiguration: sdkConfig, + } +} + +// GetMappingOptions - Mapping options +// Gets the mapping options (accounts, trackingCategories and taxRates) for a company's accounting software +func (s *MappingOptions) GetMappingOptions(ctx context.Context, request operations.GetMappingOptionsRequest, opts ...operations.Option) (*operations.GetMappingOptionsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-mapping-options", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/mappingOptions", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ + InitialInterval: 500, + MaxInterval: 60000, + Exponent: 1.5, + MaxElapsedTime: 3600000, + }, + RetryConnectionErrors: true, + } + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetMappingOptionsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.MappingOptions + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.MappingOptions = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + fallthrough + case httpRes.StatusCode == 402: + fallthrough + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode == 429: + fallthrough + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode == 503: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ErrorMessage + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} diff --git a/sync-for-expenses/pkg/models/operations/createaccount.go b/sync-for-expenses/pkg/models/operations/createaccount.go index 071744a92..817ecfcb5 100644 --- a/sync-for-expenses/pkg/models/operations/createaccount.go +++ b/sync-for-expenses/pkg/models/operations/createaccount.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createadjustmenttransaction.go b/sync-for-expenses/pkg/models/operations/createadjustmenttransaction.go new file mode 100644 index 000000000..17735ae42 --- /dev/null +++ b/sync-for-expenses/pkg/models/operations/createadjustmenttransaction.go @@ -0,0 +1,67 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "net/http" +) + +type CreateAdjustmentTransactionRequest struct { + RequestBody []shared.AdjustmentTransactionRequest `request:"mediaType=application/json"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` +} + +func (o *CreateAdjustmentTransactionRequest) GetRequestBody() []shared.AdjustmentTransactionRequest { + if o == nil { + return nil + } + return o.RequestBody +} + +func (o *CreateAdjustmentTransactionRequest) GetCompanyID() string { + if o == nil { + return "" + } + return o.CompanyID +} + +type CreateAdjustmentTransactionResponse struct { + // OK + AdjustmentTransactionResponse *shared.AdjustmentTransactionResponse + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *CreateAdjustmentTransactionResponse) GetAdjustmentTransactionResponse() *shared.AdjustmentTransactionResponse { + if o == nil { + return nil + } + return o.AdjustmentTransactionResponse +} + +func (o *CreateAdjustmentTransactionResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateAdjustmentTransactionResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateAdjustmentTransactionResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/sync-for-expenses/pkg/models/operations/createbankaccount.go b/sync-for-expenses/pkg/models/operations/createbankaccount.go new file mode 100644 index 000000000..983def45b --- /dev/null +++ b/sync-for-expenses/pkg/models/operations/createbankaccount.go @@ -0,0 +1,106 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "net/http" +) + +type CreateBankAccountRequest struct { + BankAccount *shared.BankAccount `request:"mediaType=application/json"` + // Allow a sync upon push completion. + AllowSyncOnPushComplete *bool `default:"true" queryParam:"style=form,explode=true,name=allowSyncOnPushComplete"` + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. + ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` + // Time limit for the push operation to complete before it is timed out. + TimeoutInMinutes *int `queryParam:"style=form,explode=true,name=timeoutInMinutes"` +} + +func (c CreateBankAccountRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateBankAccountRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { + return err + } + return nil +} + +func (o *CreateBankAccountRequest) GetBankAccount() *shared.BankAccount { + if o == nil { + return nil + } + return o.BankAccount +} + +func (o *CreateBankAccountRequest) GetAllowSyncOnPushComplete() *bool { + if o == nil { + return nil + } + return o.AllowSyncOnPushComplete +} + +func (o *CreateBankAccountRequest) GetCompanyID() string { + if o == nil { + return "" + } + return o.CompanyID +} + +func (o *CreateBankAccountRequest) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +func (o *CreateBankAccountRequest) GetTimeoutInMinutes() *int { + if o == nil { + return nil + } + return o.TimeoutInMinutes +} + +type CreateBankAccountResponse struct { + // HTTP response content type for this operation + ContentType string + // Success + CreateBankAccountResponse *shared.CreateBankAccountResponse + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *CreateBankAccountResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *CreateBankAccountResponse) GetCreateBankAccountResponse() *shared.CreateBankAccountResponse { + if o == nil { + return nil + } + return o.CreateBankAccountResponse +} + +func (o *CreateBankAccountResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateBankAccountResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/sync-for-expenses/pkg/models/operations/createcompany.go b/sync-for-expenses/pkg/models/operations/createcompany.go index 05d3a60fe..0baea1edc 100644 --- a/sync-for-expenses/pkg/models/operations/createcompany.go +++ b/sync-for-expenses/pkg/models/operations/createcompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createconnection.go b/sync-for-expenses/pkg/models/operations/createconnection.go index 4a4d91992..ae46550a0 100644 --- a/sync-for-expenses/pkg/models/operations/createconnection.go +++ b/sync-for-expenses/pkg/models/operations/createconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createcustomer.go b/sync-for-expenses/pkg/models/operations/createcustomer.go index 3586c97ef..301c290d0 100644 --- a/sync-for-expenses/pkg/models/operations/createcustomer.go +++ b/sync-for-expenses/pkg/models/operations/createcustomer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createexpensetransaction.go b/sync-for-expenses/pkg/models/operations/createexpensetransaction.go index b49467527..1fc4ebb83 100644 --- a/sync-for-expenses/pkg/models/operations/createexpensetransaction.go +++ b/sync-for-expenses/pkg/models/operations/createexpensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,16 +8,16 @@ import ( ) type CreateExpenseTransactionRequest struct { - CreateExpenseRequest *shared.CreateExpenseRequest `request:"mediaType=application/json"` + RequestBody []shared.ExpenseTransaction `request:"mediaType=application/json"` // Unique identifier for a company. CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` } -func (o *CreateExpenseTransactionRequest) GetCreateExpenseRequest() *shared.CreateExpenseRequest { +func (o *CreateExpenseTransactionRequest) GetRequestBody() []shared.ExpenseTransaction { if o == nil { return nil } - return o.CreateExpenseRequest + return o.RequestBody } func (o *CreateExpenseTransactionRequest) GetCompanyID() string { diff --git a/sync-for-expenses/pkg/models/operations/createpartnerexpenseconnection.go b/sync-for-expenses/pkg/models/operations/createpartnerexpenseconnection.go index 3cbc7e36a..a5cf82a6f 100644 --- a/sync-for-expenses/pkg/models/operations/createpartnerexpenseconnection.go +++ b/sync-for-expenses/pkg/models/operations/createpartnerexpenseconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createreimbursableexpensetransaction.go b/sync-for-expenses/pkg/models/operations/createreimbursableexpensetransaction.go index 61505e9d7..966b073f2 100644 --- a/sync-for-expenses/pkg/models/operations/createreimbursableexpensetransaction.go +++ b/sync-for-expenses/pkg/models/operations/createreimbursableexpensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,16 +8,16 @@ import ( ) type CreateReimbursableExpenseTransactionRequest struct { - CreateReimbursableExpenseRequest *shared.CreateReimbursableExpenseRequest `request:"mediaType=application/json"` + RequestBody []shared.ReimbursableExpenseTransaction `request:"mediaType=application/json"` // Unique identifier for a company. CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` } -func (o *CreateReimbursableExpenseTransactionRequest) GetCreateReimbursableExpenseRequest() *shared.CreateReimbursableExpenseRequest { +func (o *CreateReimbursableExpenseTransactionRequest) GetRequestBody() []shared.ReimbursableExpenseTransaction { if o == nil { return nil } - return o.CreateReimbursableExpenseRequest + return o.RequestBody } func (o *CreateReimbursableExpenseTransactionRequest) GetCompanyID() string { diff --git a/sync-for-expenses/pkg/models/operations/createsupplier.go b/sync-for-expenses/pkg/models/operations/createsupplier.go index cfa6bb266..32b72c512 100644 --- a/sync-for-expenses/pkg/models/operations/createsupplier.go +++ b/sync-for-expenses/pkg/models/operations/createsupplier.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/createtransfertransaction.go b/sync-for-expenses/pkg/models/operations/createtransfertransaction.go index fdcae38ad..90dd20ba5 100644 --- a/sync-for-expenses/pkg/models/operations/createtransfertransaction.go +++ b/sync-for-expenses/pkg/models/operations/createtransfertransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,18 +8,18 @@ import ( ) type CreateTransferTransactionRequest struct { - CreateTransferRequest *shared.CreateTransferRequest `request:"mediaType=application/json"` + TransferTransactionRequest *shared.TransferTransactionRequest `request:"mediaType=application/json"` // Unique identifier for a company. CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` // The unique identifier for your SMB's transaction. TransactionID string `pathParam:"style=simple,explode=false,name=transactionId"` } -func (o *CreateTransferTransactionRequest) GetCreateTransferRequest() *shared.CreateTransferRequest { +func (o *CreateTransferTransactionRequest) GetTransferTransactionRequest() *shared.TransferTransactionRequest { if o == nil { return nil } - return o.CreateTransferRequest + return o.TransferTransactionRequest } func (o *CreateTransferTransactionRequest) GetCompanyID() string { @@ -39,12 +39,12 @@ func (o *CreateTransferTransactionRequest) GetTransactionID() string { type CreateTransferTransactionResponse struct { // HTTP response content type for this operation ContentType string - // OK - CreateTransferResponse *shared.CreateTransferResponse // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response + // OK + TransferTransactionResponse *shared.TransferTransactionResponse } func (o *CreateTransferTransactionResponse) GetContentType() string { @@ -54,13 +54,6 @@ func (o *CreateTransferTransactionResponse) GetContentType() string { return o.ContentType } -func (o *CreateTransferTransactionResponse) GetCreateTransferResponse() *shared.CreateTransferResponse { - if o == nil { - return nil - } - return o.CreateTransferResponse -} - func (o *CreateTransferTransactionResponse) GetStatusCode() int { if o == nil { return 0 @@ -74,3 +67,10 @@ func (o *CreateTransferTransactionResponse) GetRawResponse() *http.Response { } return o.RawResponse } + +func (o *CreateTransferTransactionResponse) GetTransferTransactionResponse() *shared.TransferTransactionResponse { + if o == nil { + return nil + } + return o.TransferTransactionResponse +} diff --git a/sync-for-expenses/pkg/models/operations/deletecompany.go b/sync-for-expenses/pkg/models/operations/deletecompany.go index 4fe14e7e9..e23526cf3 100644 --- a/sync-for-expenses/pkg/models/operations/deletecompany.go +++ b/sync-for-expenses/pkg/models/operations/deletecompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/deleteconnection.go b/sync-for-expenses/pkg/models/operations/deleteconnection.go index 6e5d2d358..c6574cf51 100644 --- a/sync-for-expenses/pkg/models/operations/deleteconnection.go +++ b/sync-for-expenses/pkg/models/operations/deleteconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getcompany.go b/sync-for-expenses/pkg/models/operations/getcompany.go index 9a540b298..185197d63 100644 --- a/sync-for-expenses/pkg/models/operations/getcompany.go +++ b/sync-for-expenses/pkg/models/operations/getcompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getcompanyconfiguration.go b/sync-for-expenses/pkg/models/operations/getcompanyconfiguration.go index 82be45701..5e634b3ff 100644 --- a/sync-for-expenses/pkg/models/operations/getcompanyconfiguration.go +++ b/sync-for-expenses/pkg/models/operations/getcompanyconfiguration.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getconnection.go b/sync-for-expenses/pkg/models/operations/getconnection.go index abc5a2295..e31ba633c 100644 --- a/sync-for-expenses/pkg/models/operations/getconnection.go +++ b/sync-for-expenses/pkg/models/operations/getconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getcreatebankaccountsmodel.go b/sync-for-expenses/pkg/models/operations/getcreatebankaccountsmodel.go new file mode 100644 index 000000000..9f813d67a --- /dev/null +++ b/sync-for-expenses/pkg/models/operations/getcreatebankaccountsmodel.go @@ -0,0 +1,68 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "net/http" +) + +type GetCreateBankAccountsModelRequest struct { + // Unique identifier for a company. + CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` + // Unique identifier for a connection. + ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` +} + +func (o *GetCreateBankAccountsModelRequest) GetCompanyID() string { + if o == nil { + return "" + } + return o.CompanyID +} + +func (o *GetCreateBankAccountsModelRequest) GetConnectionID() string { + if o == nil { + return "" + } + return o.ConnectionID +} + +type GetCreateBankAccountsModelResponse struct { + // HTTP response content type for this operation + ContentType string + // OK + PushOption *shared.PushOption + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *GetCreateBankAccountsModelResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetCreateBankAccountsModelResponse) GetPushOption() *shared.PushOption { + if o == nil { + return nil + } + return o.PushOption +} + +func (o *GetCreateBankAccountsModelResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetCreateBankAccountsModelResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/sync-for-expenses/pkg/models/operations/getcreatechartofaccountsmodel.go b/sync-for-expenses/pkg/models/operations/getcreatechartofaccountsmodel.go index e86c1069f..511156984 100644 --- a/sync-for-expenses/pkg/models/operations/getcreatechartofaccountsmodel.go +++ b/sync-for-expenses/pkg/models/operations/getcreatechartofaccountsmodel.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getcustomer.go b/sync-for-expenses/pkg/models/operations/getcustomer.go index 7217da248..cd6b8cc15 100644 --- a/sync-for-expenses/pkg/models/operations/getcustomer.go +++ b/sync-for-expenses/pkg/models/operations/getcustomer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getdatastatus.go b/sync-for-expenses/pkg/models/operations/getdatastatus.go index 996107048..099a77cc7 100644 --- a/sync-for-expenses/pkg/models/operations/getdatastatus.go +++ b/sync-for-expenses/pkg/models/operations/getdatastatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -19,11 +19,402 @@ func (o *GetDataStatusRequest) GetCompanyID() string { return o.CompanyID } +// GetDataStatusDataStatuses - OK +type GetDataStatusDataStatuses struct { + // Describes the state of data in the Codat cache for a company and data type + AccountTransactions *shared.DataStatus `json:"accountTransactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BalanceSheet *shared.DataStatus `json:"balanceSheet,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankAccounts *shared.DataStatus `json:"bankAccounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankTransactions *shared.DataStatus `json:"bankTransactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingAccountBalances *shared.DataStatus `json:"banking-accountBalances,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingAccounts *shared.DataStatus `json:"banking-accounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingTransactionCategories *shared.DataStatus `json:"banking-transactionCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BankingTransactions *shared.DataStatus `json:"banking-transactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BillCreditNotes *shared.DataStatus `json:"billCreditNotes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + BillPayments *shared.DataStatus `json:"billPayments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Bills *shared.DataStatus `json:"bills,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CashFlowStatement *shared.DataStatus `json:"cashFlowStatement,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ChartOfAccounts *shared.DataStatus `json:"chartOfAccounts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceCompanyInfo *shared.DataStatus `json:"commerce-companyInfo,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceCustomers *shared.DataStatus `json:"commerce-customers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceDisputes *shared.DataStatus `json:"commerce-disputes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceLocations *shared.DataStatus `json:"commerce-locations,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceOrders *shared.DataStatus `json:"commerce-orders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommercePaymentMethods *shared.DataStatus `json:"commerce-paymentMethods,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommercePayments *shared.DataStatus `json:"commerce-payments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceProductCategories *shared.DataStatus `json:"commerce-productCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceProducts *shared.DataStatus `json:"commerce-products,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceTaxComponents *shared.DataStatus `json:"commerce-taxComponents,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CommerceTransactions *shared.DataStatus `json:"commerce-transactions,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Company *shared.DataStatus `json:"company,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + CreditNotes *shared.DataStatus `json:"creditNotes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Customers *shared.DataStatus `json:"customers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + DirectCosts *shared.DataStatus `json:"directCosts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + DirectIncomes *shared.DataStatus `json:"directIncomes,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Invoices *shared.DataStatus `json:"invoices,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ItemReceipts *shared.DataStatus `json:"itemReceipts,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Items *shared.DataStatus `json:"items,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + JournalEntries *shared.DataStatus `json:"journalEntries,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Journals *shared.DataStatus `json:"journals,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + PaymentMethods *shared.DataStatus `json:"paymentMethods,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Payments *shared.DataStatus `json:"payments,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + ProfitAndLoss *shared.DataStatus `json:"profitAndLoss,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + PurchaseOrders *shared.DataStatus `json:"purchaseOrders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + SalesOrders *shared.DataStatus `json:"salesOrders,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Suppliers *shared.DataStatus `json:"suppliers,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + TaxRates *shared.DataStatus `json:"taxRates,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + TrackingCategories *shared.DataStatus `json:"trackingCategories,omitempty"` + // Describes the state of data in the Codat cache for a company and data type + Transfers *shared.DataStatus `json:"transfers,omitempty"` +} + +func (o *GetDataStatusDataStatuses) GetAccountTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.AccountTransactions +} + +func (o *GetDataStatusDataStatuses) GetBalanceSheet() *shared.DataStatus { + if o == nil { + return nil + } + return o.BalanceSheet +} + +func (o *GetDataStatusDataStatuses) GetBankAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankAccounts +} + +func (o *GetDataStatusDataStatuses) GetBankTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankTransactions +} + +func (o *GetDataStatusDataStatuses) GetBankingAccountBalances() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccountBalances +} + +func (o *GetDataStatusDataStatuses) GetBankingAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingAccounts +} + +func (o *GetDataStatusDataStatuses) GetBankingTransactionCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactionCategories +} + +func (o *GetDataStatusDataStatuses) GetBankingTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.BankingTransactions +} + +func (o *GetDataStatusDataStatuses) GetBillCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillCreditNotes +} + +func (o *GetDataStatusDataStatuses) GetBillPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.BillPayments +} + +func (o *GetDataStatusDataStatuses) GetBills() *shared.DataStatus { + if o == nil { + return nil + } + return o.Bills +} + +func (o *GetDataStatusDataStatuses) GetCashFlowStatement() *shared.DataStatus { + if o == nil { + return nil + } + return o.CashFlowStatement +} + +func (o *GetDataStatusDataStatuses) GetChartOfAccounts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ChartOfAccounts +} + +func (o *GetDataStatusDataStatuses) GetCommerceCompanyInfo() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCompanyInfo +} + +func (o *GetDataStatusDataStatuses) GetCommerceCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceCustomers +} + +func (o *GetDataStatusDataStatuses) GetCommerceDisputes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceDisputes +} + +func (o *GetDataStatusDataStatuses) GetCommerceLocations() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceLocations +} + +func (o *GetDataStatusDataStatuses) GetCommerceOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceOrders +} + +func (o *GetDataStatusDataStatuses) GetCommercePaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePaymentMethods +} + +func (o *GetDataStatusDataStatuses) GetCommercePayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommercePayments +} + +func (o *GetDataStatusDataStatuses) GetCommerceProductCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProductCategories +} + +func (o *GetDataStatusDataStatuses) GetCommerceProducts() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceProducts +} + +func (o *GetDataStatusDataStatuses) GetCommerceTaxComponents() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTaxComponents +} + +func (o *GetDataStatusDataStatuses) GetCommerceTransactions() *shared.DataStatus { + if o == nil { + return nil + } + return o.CommerceTransactions +} + +func (o *GetDataStatusDataStatuses) GetCompany() *shared.DataStatus { + if o == nil { + return nil + } + return o.Company +} + +func (o *GetDataStatusDataStatuses) GetCreditNotes() *shared.DataStatus { + if o == nil { + return nil + } + return o.CreditNotes +} + +func (o *GetDataStatusDataStatuses) GetCustomers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Customers +} + +func (o *GetDataStatusDataStatuses) GetDirectCosts() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectCosts +} + +func (o *GetDataStatusDataStatuses) GetDirectIncomes() *shared.DataStatus { + if o == nil { + return nil + } + return o.DirectIncomes +} + +func (o *GetDataStatusDataStatuses) GetInvoices() *shared.DataStatus { + if o == nil { + return nil + } + return o.Invoices +} + +func (o *GetDataStatusDataStatuses) GetItemReceipts() *shared.DataStatus { + if o == nil { + return nil + } + return o.ItemReceipts +} + +func (o *GetDataStatusDataStatuses) GetItems() *shared.DataStatus { + if o == nil { + return nil + } + return o.Items +} + +func (o *GetDataStatusDataStatuses) GetJournalEntries() *shared.DataStatus { + if o == nil { + return nil + } + return o.JournalEntries +} + +func (o *GetDataStatusDataStatuses) GetJournals() *shared.DataStatus { + if o == nil { + return nil + } + return o.Journals +} + +func (o *GetDataStatusDataStatuses) GetPaymentMethods() *shared.DataStatus { + if o == nil { + return nil + } + return o.PaymentMethods +} + +func (o *GetDataStatusDataStatuses) GetPayments() *shared.DataStatus { + if o == nil { + return nil + } + return o.Payments +} + +func (o *GetDataStatusDataStatuses) GetProfitAndLoss() *shared.DataStatus { + if o == nil { + return nil + } + return o.ProfitAndLoss +} + +func (o *GetDataStatusDataStatuses) GetPurchaseOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.PurchaseOrders +} + +func (o *GetDataStatusDataStatuses) GetSalesOrders() *shared.DataStatus { + if o == nil { + return nil + } + return o.SalesOrders +} + +func (o *GetDataStatusDataStatuses) GetSuppliers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Suppliers +} + +func (o *GetDataStatusDataStatuses) GetTaxRates() *shared.DataStatus { + if o == nil { + return nil + } + return o.TaxRates +} + +func (o *GetDataStatusDataStatuses) GetTrackingCategories() *shared.DataStatus { + if o == nil { + return nil + } + return o.TrackingCategories +} + +func (o *GetDataStatusDataStatuses) GetTransfers() *shared.DataStatus { + if o == nil { + return nil + } + return o.Transfers +} + type GetDataStatusResponse struct { // HTTP response content type for this operation ContentType string // OK - DataStatuses map[string]shared.DataStatus + DataStatuses *GetDataStatusDataStatuses // HTTP response status code for this operation StatusCode int // Raw HTTP response; suitable for custom response parsing @@ -37,7 +428,7 @@ func (o *GetDataStatusResponse) GetContentType() string { return o.ContentType } -func (o *GetDataStatusResponse) GetDataStatuses() map[string]shared.DataStatus { +func (o *GetDataStatusResponse) GetDataStatuses() *GetDataStatusDataStatuses { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/operations/getlastsuccessfulsync.go b/sync-for-expenses/pkg/models/operations/getlastsuccessfulsync.go index 7d9a846f5..bfce0e48e 100644 --- a/sync-for-expenses/pkg/models/operations/getlastsuccessfulsync.go +++ b/sync-for-expenses/pkg/models/operations/getlastsuccessfulsync.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getlatestsync.go b/sync-for-expenses/pkg/models/operations/getlatestsync.go index 77002b2e9..2b12b2399 100644 --- a/sync-for-expenses/pkg/models/operations/getlatestsync.go +++ b/sync-for-expenses/pkg/models/operations/getlatestsync.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getmappingoptions.go b/sync-for-expenses/pkg/models/operations/getmappingoptions.go index 63684011f..658b83317 100644 --- a/sync-for-expenses/pkg/models/operations/getmappingoptions.go +++ b/sync-for-expenses/pkg/models/operations/getmappingoptions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getpulloperation.go b/sync-for-expenses/pkg/models/operations/getpulloperation.go index 5f4bedacc..58148ca5c 100644 --- a/sync-for-expenses/pkg/models/operations/getpulloperation.go +++ b/sync-for-expenses/pkg/models/operations/getpulloperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getpushoperation.go b/sync-for-expenses/pkg/models/operations/getpushoperation.go index 90960b7c7..9783d6fc2 100644 --- a/sync-for-expenses/pkg/models/operations/getpushoperation.go +++ b/sync-for-expenses/pkg/models/operations/getpushoperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getsupplier.go b/sync-for-expenses/pkg/models/operations/getsupplier.go index c2a7af27b..d02bb213e 100644 --- a/sync-for-expenses/pkg/models/operations/getsupplier.go +++ b/sync-for-expenses/pkg/models/operations/getsupplier.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getsyncbyid.go b/sync-for-expenses/pkg/models/operations/getsyncbyid.go index 4d7e6404c..81931d0bb 100644 --- a/sync-for-expenses/pkg/models/operations/getsyncbyid.go +++ b/sync-for-expenses/pkg/models/operations/getsyncbyid.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/getsynctransaction.go b/sync-for-expenses/pkg/models/operations/getsynctransaction.go index a6753e1c5..95aa41fce 100644 --- a/sync-for-expenses/pkg/models/operations/getsynctransaction.go +++ b/sync-for-expenses/pkg/models/operations/getsynctransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/initiatesync.go b/sync-for-expenses/pkg/models/operations/initiatesync.go deleted file mode 100644 index ed538196f..000000000 --- a/sync-for-expenses/pkg/models/operations/initiatesync.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package operations - -import ( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" - "net/http" -) - -type InitiateSyncRequest struct { - InitiateSync *shared.InitiateSync `request:"mediaType=application/json"` - // Unique identifier for a company. - CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` -} - -func (o *InitiateSyncRequest) GetInitiateSync() *shared.InitiateSync { - if o == nil { - return nil - } - return o.InitiateSync -} - -func (o *InitiateSyncRequest) GetCompanyID() string { - if o == nil { - return "" - } - return o.CompanyID -} - -type InitiateSyncResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Returns the newly created syncId - SyncInitiated *shared.SyncInitiated -} - -func (o *InitiateSyncResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *InitiateSyncResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *InitiateSyncResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *InitiateSyncResponse) GetSyncInitiated() *shared.SyncInitiated { - if o == nil { - return nil - } - return o.SyncInitiated -} diff --git a/sync-for-expenses/pkg/models/operations/listcompanies.go b/sync-for-expenses/pkg/models/operations/listcompanies.go index 8d4f479b9..8b9844109 100644 --- a/sync-for-expenses/pkg/models/operations/listcompanies.go +++ b/sync-for-expenses/pkg/models/operations/listcompanies.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listconnections.go b/sync-for-expenses/pkg/models/operations/listconnections.go index d1108489f..5bef4ba87 100644 --- a/sync-for-expenses/pkg/models/operations/listconnections.go +++ b/sync-for-expenses/pkg/models/operations/listconnections.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listcustomers.go b/sync-for-expenses/pkg/models/operations/listcustomers.go index 59a4679ef..7ccaf0aa0 100644 --- a/sync-for-expenses/pkg/models/operations/listcustomers.go +++ b/sync-for-expenses/pkg/models/operations/listcustomers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listpulloperations.go b/sync-for-expenses/pkg/models/operations/listpulloperations.go index 2a759ed2f..8af48c605 100644 --- a/sync-for-expenses/pkg/models/operations/listpulloperations.go +++ b/sync-for-expenses/pkg/models/operations/listpulloperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listpushoperations.go b/sync-for-expenses/pkg/models/operations/listpushoperations.go index a6ac6ab43..8291c70a5 100644 --- a/sync-for-expenses/pkg/models/operations/listpushoperations.go +++ b/sync-for-expenses/pkg/models/operations/listpushoperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listsuppliers.go b/sync-for-expenses/pkg/models/operations/listsuppliers.go index 4d392d93a..3cca8bf13 100644 --- a/sync-for-expenses/pkg/models/operations/listsuppliers.go +++ b/sync-for-expenses/pkg/models/operations/listsuppliers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listsyncs.go b/sync-for-expenses/pkg/models/operations/listsyncs.go index 71cdbc763..5dbb5fb7c 100644 --- a/sync-for-expenses/pkg/models/operations/listsyncs.go +++ b/sync-for-expenses/pkg/models/operations/listsyncs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/listsynctransactions.go b/sync-for-expenses/pkg/models/operations/listsynctransactions.go index ba6174ea3..d98e28e6e 100644 --- a/sync-for-expenses/pkg/models/operations/listsynctransactions.go +++ b/sync-for-expenses/pkg/models/operations/listsynctransactions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/options.go b/sync-for-expenses/pkg/models/operations/options.go index 391d389b8..0d5d6cce6 100644 --- a/sync-for-expenses/pkg/models/operations/options.go +++ b/sync-for-expenses/pkg/models/operations/options.go @@ -1,10 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( "errors" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "time" ) var ErrUnsupportedOption = errors.New("unsupported option") @@ -12,12 +14,16 @@ var ErrUnsupportedOption = errors.New("unsupported option") const ( SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" + SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" + SupportedOptionURLOverride = "urlOverride" ) type Options struct { - ServerURL *string - Retries *utils.RetryConfig + ServerURL *string + Retries *retry.Config + Timeout *time.Duration + URLOverride *string } type Option func(*Options, ...string) error @@ -51,7 +57,7 @@ func WithTemplatedServerURL(serverURL string, params map[string]string) Option { } // WithRetries allows customizing the default retry configuration. -func WithRetries(config utils.RetryConfig) Option { +func WithRetries(config retry.Config) Option { return func(opts *Options, supportedOptions ...string) error { if !utils.Contains(supportedOptions, SupportedOptionRetries) { return ErrUnsupportedOption @@ -61,3 +67,27 @@ func WithRetries(config utils.RetryConfig) Option { return nil } } + +// WithOperationTimeout allows setting the request timeout applied for an operation. +func WithOperationTimeout(timeout time.Duration) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Timeout = &timeout + return nil + } +} + +// WithURLOverride allows overriding the URL. +func WithURLOverride(urlOverride string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionURLOverride) { + return ErrUnsupportedOption + } + + opts.URLOverride = &urlOverride + return nil + } +} diff --git a/sync-for-expenses/pkg/models/operations/refreshalldatatypes.go b/sync-for-expenses/pkg/models/operations/refreshalldatatypes.go index e63b26c41..187709751 100644 --- a/sync-for-expenses/pkg/models/operations/refreshalldatatypes.go +++ b/sync-for-expenses/pkg/models/operations/refreshalldatatypes.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/refreshdatatype.go b/sync-for-expenses/pkg/models/operations/refreshdatatype.go index a5147a493..50c8e8467 100644 --- a/sync-for-expenses/pkg/models/operations/refreshdatatype.go +++ b/sync-for-expenses/pkg/models/operations/refreshdatatype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/setcompanyconfiguration.go b/sync-for-expenses/pkg/models/operations/setcompanyconfiguration.go index d306d854e..716165c9a 100644 --- a/sync-for-expenses/pkg/models/operations/setcompanyconfiguration.go +++ b/sync-for-expenses/pkg/models/operations/setcompanyconfiguration.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/unlinkconnection.go b/sync-for-expenses/pkg/models/operations/unlinkconnection.go index 407ff4252..c523bbaa5 100644 --- a/sync-for-expenses/pkg/models/operations/unlinkconnection.go +++ b/sync-for-expenses/pkg/models/operations/unlinkconnection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/updatecompany.go b/sync-for-expenses/pkg/models/operations/updatecompany.go index d7d5bb852..673747360 100644 --- a/sync-for-expenses/pkg/models/operations/updatecompany.go +++ b/sync-for-expenses/pkg/models/operations/updatecompany.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/updatecustomer.go b/sync-for-expenses/pkg/models/operations/updatecustomer.go index 45a9abc7a..dd977e7bd 100644 --- a/sync-for-expenses/pkg/models/operations/updatecustomer.go +++ b/sync-for-expenses/pkg/models/operations/updatecustomer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -18,7 +18,7 @@ type UpdateCustomerRequest struct { ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` // Unique identifier for a customer. CustomerID string `pathParam:"style=simple,explode=false,name=customerId"` - // When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. + // When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting software, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. ForceUpdate *bool `default:"false" queryParam:"style=form,explode=true,name=forceUpdate"` // Time limit for the push operation to complete before it is timed out. TimeoutInMinutes *int `queryParam:"style=form,explode=true,name=timeoutInMinutes"` diff --git a/sync-for-expenses/pkg/models/operations/updateexpensetransaction.go b/sync-for-expenses/pkg/models/operations/updateexpensetransaction.go index f250dc0a0..11810dad3 100644 --- a/sync-for-expenses/pkg/models/operations/updateexpensetransaction.go +++ b/sync-for-expenses/pkg/models/operations/updateexpensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/operations/updatereimbursableexpensetransaction.go b/sync-for-expenses/pkg/models/operations/updatereimbursableexpensetransaction.go index 01ddb6f31..961f448ae 100644 --- a/sync-for-expenses/pkg/models/operations/updatereimbursableexpensetransaction.go +++ b/sync-for-expenses/pkg/models/operations/updatereimbursableexpensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,18 +8,18 @@ import ( ) type UpdateReimbursableExpenseTransactionRequest struct { - CreateReimbursableExpenseRequest *shared.CreateReimbursableExpenseRequest `request:"mediaType=application/json"` + UpdateReimbursableExpenseTransactionRequest *shared.UpdateReimbursableExpenseTransactionRequest `request:"mediaType=application/json"` // Unique identifier for a company. CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` // The unique identifier for your SMB's transaction. TransactionID string `pathParam:"style=simple,explode=false,name=transactionId"` } -func (o *UpdateReimbursableExpenseTransactionRequest) GetCreateReimbursableExpenseRequest() *shared.CreateReimbursableExpenseRequest { +func (o *UpdateReimbursableExpenseTransactionRequest) GetUpdateReimbursableExpenseTransactionRequest() *shared.UpdateReimbursableExpenseTransactionRequest { if o == nil { return nil } - return o.CreateReimbursableExpenseRequest + return o.UpdateReimbursableExpenseTransactionRequest } func (o *UpdateReimbursableExpenseTransactionRequest) GetCompanyID() string { diff --git a/sync-for-expenses/pkg/models/operations/updatesupplier.go b/sync-for-expenses/pkg/models/operations/updatesupplier.go index 6a559a72c..bbcba719b 100644 --- a/sync-for-expenses/pkg/models/operations/updatesupplier.go +++ b/sync-for-expenses/pkg/models/operations/updatesupplier.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -16,7 +16,7 @@ type UpdateSupplierRequest struct { CompanyID string `pathParam:"style=simple,explode=false,name=companyId"` // Unique identifier for a connection. ConnectionID string `pathParam:"style=simple,explode=false,name=connectionId"` - // When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting platform, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. + // When updating data in the destination platform Codat checks the `sourceModifiedDate` against the `lastupdated` date from the accounting software, if they're different Codat will return an error suggesting you should initiate another pull of the data. If this is set to `true` then the update will override this check. ForceUpdate *bool `default:"false" queryParam:"style=form,explode=true,name=forceUpdate"` // Unique identifier for a supplier. SupplierID string `pathParam:"style=simple,explode=false,name=supplierId"` diff --git a/sync-for-expenses/pkg/models/operations/uploadexpenseattachment.go b/sync-for-expenses/pkg/models/operations/uploadexpenseattachment.go index eaa9227e6..8375da0f0 100644 --- a/sync-for-expenses/pkg/models/operations/uploadexpenseattachment.go +++ b/sync-for-expenses/pkg/models/operations/uploadexpenseattachment.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/sync-for-expenses/pkg/models/sdkerrors/errormessage.go b/sync-for-expenses/pkg/models/sdkerrors/errormessage.go index 520a2c4d4..3a499f8ff 100644 --- a/sync-for-expenses/pkg/models/sdkerrors/errormessage.go +++ b/sync-for-expenses/pkg/models/sdkerrors/errormessage.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors diff --git a/sync-for-expenses/pkg/models/sdkerrors/sdkerror.go b/sync-for-expenses/pkg/models/sdkerrors/sdkerror.go index 5c1affd31..7d63b9813 100644 --- a/sync-for-expenses/pkg/models/sdkerrors/sdkerror.go +++ b/sync-for-expenses/pkg/models/sdkerrors/sdkerror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors diff --git a/sync-for-expenses/pkg/models/shared/accountingaddresstype.go b/sync-for-expenses/pkg/models/shared/accountingaddresstype.go index c98699efe..a0c620b32 100644 --- a/sync-for-expenses/pkg/models/shared/accountingaddresstype.go +++ b/sync-for-expenses/pkg/models/shared/accountingaddresstype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -19,7 +19,6 @@ const ( func (e AccountingAddressType) ToPointer() *AccountingAddressType { return &e } - func (e *AccountingAddressType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/accountmappinginfo.go b/sync-for-expenses/pkg/models/shared/accountmappinginfo.go index 6b3702b8b..47454a292 100644 --- a/sync-for-expenses/pkg/models/shared/accountmappinginfo.go +++ b/sync-for-expenses/pkg/models/shared/accountmappinginfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e AccountMappingInfoAccountType) ToPointer() *AccountMappingInfoAccountType { return &e } - func (e *AccountMappingInfoAccountType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -44,60 +43,21 @@ func (e *AccountMappingInfoAccountType) UnmarshalJSON(data []byte) error { } } -type ValidTransactionTypes string - -const ( - ValidTransactionTypesPayment ValidTransactionTypes = "Payment" - ValidTransactionTypesRefund ValidTransactionTypes = "Refund" - ValidTransactionTypesReward ValidTransactionTypes = "Reward" - ValidTransactionTypesChargeback ValidTransactionTypes = "Chargeback" - ValidTransactionTypesTransferIn ValidTransactionTypes = "TransferIn" - ValidTransactionTypesTransferOut ValidTransactionTypes = "TransferOut" - ValidTransactionTypesAdjustmentIn ValidTransactionTypes = "AdjustmentIn" - ValidTransactionTypesAdjustmentOut ValidTransactionTypes = "AdjustmentOut" -) - -func (e ValidTransactionTypes) ToPointer() *ValidTransactionTypes { - return &e -} - -func (e *ValidTransactionTypes) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Payment": - fallthrough - case "Refund": - fallthrough - case "Reward": - fallthrough - case "Chargeback": - fallthrough - case "TransferIn": - fallthrough - case "TransferOut": - fallthrough - case "AdjustmentIn": - fallthrough - case "AdjustmentOut": - *e = ValidTransactionTypes(v) - return nil - default: - return fmt.Errorf("invalid value for ValidTransactionTypes: %v", v) - } -} - type AccountMappingInfo struct { // Type of the account. AccountType *AccountMappingInfoAccountType `json:"accountType,omitempty"` // Currency of the account. Currency *string `json:"currency,omitempty"` + // Full account type and category of the account + FullyQualifiedCategory *string `json:"fullyQualifiedCategory,omitempty"` // Unique identifier of account. ID *string `json:"id,omitempty"` - // Name of the account as it appears in the companies accounting software. + // Confirms whether the account is a bank account or not. + IsBankAccount *bool `json:"isBankAccount,omitempty"` + // Name of the account as it appears in the company's accounting software. Name *string `json:"name,omitempty"` + // Code used to identify each nominal account in the accounting software. + NominalCode *string `json:"nominalCode,omitempty"` // Supported transaction types for the account. ValidTransactionTypes []ValidTransactionTypes `json:"validTransactionTypes,omitempty"` } @@ -116,6 +76,13 @@ func (o *AccountMappingInfo) GetCurrency() *string { return o.Currency } +func (o *AccountMappingInfo) GetFullyQualifiedCategory() *string { + if o == nil { + return nil + } + return o.FullyQualifiedCategory +} + func (o *AccountMappingInfo) GetID() *string { if o == nil { return nil @@ -123,6 +90,13 @@ func (o *AccountMappingInfo) GetID() *string { return o.ID } +func (o *AccountMappingInfo) GetIsBankAccount() *bool { + if o == nil { + return nil + } + return o.IsBankAccount +} + func (o *AccountMappingInfo) GetName() *string { if o == nil { return nil @@ -130,6 +104,13 @@ func (o *AccountMappingInfo) GetName() *string { return o.Name } +func (o *AccountMappingInfo) GetNominalCode() *string { + if o == nil { + return nil + } + return o.NominalCode +} + func (o *AccountMappingInfo) GetValidTransactionTypes() []ValidTransactionTypes { if o == nil { return nil diff --git a/sync-for-expenses/pkg/models/shared/accountprototype.go b/sync-for-expenses/pkg/models/shared/accountprototype.go index c8e37fc36..2ccfe6b13 100644 --- a/sync-for-expenses/pkg/models/shared/accountprototype.go +++ b/sync-for-expenses/pkg/models/shared/accountprototype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -100,7 +100,7 @@ type AccountPrototype struct { Status *AccountStatus `json:"status,omitempty"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Type of account Type *AccountType `json:"type,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/accountref.go b/sync-for-expenses/pkg/models/shared/accountref.go deleted file mode 100644 index a62aae1ef..000000000 --- a/sync-for-expenses/pkg/models/shared/accountref.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -// AccountRef - Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. -type AccountRef struct { - // 'id' from the Accounts data type. - ID *string `json:"id,omitempty"` - // 'name' from the Accounts data type. - Name *string `json:"name,omitempty"` -} - -func (o *AccountRef) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - -func (o *AccountRef) GetName() *string { - if o == nil { - return nil - } - return o.Name -} diff --git a/sync-for-expenses/pkg/models/shared/accountstatus.go b/sync-for-expenses/pkg/models/shared/accountstatus.go index 17493901b..c86b01e74 100644 --- a/sync-for-expenses/pkg/models/shared/accountstatus.go +++ b/sync-for-expenses/pkg/models/shared/accountstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e AccountStatus) ToPointer() *AccountStatus { return &e } - func (e *AccountStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/accounttype.go b/sync-for-expenses/pkg/models/shared/accounttype.go index 771c270b3..95bc921a7 100644 --- a/sync-for-expenses/pkg/models/shared/accounttype.go +++ b/sync-for-expenses/pkg/models/shared/accounttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -22,7 +22,6 @@ const ( func (e AccountType) ToPointer() *AccountType { return &e } - func (e *AccountType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/adjustmenttransactionline.go b/sync-for-expenses/pkg/models/shared/adjustmenttransactionline.go new file mode 100644 index 000000000..966589ab9 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/adjustmenttransactionline.go @@ -0,0 +1,65 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +type AdjustmentTransactionLine struct { + AccountRef RecordRef `json:"accountRef"` + // Amount of the line. A positive line represents a debit; a negative line represents a credit. + Amount *decimal.Big `decimal:"number" json:"amount"` + // Any private, company notes about the transaction. + Description *string `json:"description,omitempty"` + // Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. + InvoiceTo *InvoiceTo `json:"invoiceTo,omitempty"` + TrackingRefs []TrackingRefAdjustmentTransaction `json:"trackingRefs,omitempty"` +} + +func (a AdjustmentTransactionLine) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AdjustmentTransactionLine) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AdjustmentTransactionLine) GetAccountRef() RecordRef { + if o == nil { + return RecordRef{} + } + return o.AccountRef +} + +func (o *AdjustmentTransactionLine) GetAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.Amount +} + +func (o *AdjustmentTransactionLine) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *AdjustmentTransactionLine) GetInvoiceTo() *InvoiceTo { + if o == nil { + return nil + } + return o.InvoiceTo +} + +func (o *AdjustmentTransactionLine) GetTrackingRefs() []TrackingRefAdjustmentTransaction { + if o == nil { + return nil + } + return o.TrackingRefs +} diff --git a/sync-for-expenses/pkg/models/shared/adjustmenttransactionrequest.go b/sync-for-expenses/pkg/models/shared/adjustmenttransactionrequest.go new file mode 100644 index 000000000..3fe6daf2e --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/adjustmenttransactionrequest.go @@ -0,0 +1,125 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +type AdjustmentTransactionRequest struct { + // Currency the transaction was recorded in. + Currency string `json:"currency"` + // Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + // + // Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + // + // It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + // + // Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + // + // For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + // + // ## Examples with base currency of GBP + // + // | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + // | :--------------- | :------------- | :------------ | :------------------------- | + // | **USD** | $20 | 0.781 | £15.62 | + // | **EUR** | €20 | 0.885 | £17.70 | + // | **RUB** | ₽20 | 0.011 | £0.22 | + // + // ## Examples with base currency of USD + // + // | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + // | :--------------- | :------------- | :------------ | :------------------------- | + // | **GBP** | £20 | 1.277 | $25.54 | + // | **EUR** | €20 | 1.134 | $22.68 | + // | **RUB** | ₽20 | 0.015 | $0.30 | + // + // + // ### Integration-specific details + // + // | Integration | Scenario | System behavior | + // |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + CurrencyRate *decimal.Big `decimal:"number" json:"currencyRate,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + Date string `json:"date"` + // Your unique identifier for the transaction. + ID string `json:"id"` + // Array of transaction lines. + Lines []AdjustmentTransactionLine `json:"lines"` + // User-friendly reference for the adjustment transaction. + Reference *string `json:"reference,omitempty"` +} + +func (a AdjustmentTransactionRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AdjustmentTransactionRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AdjustmentTransactionRequest) GetCurrency() string { + if o == nil { + return "" + } + return o.Currency +} + +func (o *AdjustmentTransactionRequest) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *AdjustmentTransactionRequest) GetDate() string { + if o == nil { + return "" + } + return o.Date +} + +func (o *AdjustmentTransactionRequest) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +func (o *AdjustmentTransactionRequest) GetLines() []AdjustmentTransactionLine { + if o == nil { + return []AdjustmentTransactionLine{} + } + return o.Lines +} + +func (o *AdjustmentTransactionRequest) GetReference() *string { + if o == nil { + return nil + } + return o.Reference +} diff --git a/sync-for-expenses/pkg/models/shared/adjustmenttransactionresponse.go b/sync-for-expenses/pkg/models/shared/adjustmenttransactionresponse.go new file mode 100644 index 000000000..0719402d8 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/adjustmenttransactionresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type AdjustmentTransactionResponse struct { + // Unique id of sync created + SyncID *string `json:"syncId,omitempty"` +} + +func (o *AdjustmentTransactionResponse) GetSyncID() *string { + if o == nil { + return nil + } + return o.SyncID +} diff --git a/sync-for-expenses/pkg/models/shared/attachment.go b/sync-for-expenses/pkg/models/shared/attachment.go index 546594fc3..ae9c78d65 100644 --- a/sync-for-expenses/pkg/models/shared/attachment.go +++ b/sync-for-expenses/pkg/models/shared/attachment.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/attachmentupload.go b/sync-for-expenses/pkg/models/shared/attachmentupload.go index 4d7603848..fd81d447b 100644 --- a/sync-for-expenses/pkg/models/shared/attachmentupload.go +++ b/sync-for-expenses/pkg/models/shared/attachmentupload.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/bankaccount.go b/sync-for-expenses/pkg/models/shared/bankaccount.go index e4338471e..b00debcd1 100644 --- a/sync-for-expenses/pkg/models/shared/bankaccount.go +++ b/sync-for-expenses/pkg/models/shared/bankaccount.go @@ -1,10 +1,175 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +import ( + "encoding/json" + "fmt" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// BankAccountType - The type of transactions and balances on the account. +// For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +// For Debit accounts, positive balances are assets, and positive transactions **increase** assets. +type BankAccountType string + +const ( + BankAccountTypeUnknown BankAccountType = "Unknown" + BankAccountTypeCredit BankAccountType = "Credit" + BankAccountTypeDebit BankAccountType = "Debit" +) + +func (e BankAccountType) ToPointer() *BankAccountType { + return &e +} +func (e *BankAccountType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Unknown": + fallthrough + case "Credit": + fallthrough + case "Debit": + *e = BankAccountType(v) + return nil + default: + return fmt.Errorf("invalid value for BankAccountType: %v", v) + } +} + +// BankAccount - > **Accessing Bank Accounts through Banking API** +// > +// > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. +// > +// > To view bank account data through the Banking API, please refer to the new datatype [here](https://docs.codat.io/sync-for-expenses-api#/schemas/Account) +// +// > View the coverage for bank accounts in the Data coverage explorer. +// +// ## Overview +// +// A list of bank accounts associated with a company and a specific data connection. +// +// Bank accounts data includes: +// * The name and ID of the account in the accounting software. +// * The currency and balance of the account. +// * The sort code and account number. type BankAccount struct { - // The id of the account from which purchases are made + // Name of the bank account in the accounting software. + AccountName *string `json:"accountName,omitempty"` + // Account number for the bank account. + // + // Xero integrations + // Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + // + // FreeAgent integrations + // For Credit accounts, only the last four digits are required. For other types, the field is optional. + AccountNumber *string `json:"accountNumber,omitempty"` + // The type of transactions and balances on the account. + // For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + // For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + AccountType *BankAccountType `json:"accountType,omitempty"` + // Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. + AvailableBalance *decimal.Big `decimal:"number" json:"availableBalance,omitempty"` + // Balance of the bank account. + Balance *decimal.Big `decimal:"number" json:"balance,omitempty"` + // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + // + // ## Unknown currencies + // + // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + // + // There are only a very small number of edge cases where this currency code is returned by the Codat system. + Currency *string `json:"currency,omitempty"` + // International bank account number of the account. Often used when making or receiving international payments. + IBan *string `json:"iBan,omitempty"` + // Identifier for the account, unique for the company in the accounting software. ID *string `json:"id,omitempty"` + // The institution of the bank account. + Institution *string `json:"institution,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Code used to identify each nominal account for a business. + NominalCode *string `json:"nominalCode,omitempty"` + // Pre-arranged overdraft limit of the account. + // + // The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. + OverdraftLimit *decimal.Big `decimal:"number" json:"overdraftLimit,omitempty"` + // Sort code for the bank account. + // + // Xero integrations + // The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + SortCode *string `json:"sortCode,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Status of the bank account. + Status *BankAccountStatus `json:"status,omitempty"` + // Supplemental data is additional data you can include in our standard data types. + // + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` +} + +func (b BankAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(b, "", false) +} + +func (b *BankAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &b, "", false, false); err != nil { + return err + } + return nil +} + +func (o *BankAccount) GetAccountName() *string { + if o == nil { + return nil + } + return o.AccountName +} + +func (o *BankAccount) GetAccountNumber() *string { + if o == nil { + return nil + } + return o.AccountNumber +} + +func (o *BankAccount) GetAccountType() *BankAccountType { + if o == nil { + return nil + } + return o.AccountType +} + +func (o *BankAccount) GetAvailableBalance() *decimal.Big { + if o == nil { + return nil + } + return o.AvailableBalance +} + +func (o *BankAccount) GetBalance() *decimal.Big { + if o == nil { + return nil + } + return o.Balance +} + +func (o *BankAccount) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *BankAccount) GetIBan() *string { + if o == nil { + return nil + } + return o.IBan } func (o *BankAccount) GetID() *string { @@ -13,3 +178,66 @@ func (o *BankAccount) GetID() *string { } return o.ID } + +func (o *BankAccount) GetInstitution() *string { + if o == nil { + return nil + } + return o.Institution +} + +func (o *BankAccount) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *BankAccount) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *BankAccount) GetNominalCode() *string { + if o == nil { + return nil + } + return o.NominalCode +} + +func (o *BankAccount) GetOverdraftLimit() *decimal.Big { + if o == nil { + return nil + } + return o.OverdraftLimit +} + +func (o *BankAccount) GetSortCode() *string { + if o == nil { + return nil + } + return o.SortCode +} + +func (o *BankAccount) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *BankAccount) GetStatus() *BankAccountStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *BankAccount) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} diff --git a/sync-for-expenses/pkg/models/shared/bankaccountdetails.go b/sync-for-expenses/pkg/models/shared/bankaccountdetails.go new file mode 100644 index 000000000..d54457bac --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/bankaccountdetails.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type BankAccountDetails struct { + // The id of the account from which purchases are made + ID *string `json:"id,omitempty"` +} + +func (o *BankAccountDetails) GetID() *string { + if o == nil { + return nil + } + return o.ID +} diff --git a/sync-for-expenses/pkg/models/shared/bankaccountstatus.go b/sync-for-expenses/pkg/models/shared/bankaccountstatus.go new file mode 100644 index 000000000..893fd2099 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/bankaccountstatus.go @@ -0,0 +1,41 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// BankAccountStatus - Status of the bank account. +type BankAccountStatus string + +const ( + BankAccountStatusUnknown BankAccountStatus = "Unknown" + BankAccountStatusActive BankAccountStatus = "Active" + BankAccountStatusArchived BankAccountStatus = "Archived" + BankAccountStatusPending BankAccountStatus = "Pending" +) + +func (e BankAccountStatus) ToPointer() *BankAccountStatus { + return &e +} +func (e *BankAccountStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Unknown": + fallthrough + case "Active": + fallthrough + case "Archived": + fallthrough + case "Pending": + *e = BankAccountStatus(v) + return nil + default: + return fmt.Errorf("invalid value for BankAccountStatus: %v", v) + } +} diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhook.go b/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhook.go index b63ffb9f3..5e146f608 100644 --- a/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhook.go +++ b/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhookdata.go b/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhookdata.go index c93fcdbd5..fdbf9b562 100644 --- a/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhookdata.go +++ b/sync-for-expenses/pkg/models/shared/clientratelimitreachedwebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhook.go b/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhook.go index 8a3bc167f..84fdbc67b 100644 --- a/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhook.go +++ b/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhookdata.go b/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhookdata.go index 71dcc39af..bd5fe0580 100644 --- a/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhookdata.go +++ b/sync-for-expenses/pkg/models/shared/clientratelimitresetwebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitwebhook.go b/sync-for-expenses/pkg/models/shared/clientratelimitwebhook.go new file mode 100644 index 000000000..5dfc990df --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/clientratelimitwebhook.go @@ -0,0 +1,59 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ClientRateLimitWebhook struct { + // The type of event. + EventType *string `json:"eventType,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + GeneratedDate *string `json:"generatedDate,omitempty"` + // Unique identifier of the event. + ID *string `json:"id,omitempty"` + Payload *ClientRateLimitWebhookPayload `json:"payload,omitempty"` +} + +func (o *ClientRateLimitWebhook) GetEventType() *string { + if o == nil { + return nil + } + return o.EventType +} + +func (o *ClientRateLimitWebhook) GetGeneratedDate() *string { + if o == nil { + return nil + } + return o.GeneratedDate +} + +func (o *ClientRateLimitWebhook) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *ClientRateLimitWebhook) GetPayload() *ClientRateLimitWebhookPayload { + if o == nil { + return nil + } + return o.Payload +} diff --git a/sync-for-expenses/pkg/models/shared/clientratelimitwebhookpayload.go b/sync-for-expenses/pkg/models/shared/clientratelimitwebhookpayload.go new file mode 100644 index 000000000..eb9ed0b2e --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/clientratelimitwebhookpayload.go @@ -0,0 +1,51 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ClientRateLimitWebhookPayload struct { + // The number of available requests per day. + DailyQuota *int64 `json:"dailyQuota,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + ExpiryDate *string `json:"expiryDate,omitempty"` + // Total number of requests remaining for your client. + QuotaRemaining *int64 `json:"quotaRemaining,omitempty"` +} + +func (o *ClientRateLimitWebhookPayload) GetDailyQuota() *int64 { + if o == nil { + return nil + } + return o.DailyQuota +} + +func (o *ClientRateLimitWebhookPayload) GetExpiryDate() *string { + if o == nil { + return nil + } + return o.ExpiryDate +} + +func (o *ClientRateLimitWebhookPayload) GetQuotaRemaining() *int64 { + if o == nil { + return nil + } + return o.QuotaRemaining +} diff --git a/sync-for-expenses/pkg/models/shared/codatfile.go b/sync-for-expenses/pkg/models/shared/codatfile.go index c8b6ca1b2..6ba85d709 100644 --- a/sync-for-expenses/pkg/models/shared/codatfile.go +++ b/sync-for-expenses/pkg/models/shared/codatfile.go @@ -1,15 +1,16 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type CodatFile struct { - Content []byte `multipartForm:"content"` + // This field accepts []byte data or io.Reader implementations, such as *os.File. + Content any `multipartForm:"content"` FileName string `multipartForm:"name=fileName"` } -func (o *CodatFile) GetContent() []byte { +func (o *CodatFile) GetContent() any { if o == nil { - return []byte{} + return nil } return o.Content } diff --git a/sync-for-expenses/pkg/models/shared/companies.go b/sync-for-expenses/pkg/models/shared/companies.go index 5a5574be6..2776b0604 100644 --- a/sync-for-expenses/pkg/models/shared/companies.go +++ b/sync-for-expenses/pkg/models/shared/companies.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/company.go b/sync-for-expenses/pkg/models/shared/company.go index 3d669be8d..a1aa1eb9d 100644 --- a/sync-for-expenses/pkg/models/shared/company.go +++ b/sync-for-expenses/pkg/models/shared/company.go @@ -1,17 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared -type GroupReference struct { - // Unique identifier for the group. - ID *string `json:"id,omitempty"` -} - -func (o *GroupReference) GetID() *string { - if o == nil { - return nil - } - return o.ID +// Tags - A collection of user-defined key-value pairs that store custom metadata against the company. +type Tags struct { } // Company - In Codat, a company represents a business sharing access to their data. Each company can have multiple [connections](https://docs.codat.io/sync-for-expenses-api#/schemas/Connection) to different data sources such as one connection to [Xero](https://docs.codat.io/integrations/accounting/xero/accounting-xero) for accounting data, two connections to [Plaid](https://docs.codat.io/integrations/banking/plaid/banking-plaid) for two bank accounts and a connection to [Zettle](https://docs.codat.io/integrations/commerce/zettle/commerce-zettle) for POS data. @@ -45,8 +37,6 @@ type Company struct { DataConnections []Connection `json:"dataConnections,omitempty"` // Additional information about the company. This can be used to store foreign IDs, references, etc. Description *string `json:"description,omitempty"` - // An array of groups the company has been assigned to. - Groups []GroupReference `json:"groups,omitempty"` // Unique identifier for your SMB in Codat. ID string `json:"id"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -71,12 +61,10 @@ type Company struct { LastSync *string `json:"lastSync,omitempty"` // The name of the company Name string `json:"name"` - // `platformKeys` name used when creating the company. - // - // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - Platform *string `json:"platform,omitempty"` // The `redirect` [Link URL](https://docs.codat.io/auth-flow/authorize-hosted-link) enabling the customer to start their auth flow journey for the company. Redirect string `json:"redirect"` + // A collection of user-defined key-value pairs that store custom metadata against the company. + Tags *Tags `json:"tags,omitempty"` } func (o *Company) GetCreated() *string { @@ -107,13 +95,6 @@ func (o *Company) GetDescription() *string { return o.Description } -func (o *Company) GetGroups() []GroupReference { - if o == nil { - return nil - } - return o.Groups -} - func (o *Company) GetID() string { if o == nil { return "" @@ -135,16 +116,16 @@ func (o *Company) GetName() string { return o.Name } -func (o *Company) GetPlatform() *string { +func (o *Company) GetRedirect() string { if o == nil { - return nil + return "" } - return o.Platform + return o.Redirect } -func (o *Company) GetRedirect() string { +func (o *Company) GetTags() *Tags { if o == nil { - return "" + return nil } - return o.Redirect + return o.Tags } diff --git a/sync-for-expenses/pkg/models/shared/companyconfiguration.go b/sync-for-expenses/pkg/models/shared/companyconfiguration.go index 7e0ece476..77b965abb 100644 --- a/sync-for-expenses/pkg/models/shared/companyconfiguration.go +++ b/sync-for-expenses/pkg/models/shared/companyconfiguration.go @@ -1,16 +1,16 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type CompanyConfiguration struct { - BankAccount BankAccount `json:"bankAccount"` - Customer CustomerDetails `json:"customer"` - Supplier SupplierDetails `json:"supplier"` + BankAccount BankAccountDetails `json:"bankAccount"` + Customer CustomerDetails `json:"customer"` + Supplier SupplierDetails `json:"supplier"` } -func (o *CompanyConfiguration) GetBankAccount() BankAccount { +func (o *CompanyConfiguration) GetBankAccount() BankAccountDetails { if o == nil { - return BankAccount{} + return BankAccountDetails{} } return o.BankAccount } diff --git a/sync-for-expenses/pkg/models/shared/companyrequestbody.go b/sync-for-expenses/pkg/models/shared/companyrequestbody.go index d915e476c..01191107d 100644 --- a/sync-for-expenses/pkg/models/shared/companyrequestbody.go +++ b/sync-for-expenses/pkg/models/shared/companyrequestbody.go @@ -1,12 +1,24 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +type GroupReference struct { + // Unique identifier for the group. + ID *string `json:"id,omitempty"` +} + +func (o *GroupReference) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + type CompanyRequestBody struct { // Additional information about the company. This can be used to store foreign IDs, references, etc. Description *string `json:"description,omitempty"` // Reference to the groups that the company is assigned to. - Groups []GroupItems `json:"groups,omitempty"` + Groups []GroupReference `json:"groups,omitempty"` // Name of company being connected. Name string `json:"name"` } @@ -18,7 +30,7 @@ func (o *CompanyRequestBody) GetDescription() *string { return o.Description } -func (o *CompanyRequestBody) GetGroups() []GroupItems { +func (o *CompanyRequestBody) GetGroups() []GroupReference { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/companysyncstatus.go b/sync-for-expenses/pkg/models/shared/companysyncstatus.go index 6114236f8..5ddda1fe6 100644 --- a/sync-for-expenses/pkg/models/shared/companysyncstatus.go +++ b/sync-for-expenses/pkg/models/shared/companysyncstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/connection.go b/sync-for-expenses/pkg/models/shared/connection.go index 2e8b78c61..3372a9c16 100644 --- a/sync-for-expenses/pkg/models/shared/connection.go +++ b/sync-for-expenses/pkg/models/shared/connection.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -23,7 +23,6 @@ const ( func (e SourceType) ToPointer() *SourceType { return &e } - func (e *SourceType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -61,7 +60,7 @@ func (e *SourceType) UnmarshalJSON(data []byte) error { // // Before you can use a data connection to pull or push data, the company must grant you access to their business data by [linking the connection](https://docs.codat.io/auth-flow/overview). type Connection struct { - AdditionalProperties interface{} `json:"additionalProperties,omitempty"` + AdditionalProperties any `json:"additionalProperties,omitempty"` ConnectionInfo map[string]string `json:"connectionInfo,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -122,7 +121,7 @@ type Connection struct { Status DataConnectionStatus `json:"status"` } -func (o *Connection) GetAdditionalProperties() interface{} { +func (o *Connection) GetAdditionalProperties() any { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/connections.go b/sync-for-expenses/pkg/models/shared/connections.go index 24ae6e665..e20874757 100644 --- a/sync-for-expenses/pkg/models/shared/connections.go +++ b/sync-for-expenses/pkg/models/shared/connections.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/contact.go b/sync-for-expenses/pkg/models/shared/contact.go index 6bd3a1679..8662e77ab 100644 --- a/sync-for-expenses/pkg/models/shared/contact.go +++ b/sync-for-expenses/pkg/models/shared/contact.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/createaccountresponse.go b/sync-for-expenses/pkg/models/shared/createaccountresponse.go index f9fdf5c36..eb713928e 100644 --- a/sync-for-expenses/pkg/models/shared/createaccountresponse.go +++ b/sync-for-expenses/pkg/models/shared/createaccountresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -147,7 +147,7 @@ type AccountingAccount struct { Status *AccountStatus `json:"status,omitempty"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Type of account Type *AccountType `json:"type,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/createbankaccountresponse.go b/sync-for-expenses/pkg/models/shared/createbankaccountresponse.go new file mode 100644 index 000000000..c19157596 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/createbankaccountresponse.go @@ -0,0 +1,411 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// CreateBankAccountResponseBankAccountType - The type of transactions and balances on the account. +// For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. +// For Debit accounts, positive balances are assets, and positive transactions **increase** assets. +type CreateBankAccountResponseBankAccountType string + +const ( + CreateBankAccountResponseBankAccountTypeUnknown CreateBankAccountResponseBankAccountType = "Unknown" + CreateBankAccountResponseBankAccountTypeCredit CreateBankAccountResponseBankAccountType = "Credit" + CreateBankAccountResponseBankAccountTypeDebit CreateBankAccountResponseBankAccountType = "Debit" +) + +func (e CreateBankAccountResponseBankAccountType) ToPointer() *CreateBankAccountResponseBankAccountType { + return &e +} +func (e *CreateBankAccountResponseBankAccountType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Unknown": + fallthrough + case "Credit": + fallthrough + case "Debit": + *e = CreateBankAccountResponseBankAccountType(v) + return nil + default: + return fmt.Errorf("invalid value for CreateBankAccountResponseBankAccountType: %v", v) + } +} + +// AccountingBankAccount - > **Accessing Bank Accounts through Banking API** +// > +// > This datatype was originally used for accessing bank account data both in accounting integrations and open banking aggregators. +// > +// > To view bank account data through the Banking API, please refer to the new datatype [here](https://docs.codat.io/sync-for-expenses-api#/schemas/Account) +// +// > View the coverage for bank accounts in the Data coverage explorer. +// +// ## Overview +// +// A list of bank accounts associated with a company and a specific data connection. +// +// Bank accounts data includes: +// * The name and ID of the account in the accounting software. +// * The currency and balance of the account. +// * The sort code and account number. +// +// Deprecated type: This will be removed in a future release, please migrate away from it as soon as possible. +type AccountingBankAccount struct { + // Name of the bank account in the accounting software. + AccountName *string `json:"accountName,omitempty"` + // Account number for the bank account. + // + // Xero integrations + // Only a UK account number shows for bank accounts with GBP currency and a combined total of sort code and account number that equals 14 digits, For non-GBP accounts, the full bank account number is populated. + // + // FreeAgent integrations + // For Credit accounts, only the last four digits are required. For other types, the field is optional. + AccountNumber *string `json:"accountNumber,omitempty"` + // The type of transactions and balances on the account. + // For Credit accounts, positive balances are liabilities, and positive transactions **reduce** liabilities. + // For Debit accounts, positive balances are assets, and positive transactions **increase** assets. + AccountType *CreateBankAccountResponseBankAccountType `json:"accountType,omitempty"` + // Total available balance of the bank account as reported by the underlying data source. This may take into account overdrafts or pending transactions for example. + AvailableBalance *decimal.Big `decimal:"number" json:"availableBalance,omitempty"` + // Balance of the bank account. + Balance *decimal.Big `decimal:"number" json:"balance,omitempty"` + // The currency data type in Codat is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, e.g. _GBP_. + // + // ## Unknown currencies + // + // In line with the ISO 4217 specification, the code _XXX_ is used when the data source does not return a currency for a transaction. + // + // There are only a very small number of edge cases where this currency code is returned by the Codat system. + Currency *string `json:"currency,omitempty"` + // International bank account number of the account. Often used when making or receiving international payments. + IBan *string `json:"iBan,omitempty"` + // Identifier for the account, unique for the company in the accounting software. + ID *string `json:"id,omitempty"` + // The institution of the bank account. + Institution *string `json:"institution,omitempty"` + Metadata *Metadata `json:"metadata,omitempty"` + ModifiedDate *string `json:"modifiedDate,omitempty"` + // Code used to identify each nominal account for a business. + NominalCode *string `json:"nominalCode,omitempty"` + // Pre-arranged overdraft limit of the account. + // + // The value is always positive. For example, an overdraftLimit of `1000` means that the balance of the account can go down to `-1000`. + OverdraftLimit *decimal.Big `decimal:"number" json:"overdraftLimit,omitempty"` + // Sort code for the bank account. + // + // Xero integrations + // The sort code is only displayed when the currency = GBP and the sort code and account number sum to 14 digits. For non-GBP accounts, this field is not populated. + SortCode *string `json:"sortCode,omitempty"` + SourceModifiedDate *string `json:"sourceModifiedDate,omitempty"` + // Status of the bank account. + Status *BankAccountStatus `json:"status,omitempty"` + // Supplemental data is additional data you can include in our standard data types. + // + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + SupplementalData *SupplementalData `json:"supplementalData,omitempty"` +} + +func (a AccountingBankAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AccountingBankAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil { + return err + } + return nil +} + +func (o *AccountingBankAccount) GetAccountName() *string { + if o == nil { + return nil + } + return o.AccountName +} + +func (o *AccountingBankAccount) GetAccountNumber() *string { + if o == nil { + return nil + } + return o.AccountNumber +} + +func (o *AccountingBankAccount) GetAccountType() *CreateBankAccountResponseBankAccountType { + if o == nil { + return nil + } + return o.AccountType +} + +func (o *AccountingBankAccount) GetAvailableBalance() *decimal.Big { + if o == nil { + return nil + } + return o.AvailableBalance +} + +func (o *AccountingBankAccount) GetBalance() *decimal.Big { + if o == nil { + return nil + } + return o.Balance +} + +func (o *AccountingBankAccount) GetCurrency() *string { + if o == nil { + return nil + } + return o.Currency +} + +func (o *AccountingBankAccount) GetIBan() *string { + if o == nil { + return nil + } + return o.IBan +} + +func (o *AccountingBankAccount) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *AccountingBankAccount) GetInstitution() *string { + if o == nil { + return nil + } + return o.Institution +} + +func (o *AccountingBankAccount) GetMetadata() *Metadata { + if o == nil { + return nil + } + return o.Metadata +} + +func (o *AccountingBankAccount) GetModifiedDate() *string { + if o == nil { + return nil + } + return o.ModifiedDate +} + +func (o *AccountingBankAccount) GetNominalCode() *string { + if o == nil { + return nil + } + return o.NominalCode +} + +func (o *AccountingBankAccount) GetOverdraftLimit() *decimal.Big { + if o == nil { + return nil + } + return o.OverdraftLimit +} + +func (o *AccountingBankAccount) GetSortCode() *string { + if o == nil { + return nil + } + return o.SortCode +} + +func (o *AccountingBankAccount) GetSourceModifiedDate() *string { + if o == nil { + return nil + } + return o.SourceModifiedDate +} + +func (o *AccountingBankAccount) GetStatus() *BankAccountStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *AccountingBankAccount) GetSupplementalData() *SupplementalData { + if o == nil { + return nil + } + return o.SupplementalData +} + +type CreateBankAccountResponse struct { + // Contains a single entry that communicates which record has changed and the manner in which it changed. + Changes []PushOperationChange `json:"changes,omitempty"` + // Unique identifier for your SMB in Codat. + CompanyID string `json:"companyId"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + CompletedOnUtc *string `json:"completedOnUtc,omitempty"` + Data *AccountingBankAccount `json:"data,omitempty"` + // Unique identifier for a company's data connection. + DataConnectionKey string `json:"dataConnectionKey"` + // Available data types + DataType *DataType `json:"dataType,omitempty"` + // A message about the error. + ErrorMessage *string `json:"errorMessage,omitempty"` + // A unique identifier generated by Codat to represent this single push operation. This identifier can be used to track the status of the push, and should be persisted. + PushOperationKey string `json:"pushOperationKey"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + RequestedOnUtc string `json:"requestedOnUtc"` + // The current status of the push operation. + Status PushOperationStatus `json:"status"` + // Push status code. + StatusCode int64 `json:"statusCode"` + // Number of minutes the push operation must complete within before it times out. + TimeoutInMinutes *int `json:"timeoutInMinutes,omitempty"` + // Number of seconds the push operation must complete within before it times out. + // + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + TimeoutInSeconds *int `json:"timeoutInSeconds,omitempty"` + // A human-readable object describing validation decisions Codat has made when pushing data into the platform. If a push has failed because of validation errors, they will be detailed here. + Validation *Validation `json:"validation,omitempty"` +} + +func (o *CreateBankAccountResponse) GetChanges() []PushOperationChange { + if o == nil { + return nil + } + return o.Changes +} + +func (o *CreateBankAccountResponse) GetCompanyID() string { + if o == nil { + return "" + } + return o.CompanyID +} + +func (o *CreateBankAccountResponse) GetCompletedOnUtc() *string { + if o == nil { + return nil + } + return o.CompletedOnUtc +} + +func (o *CreateBankAccountResponse) GetData() *AccountingBankAccount { + if o == nil { + return nil + } + return o.Data +} + +func (o *CreateBankAccountResponse) GetDataConnectionKey() string { + if o == nil { + return "" + } + return o.DataConnectionKey +} + +func (o *CreateBankAccountResponse) GetDataType() *DataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *CreateBankAccountResponse) GetErrorMessage() *string { + if o == nil { + return nil + } + return o.ErrorMessage +} + +func (o *CreateBankAccountResponse) GetPushOperationKey() string { + if o == nil { + return "" + } + return o.PushOperationKey +} + +func (o *CreateBankAccountResponse) GetRequestedOnUtc() string { + if o == nil { + return "" + } + return o.RequestedOnUtc +} + +func (o *CreateBankAccountResponse) GetStatus() PushOperationStatus { + if o == nil { + return PushOperationStatus("") + } + return o.Status +} + +func (o *CreateBankAccountResponse) GetStatusCode() int64 { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *CreateBankAccountResponse) GetTimeoutInMinutes() *int { + if o == nil { + return nil + } + return o.TimeoutInMinutes +} + +func (o *CreateBankAccountResponse) GetTimeoutInSeconds() *int { + if o == nil { + return nil + } + return o.TimeoutInSeconds +} + +func (o *CreateBankAccountResponse) GetValidation() *Validation { + if o == nil { + return nil + } + return o.Validation +} diff --git a/sync-for-expenses/pkg/models/shared/createcustomerresponse.go b/sync-for-expenses/pkg/models/shared/createcustomerresponse.go index 83090b429..38d715e01 100644 --- a/sync-for-expenses/pkg/models/shared/createcustomerresponse.go +++ b/sync-for-expenses/pkg/models/shared/createcustomerresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -96,7 +96,7 @@ type AccountingCustomer struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address the customer can be contacted by. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the customer, unique to the company in the accounting platform. + // Identifier for the customer, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -109,7 +109,7 @@ type AccountingCustomer struct { Status CustomerStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Company tax number. TaxNumber *string `json:"taxNumber,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/createexpenserequest.go b/sync-for-expenses/pkg/models/shared/createexpenserequest.go deleted file mode 100644 index 1e75eedc3..000000000 --- a/sync-for-expenses/pkg/models/shared/createexpenserequest.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type CreateExpenseRequest struct { - Items []ExpenseTransaction `json:"items,omitempty"` -} - -func (o *CreateExpenseRequest) GetItems() []ExpenseTransaction { - if o == nil { - return nil - } - return o.Items -} diff --git a/sync-for-expenses/pkg/models/shared/createexpenseresponse.go b/sync-for-expenses/pkg/models/shared/createexpenseresponse.go index 195a45901..f9185f0d4 100644 --- a/sync-for-expenses/pkg/models/shared/createexpenseresponse.go +++ b/sync-for-expenses/pkg/models/shared/createexpenseresponse.go @@ -1,15 +1,15 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type CreateExpenseResponse struct { - // Unique id of dataset created - DatasetID *string `json:"datasetId,omitempty"` + // Unique id of sync created + SyncID *string `json:"syncId,omitempty"` } -func (o *CreateExpenseResponse) GetDatasetID() *string { +func (o *CreateExpenseResponse) GetSyncID() *string { if o == nil { return nil } - return o.DatasetID + return o.SyncID } diff --git a/sync-for-expenses/pkg/models/shared/createreimbursableexpenserequest.go b/sync-for-expenses/pkg/models/shared/createreimbursableexpenserequest.go deleted file mode 100644 index 9840261f6..000000000 --- a/sync-for-expenses/pkg/models/shared/createreimbursableexpenserequest.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type CreateReimbursableExpenseRequest struct { - Items [][]ReimbursableExpenseTransaction `json:"items,omitempty"` -} - -func (o *CreateReimbursableExpenseRequest) GetItems() [][]ReimbursableExpenseTransaction { - if o == nil { - return nil - } - return o.Items -} diff --git a/sync-for-expenses/pkg/models/shared/createreimbursableexpenseresponse.go b/sync-for-expenses/pkg/models/shared/createreimbursableexpenseresponse.go index e9c6a7c29..825d197bc 100644 --- a/sync-for-expenses/pkg/models/shared/createreimbursableexpenseresponse.go +++ b/sync-for-expenses/pkg/models/shared/createreimbursableexpenseresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/createsupplierresponse.go b/sync-for-expenses/pkg/models/shared/createsupplierresponse.go index 7534405e5..47416a5ad 100644 --- a/sync-for-expenses/pkg/models/shared/createsupplierresponse.go +++ b/sync-for-expenses/pkg/models/shared/createsupplierresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -18,7 +18,7 @@ type AccountingSupplier struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address that the supplier may be contacted on. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the supplier, unique to the company in the accounting platform. + // Identifier for the supplier, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -31,7 +31,7 @@ type AccountingSupplier struct { Status SupplierStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Name of the supplier as recorded in the accounting system, typically the company name. SupplierName *string `json:"supplierName,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/createtransferrequest.go b/sync-for-expenses/pkg/models/shared/createtransferrequest.go deleted file mode 100644 index 367ef816f..000000000 --- a/sync-for-expenses/pkg/models/shared/createtransferrequest.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type CreateTransferRequest struct { - Date *string `json:"date,omitempty"` - // Any private, company notes about the transaction. - Description *string `json:"description,omitempty"` - From *TransferDetails `json:"from,omitempty"` - To *TransferDetails `json:"to,omitempty"` -} - -func (o *CreateTransferRequest) GetDate() *string { - if o == nil { - return nil - } - return o.Date -} - -func (o *CreateTransferRequest) GetDescription() *string { - if o == nil { - return nil - } - return o.Description -} - -func (o *CreateTransferRequest) GetFrom() *TransferDetails { - if o == nil { - return nil - } - return o.From -} - -func (o *CreateTransferRequest) GetTo() *TransferDetails { - if o == nil { - return nil - } - return o.To -} diff --git a/sync-for-expenses/pkg/models/shared/createtransferresponse.go b/sync-for-expenses/pkg/models/shared/createtransferresponse.go deleted file mode 100644 index e5e5c50b1..000000000 --- a/sync-for-expenses/pkg/models/shared/createtransferresponse.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type CreateTransferResponse struct { - // Unique id of sync created - SyncID *string `json:"syncId,omitempty"` -} - -func (o *CreateTransferResponse) GetSyncID() *string { - if o == nil { - return nil - } - return o.SyncID -} diff --git a/sync-for-expenses/pkg/models/shared/customer.go b/sync-for-expenses/pkg/models/shared/customer.go index 24be81658..9861b84be 100644 --- a/sync-for-expenses/pkg/models/shared/customer.go +++ b/sync-for-expenses/pkg/models/shared/customer.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -94,7 +94,7 @@ type Customer struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address the customer can be contacted by. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the customer, unique to the company in the accounting platform. + // Identifier for the customer, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -107,7 +107,7 @@ type Customer struct { Status CustomerStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Company tax number. TaxNumber *string `json:"taxNumber,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/customerdetails.go b/sync-for-expenses/pkg/models/shared/customerdetails.go index fbe4098eb..3e5a88690 100644 --- a/sync-for-expenses/pkg/models/shared/customerdetails.go +++ b/sync-for-expenses/pkg/models/shared/customerdetails.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type CustomerDetails struct { - // Identifier for the customer, unique to the company in the accounting platform. + // Identifier for the customer, unique to the company in the accounting software. ID *string `json:"id,omitempty"` } diff --git a/sync-for-expenses/pkg/models/shared/customers.go b/sync-for-expenses/pkg/models/shared/customers.go index 398cfb524..f4f2c7413 100644 --- a/sync-for-expenses/pkg/models/shared/customers.go +++ b/sync-for-expenses/pkg/models/shared/customers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/customerstatus.go b/sync-for-expenses/pkg/models/shared/customerstatus.go index 1d5c0e8ef..d399ae91c 100644 --- a/sync-for-expenses/pkg/models/shared/customerstatus.go +++ b/sync-for-expenses/pkg/models/shared/customerstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -19,7 +19,6 @@ const ( func (e CustomerStatus) ToPointer() *CustomerStatus { return &e } - func (e *CustomerStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/dataconnectionerror.go b/sync-for-expenses/pkg/models/shared/dataconnectionerror.go index 757486ba3..2bbff7093 100644 --- a/sync-for-expenses/pkg/models/shared/dataconnectionerror.go +++ b/sync-for-expenses/pkg/models/shared/dataconnectionerror.go @@ -1,9 +1,41 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared +import ( + "encoding/json" + "fmt" +) + +// ErrorStatus - The current status of a transient error. Null statuses indicate that the error is not transient. +type ErrorStatus string + +const ( + ErrorStatusActive ErrorStatus = "Active" + ErrorStatusResolved ErrorStatus = "Resolved" +) + +func (e ErrorStatus) ToPointer() *ErrorStatus { + return &e +} +func (e *ErrorStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Active": + fallthrough + case "Resolved": + *e = ErrorStatus(v) + return nil + default: + return fmt.Errorf("invalid value for ErrorStatus: %v", v) + } +} + type DataConnectionError struct { - // A brief message about the error. + // A message about a error returned by Codat. ErrorMessage *string `json:"errorMessage,omitempty"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: // @@ -25,9 +57,31 @@ type DataConnectionError struct { // > Not all dates from Codat will contain information about time zones. // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. ErroredOnUtc *string `json:"erroredOnUtc,omitempty"` - // The HTTP status code returned by the error. + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + ResolvedOnUtc *string `json:"resolvedOnUtc,omitempty"` + // The current status of a transient error. Null statuses indicate that the error is not transient. + Status *ErrorStatus `json:"status,omitempty"` + // The HTTP status code returned by the source platform when the error occurred. StatusCode *string `json:"statusCode,omitempty"` - // A non-numeric status code/text. + // A non-numeric status code/text returned by the source platform when the error occurred. StatusText *string `json:"statusText,omitempty"` } @@ -45,6 +99,20 @@ func (o *DataConnectionError) GetErroredOnUtc() *string { return o.ErroredOnUtc } +func (o *DataConnectionError) GetResolvedOnUtc() *string { + if o == nil { + return nil + } + return o.ResolvedOnUtc +} + +func (o *DataConnectionError) GetStatus() *ErrorStatus { + if o == nil { + return nil + } + return o.Status +} + func (o *DataConnectionError) GetStatusCode() *string { if o == nil { return nil diff --git a/sync-for-expenses/pkg/models/shared/dataconnectionstatus.go b/sync-for-expenses/pkg/models/shared/dataconnectionstatus.go index ec5254876..f7e281bc9 100644 --- a/sync-for-expenses/pkg/models/shared/dataconnectionstatus.go +++ b/sync-for-expenses/pkg/models/shared/dataconnectionstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e DataConnectionStatus) ToPointer() *DataConnectionStatus { return &e } - func (e *DataConnectionStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/datastatus.go b/sync-for-expenses/pkg/models/shared/datastatus.go index fa4144da5..83281553c 100644 --- a/sync-for-expenses/pkg/models/shared/datastatus.go +++ b/sync-for-expenses/pkg/models/shared/datastatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -59,7 +59,6 @@ const ( func (e DataTypes) ToPointer() *DataTypes { return &e } - func (e *DataTypes) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -160,8 +159,8 @@ func (e *DataTypes) UnmarshalJSON(data []byte) error { // DataStatus - Describes the state of data in the Codat cache for a company and data type type DataStatus struct { - // The current status of the dataset in Codat's cache. - CurrentStatus string `json:"currentStatus"` + // The current status of the dataset. + CurrentStatus Status `json:"currentStatus"` // Available data types DataType DataTypes `json:"dataType"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -190,9 +189,9 @@ type DataStatus struct { LatestSyncID *string `json:"latestSyncId,omitempty"` } -func (o *DataStatus) GetCurrentStatus() string { +func (o *DataStatus) GetCurrentStatus() Status { if o == nil { - return "" + return Status("") } return o.CurrentStatus } diff --git a/sync-for-expenses/pkg/models/shared/datatype.go b/sync-for-expenses/pkg/models/shared/datatype.go index 11ef7ac08..1d26b3108 100644 --- a/sync-for-expenses/pkg/models/shared/datatype.go +++ b/sync-for-expenses/pkg/models/shared/datatype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -59,7 +59,6 @@ const ( func (e DataType) ToPointer() *DataType { return &e } - func (e *DataType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/errorvalidation.go b/sync-for-expenses/pkg/models/shared/errorvalidation.go index 89c18c7fc..3f12091c8 100644 --- a/sync-for-expenses/pkg/models/shared/errorvalidation.go +++ b/sync-for-expenses/pkg/models/shared/errorvalidation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/errorvalidationitem.go b/sync-for-expenses/pkg/models/shared/errorvalidationitem.go index 9a3c1252f..b97f640eb 100644 --- a/sync-for-expenses/pkg/models/shared/errorvalidationitem.go +++ b/sync-for-expenses/pkg/models/shared/errorvalidationitem.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/contactref.go b/sync-for-expenses/pkg/models/shared/expensecontactref.go similarity index 62% rename from sync-for-expenses/pkg/models/shared/contactref.go rename to sync-for-expenses/pkg/models/shared/expensecontactref.go index aa309bbc4..b844c8573 100644 --- a/sync-for-expenses/pkg/models/shared/contactref.go +++ b/sync-for-expenses/pkg/models/shared/expensecontactref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -18,7 +18,6 @@ const ( func (e Type) ToPointer() *Type { return &e } - func (e *Type) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -33,32 +32,32 @@ func (e *Type) UnmarshalJSON(data []byte) error { } } -type ContactRef struct { +type ExpenseContactRef struct { // Identifier of supplier or customer. - ID *string `json:"id,omitempty"` + ID string `json:"id"` // The type of contact. Type *Type `default:"Supplier" json:"type"` } -func (c ContactRef) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(c, "", false) +func (e ExpenseContactRef) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(e, "", false) } -func (c *ContactRef) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &c, "", false, false); err != nil { +func (e *ExpenseContactRef) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &e, "", false, false); err != nil { return err } return nil } -func (o *ContactRef) GetID() *string { +func (o *ExpenseContactRef) GetID() string { if o == nil { - return nil + return "" } return o.ID } -func (o *ContactRef) GetType() *Type { +func (o *ExpenseContactRef) GetType() *Type { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/expensetransaction.go b/sync-for-expenses/pkg/models/shared/expensetransaction.go index 6fd7e3630..41e146f81 100644 --- a/sync-for-expenses/pkg/models/shared/expensetransaction.go +++ b/sync-for-expenses/pkg/models/shared/expensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -9,12 +9,12 @@ import ( "github.com/ericlagergren/decimal" ) -type ExpenseTransactionBankAccountReference struct { +type BankAccountReference struct { // Identifier of the bank account. ID *string `json:"id,omitempty"` } -func (o *ExpenseTransactionBankAccountReference) GetID() *string { +func (o *BankAccountReference) GetID() *string { if o == nil { return nil } @@ -25,20 +25,15 @@ func (o *ExpenseTransactionBankAccountReference) GetID() *string { type ExpenseTransactionType string const ( - ExpenseTransactionTypePayment ExpenseTransactionType = "Payment" - ExpenseTransactionTypeRefund ExpenseTransactionType = "Refund" - ExpenseTransactionTypeReward ExpenseTransactionType = "Reward" - ExpenseTransactionTypeChargeback ExpenseTransactionType = "Chargeback" - ExpenseTransactionTypeTransferIn ExpenseTransactionType = "TransferIn" - ExpenseTransactionTypeTransferOut ExpenseTransactionType = "TransferOut" - ExpenseTransactionTypeAdjustmentIn ExpenseTransactionType = "AdjustmentIn" - ExpenseTransactionTypeAdjustmentOut ExpenseTransactionType = "AdjustmentOut" + ExpenseTransactionTypePayment ExpenseTransactionType = "Payment" + ExpenseTransactionTypeRefund ExpenseTransactionType = "Refund" + ExpenseTransactionTypeReward ExpenseTransactionType = "Reward" + ExpenseTransactionTypeChargeback ExpenseTransactionType = "Chargeback" ) func (e ExpenseTransactionType) ToPointer() *ExpenseTransactionType { return &e } - func (e *ExpenseTransactionType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { @@ -52,14 +47,6 @@ func (e *ExpenseTransactionType) UnmarshalJSON(data []byte) error { case "Reward": fallthrough case "Chargeback": - fallthrough - case "TransferIn": - fallthrough - case "TransferOut": - fallthrough - case "AdjustmentIn": - fallthrough - case "AdjustmentOut": *e = ExpenseTransactionType(v) return nil default: @@ -68,8 +55,8 @@ func (e *ExpenseTransactionType) UnmarshalJSON(data []byte) error { } type ExpenseTransaction struct { - BankAccountRef *ExpenseTransactionBankAccountReference `json:"bankAccountRef,omitempty"` - ContactRef *ContactRef `json:"contactRef,omitempty"` + BankAccountRef *BankAccountReference `json:"bankAccountRef,omitempty"` + ContactRef *ExpenseContactRef `json:"contactRef,omitempty"` // Currency the transaction was recorded in. Currency string `json:"currency"` // Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. @@ -78,9 +65,9 @@ type ExpenseTransaction struct { // // It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. // - // Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + // Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). // - // For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + // For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. // // ## Examples with base currency of GBP // @@ -103,7 +90,7 @@ type ExpenseTransaction struct { // // | Integration | Scenario | System behavior | // |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | CurrencyRate *decimal.Big `decimal:"number" json:"currencyRate,omitempty"` // Your unique identifier for the transaction. ID string `json:"id"` @@ -133,7 +120,7 @@ type ExpenseTransaction struct { MerchantName *string `json:"merchantName,omitempty"` // Any private, company notes about the transaction. Notes *string `json:"notes,omitempty"` - // For supported accouting platforms, setting this optional property to true will post the transaction to a drafted state. + // This optional property, when set to true, posts the transaction to a drafted state. Note that postAsDraft is only supported in Microsoft Dynamics 365 Business Central. PostAsDraft *bool `json:"postAsDraft,omitempty"` // The type of transaction. Type ExpenseTransactionType `json:"type"` @@ -150,14 +137,14 @@ func (e *ExpenseTransaction) UnmarshalJSON(data []byte) error { return nil } -func (o *ExpenseTransaction) GetBankAccountRef() *ExpenseTransactionBankAccountReference { +func (o *ExpenseTransaction) GetBankAccountRef() *BankAccountReference { if o == nil { return nil } return o.BankAccountRef } -func (o *ExpenseTransaction) GetContactRef() *ContactRef { +func (o *ExpenseTransaction) GetContactRef() *ExpenseContactRef { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/expensetransactionline.go b/sync-for-expenses/pkg/models/shared/expensetransactionline.go index 8dcdd6411..623781b21 100644 --- a/sync-for-expenses/pkg/models/shared/expensetransactionline.go +++ b/sync-for-expenses/pkg/models/shared/expensetransactionline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -8,9 +8,10 @@ import ( ) type ExpenseTransactionLine struct { - AccountRef RecordRef `json:"accountRef"` - // Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + AccountRef *RecordRef `json:"accountRef,omitempty"` + // Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. InvoiceTo *InvoiceTo `json:"invoiceTo,omitempty"` + ItemRef *ItemRef `json:"itemRef,omitempty"` // Amount of the line, exclusive of tax. NetAmount *decimal.Big `decimal:"number" json:"netAmount"` // Amount of tax for the line. @@ -30,9 +31,9 @@ func (e *ExpenseTransactionLine) UnmarshalJSON(data []byte) error { return nil } -func (o *ExpenseTransactionLine) GetAccountRef() RecordRef { +func (o *ExpenseTransactionLine) GetAccountRef() *RecordRef { if o == nil { - return RecordRef{} + return nil } return o.AccountRef } @@ -44,6 +45,13 @@ func (o *ExpenseTransactionLine) GetInvoiceTo() *InvoiceTo { return o.InvoiceTo } +func (o *ExpenseTransactionLine) GetItemRef() *ItemRef { + if o == nil { + return nil + } + return o.ItemRef +} + func (o *ExpenseTransactionLine) GetNetAmount() *decimal.Big { if o == nil { return new(decimal.Big).SetFloat64(0.0) diff --git a/sync-for-expenses/pkg/models/shared/groupitems.go b/sync-for-expenses/pkg/models/shared/groupitems.go deleted file mode 100644 index 61c4ba1f7..000000000 --- a/sync-for-expenses/pkg/models/shared/groupitems.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type GroupItems struct { - // Unique identifier for the group. - ID *string `json:"id,omitempty"` -} - -func (o *GroupItems) GetID() *string { - if o == nil { - return nil - } - return o.ID -} diff --git a/sync-for-expenses/pkg/models/shared/halref.go b/sync-for-expenses/pkg/models/shared/halref.go index 06ee18c03..f7b86c830 100644 --- a/sync-for-expenses/pkg/models/shared/halref.go +++ b/sync-for-expenses/pkg/models/shared/halref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/initiatesync.go b/sync-for-expenses/pkg/models/shared/initiatesync.go deleted file mode 100644 index a31f02657..000000000 --- a/sync-for-expenses/pkg/models/shared/initiatesync.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type InitiateSync struct { - DatasetIds []string `json:"datasetIds,omitempty"` -} - -func (o *InitiateSync) GetDatasetIds() []string { - if o == nil { - return nil - } - return o.DatasetIds -} diff --git a/sync-for-expenses/pkg/models/shared/integrationtype.go b/sync-for-expenses/pkg/models/shared/integrationtype.go index 1911266ea..dd72b134a 100644 --- a/sync-for-expenses/pkg/models/shared/integrationtype.go +++ b/sync-for-expenses/pkg/models/shared/integrationtype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -18,7 +18,6 @@ const ( func (e IntegrationType) ToPointer() *IntegrationType { return &e } - func (e *IntegrationType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/invoiceto.go b/sync-for-expenses/pkg/models/shared/invoiceto.go index fc21de8e6..d5ed25e9d 100644 --- a/sync-for-expenses/pkg/models/shared/invoiceto.go +++ b/sync-for-expenses/pkg/models/shared/invoiceto.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -7,49 +7,48 @@ import ( "fmt" ) -// InvoiceToDataType - The type of contact. -type InvoiceToDataType string +// InvoiceToType - The type of contact. +type InvoiceToType string const ( - InvoiceToDataTypeCustomers InvoiceToDataType = "customers" + InvoiceToTypeCustomer InvoiceToType = "customer" ) -func (e InvoiceToDataType) ToPointer() *InvoiceToDataType { +func (e InvoiceToType) ToPointer() *InvoiceToType { return &e } - -func (e *InvoiceToDataType) UnmarshalJSON(data []byte) error { +func (e *InvoiceToType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err } switch v { - case "customers": - *e = InvoiceToDataType(v) + case "customer": + *e = InvoiceToType(v) return nil default: - return fmt.Errorf("invalid value for InvoiceToDataType: %v", v) + return fmt.Errorf("invalid value for InvoiceToType: %v", v) } } -// InvoiceTo - Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. +// InvoiceTo - Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. type InvoiceTo struct { - // The type of contact. - DataType *InvoiceToDataType `json:"dataType,omitempty"` // identifier of customer. ID *string `json:"id,omitempty"` + // The type of contact. + Type *InvoiceToType `json:"type,omitempty"` } -func (o *InvoiceTo) GetDataType() *InvoiceToDataType { +func (o *InvoiceTo) GetID() *string { if o == nil { return nil } - return o.DataType + return o.ID } -func (o *InvoiceTo) GetID() *string { +func (o *InvoiceTo) GetType() *InvoiceToType { if o == nil { return nil } - return o.ID + return o.Type } diff --git a/sync-for-expenses/pkg/models/shared/itemref.go b/sync-for-expenses/pkg/models/shared/itemref.go new file mode 100644 index 000000000..f63230671 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/itemref.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ItemRef struct { + // Unique identifier for the item associated with the transaction. The `itemRef` object is currently supported only for QuickBooks Desktop. You can specify either `itemRef` or `accountRef`, but not both. + ID *string `json:"id,omitempty"` +} + +func (o *ItemRef) GetID() *string { + if o == nil { + return nil + } + return o.ID +} diff --git a/sync-for-expenses/pkg/models/shared/items.go b/sync-for-expenses/pkg/models/shared/items.go index 7420f7b61..c107c0ebb 100644 --- a/sync-for-expenses/pkg/models/shared/items.go +++ b/sync-for-expenses/pkg/models/shared/items.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/links.go b/sync-for-expenses/pkg/models/shared/links.go index df8dac300..9feb26261 100644 --- a/sync-for-expenses/pkg/models/shared/links.go +++ b/sync-for-expenses/pkg/models/shared/links.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/mappingoptions.go b/sync-for-expenses/pkg/models/shared/mappingoptions.go index dca2fa8d1..c8e02e9aa 100644 --- a/sync-for-expenses/pkg/models/shared/mappingoptions.go +++ b/sync-for-expenses/pkg/models/shared/mappingoptions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/metadata.go b/sync-for-expenses/pkg/models/shared/metadata.go index 85a209bbb..851caf39d 100644 --- a/sync-for-expenses/pkg/models/shared/metadata.go +++ b/sync-for-expenses/pkg/models/shared/metadata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/phonenumbertype.go b/sync-for-expenses/pkg/models/shared/phonenumbertype.go index 650172b3f..f9ed3f44c 100644 --- a/sync-for-expenses/pkg/models/shared/phonenumbertype.go +++ b/sync-for-expenses/pkg/models/shared/phonenumbertype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e PhoneNumberType) ToPointer() *PhoneNumberType { return &e } - func (e *PhoneNumberType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/pulloperation.go b/sync-for-expenses/pkg/models/shared/pulloperation.go index 65ca724a4..052fbc10a 100644 --- a/sync-for-expenses/pkg/models/shared/pulloperation.go +++ b/sync-for-expenses/pkg/models/shared/pulloperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -7,40 +7,37 @@ import ( "fmt" ) -// Status - The current status of the pull operation. -type Status string +// DatasetStatus - The current status of the dataset. +type DatasetStatus string const ( - StatusInitial Status = "Initial" - StatusQueued Status = "Queued" - StatusFetching Status = "Fetching" - StatusMapQueued Status = "MapQueued" - StatusMapping Status = "Mapping" - StatusComplete Status = "Complete" - StatusFetchError Status = "FetchError" - StatusMapError Status = "MapError" - StatusInternalError Status = "InternalError" - StatusProcessingQueued Status = "ProcessingQueued" - StatusProcessing Status = "Processing" - StatusProcessingError Status = "ProcessingError" - StatusValidationQueued Status = "ValidationQueued" - StatusValidating Status = "Validating" - StatusValidationError Status = "ValidationError" - StatusAuthError Status = "AuthError" - StatusCancelled Status = "Cancelled" - StatusRouting Status = "Routing" - StatusRoutingError Status = "RoutingError" - StatusNotSupported Status = "NotSupported" - StatusRateLimitError Status = "RateLimitError" - StatusPermissionsError Status = "PermissionsError" - StatusPrerequisiteNotMet Status = "PrerequisiteNotMet" + DatasetStatusInitial DatasetStatus = "Initial" + DatasetStatusQueued DatasetStatus = "Queued" + DatasetStatusFetching DatasetStatus = "Fetching" + DatasetStatusMapQueued DatasetStatus = "MapQueued" + DatasetStatusMapping DatasetStatus = "Mapping" + DatasetStatusComplete DatasetStatus = "Complete" + DatasetStatusFetchError DatasetStatus = "FetchError" + DatasetStatusMapError DatasetStatus = "MapError" + DatasetStatusInternalError DatasetStatus = "InternalError" + DatasetStatusProcessingQueued DatasetStatus = "ProcessingQueued" + DatasetStatusProcessing DatasetStatus = "Processing" + DatasetStatusProcessingError DatasetStatus = "ProcessingError" + DatasetStatusValidationQueued DatasetStatus = "ValidationQueued" + DatasetStatusValidating DatasetStatus = "Validating" + DatasetStatusValidationError DatasetStatus = "ValidationError" + DatasetStatusAuthError DatasetStatus = "AuthError" + DatasetStatusCancelled DatasetStatus = "Cancelled" + DatasetStatusNotSupported DatasetStatus = "NotSupported" + DatasetStatusRateLimitError DatasetStatus = "RateLimitError" + DatasetStatusPermissionsError DatasetStatus = "PermissionsError" + DatasetStatusPrerequisiteNotMet DatasetStatus = "PrerequisiteNotMet" ) -func (e Status) ToPointer() *Status { +func (e DatasetStatus) ToPointer() *DatasetStatus { return &e } - -func (e *Status) UnmarshalJSON(data []byte) error { +func (e *DatasetStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -80,10 +77,6 @@ func (e *Status) UnmarshalJSON(data []byte) error { fallthrough case "Cancelled": fallthrough - case "Routing": - fallthrough - case "RoutingError": - fallthrough case "NotSupported": fallthrough case "RateLimitError": @@ -91,10 +84,10 @@ func (e *Status) UnmarshalJSON(data []byte) error { case "PermissionsError": fallthrough case "PrerequisiteNotMet": - *e = Status(v) + *e = DatasetStatus(v) return nil default: - return fmt.Errorf("invalid value for Status: %v", v) + return fmt.Errorf("invalid value for DatasetStatus: %v", v) } } @@ -127,7 +120,7 @@ type PullOperation struct { ConnectionID string `json:"connectionId"` // The data type you are requesting in a pull operation. DataType string `json:"dataType"` - // A message about a transient or persistent error. + // A message about a transient or persistent error returned by Codat or the source platform. ErrorMessage *string `json:"errorMessage,omitempty"` // Unique identifier of the pull operation. ID string `json:"id"` @@ -157,8 +150,8 @@ type PullOperation struct { // > Not all dates from Codat will contain information about time zones. // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. Requested string `json:"requested"` - // The current status of the pull operation. - Status Status `json:"status"` + // The current status of the dataset. + Status DatasetStatus `json:"status"` // Additional information about the dataset status. StatusDescription *string `json:"statusDescription,omitempty"` } @@ -233,9 +226,9 @@ func (o *PullOperation) GetRequested() string { return o.Requested } -func (o *PullOperation) GetStatus() Status { +func (o *PullOperation) GetStatus() DatasetStatus { if o == nil { - return Status("") + return DatasetStatus("") } return o.Status } diff --git a/sync-for-expenses/pkg/models/shared/pulloperations.go b/sync-for-expenses/pkg/models/shared/pulloperations.go index 36591729b..279571670 100644 --- a/sync-for-expenses/pkg/models/shared/pulloperations.go +++ b/sync-for-expenses/pkg/models/shared/pulloperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushchangetype.go b/sync-for-expenses/pkg/models/shared/pushchangetype.go index af522940e..d7a3d7a69 100644 --- a/sync-for-expenses/pkg/models/shared/pushchangetype.go +++ b/sync-for-expenses/pkg/models/shared/pushchangetype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e PushChangeType) ToPointer() *PushChangeType { return &e } - func (e *PushChangeType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/pushfieldvalidation.go b/sync-for-expenses/pkg/models/shared/pushfieldvalidation.go index bfe6460d6..02899cb77 100644 --- a/sync-for-expenses/pkg/models/shared/pushfieldvalidation.go +++ b/sync-for-expenses/pkg/models/shared/pushfieldvalidation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoperation.go b/sync-for-expenses/pkg/models/shared/pushoperation.go index 09e4ce8fa..fdb1a3ceb 100644 --- a/sync-for-expenses/pkg/models/shared/pushoperation.go +++ b/sync-for-expenses/pkg/models/shared/pushoperation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoperationchange.go b/sync-for-expenses/pkg/models/shared/pushoperationchange.go index 500f01617..f7471e9a3 100644 --- a/sync-for-expenses/pkg/models/shared/pushoperationchange.go +++ b/sync-for-expenses/pkg/models/shared/pushoperationchange.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoperationref.go b/sync-for-expenses/pkg/models/shared/pushoperationref.go index f882e6a31..3e9ac25c0 100644 --- a/sync-for-expenses/pkg/models/shared/pushoperationref.go +++ b/sync-for-expenses/pkg/models/shared/pushoperationref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoperations.go b/sync-for-expenses/pkg/models/shared/pushoperations.go index 9d2ed7c86..23e30831d 100644 --- a/sync-for-expenses/pkg/models/shared/pushoperations.go +++ b/sync-for-expenses/pkg/models/shared/pushoperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoperationstatus.go b/sync-for-expenses/pkg/models/shared/pushoperationstatus.go index a795bac79..2f7070a10 100644 --- a/sync-for-expenses/pkg/models/shared/pushoperationstatus.go +++ b/sync-for-expenses/pkg/models/shared/pushoperationstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -20,7 +20,6 @@ const ( func (e PushOperationStatus) ToPointer() *PushOperationStatus { return &e } - func (e *PushOperationStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/pushoption.go b/sync-for-expenses/pkg/models/shared/pushoption.go index 39df89775..f0de79dcc 100644 --- a/sync-for-expenses/pkg/models/shared/pushoption.go +++ b/sync-for-expenses/pkg/models/shared/pushoption.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoptionchoice.go b/sync-for-expenses/pkg/models/shared/pushoptionchoice.go index 0e5cffbd5..e36c2c799 100644 --- a/sync-for-expenses/pkg/models/shared/pushoptionchoice.go +++ b/sync-for-expenses/pkg/models/shared/pushoptionchoice.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoptionproperty.go b/sync-for-expenses/pkg/models/shared/pushoptionproperty.go index 51f5137e9..fea745b1a 100644 --- a/sync-for-expenses/pkg/models/shared/pushoptionproperty.go +++ b/sync-for-expenses/pkg/models/shared/pushoptionproperty.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/pushoptiontype.go b/sync-for-expenses/pkg/models/shared/pushoptiontype.go index 799d12d4e..8049ad49a 100644 --- a/sync-for-expenses/pkg/models/shared/pushoptiontype.go +++ b/sync-for-expenses/pkg/models/shared/pushoptiontype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -24,7 +24,6 @@ const ( func (e PushOptionType) ToPointer() *PushOptionType { return &e } - func (e *PushOptionType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/pushvalidationinfo.go b/sync-for-expenses/pkg/models/shared/pushvalidationinfo.go index eb5756f08..c8f167d02 100644 --- a/sync-for-expenses/pkg/models/shared/pushvalidationinfo.go +++ b/sync-for-expenses/pkg/models/shared/pushvalidationinfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/recordref.go b/sync-for-expenses/pkg/models/shared/recordref.go index c205ea2e3..cc2c1b930 100644 --- a/sync-for-expenses/pkg/models/shared/recordref.go +++ b/sync-for-expenses/pkg/models/shared/recordref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/reimbursableexpensetransaction.go b/sync-for-expenses/pkg/models/shared/reimbursableexpensetransaction.go index 376692d43..19ff9f4b0 100644 --- a/sync-for-expenses/pkg/models/shared/reimbursableexpensetransaction.go +++ b/sync-for-expenses/pkg/models/shared/reimbursableexpensetransaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -7,21 +7,8 @@ import ( "github.com/ericlagergren/decimal" ) -type BankAccountReference struct { - // Identifier of the bank account. - ID *string `json:"id,omitempty"` -} - -func (o *BankAccountReference) GetID() *string { - if o == nil { - return nil - } - return o.ID -} - type ReimbursableExpenseTransaction struct { - AllOf interface{} `json:"allOf,omitempty"` - BankAccountRef *BankAccountReference `json:"bankAccountRef,omitempty"` + ContactRef ReimbursementContactRef `json:"contactRef"` // Currency the transaction was recorded in. Currency string `json:"currency"` // Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. @@ -30,9 +17,9 @@ type ReimbursableExpenseTransaction struct { // // It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. // - // Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + // Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). // - // For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + // For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. // // ## Examples with base currency of GBP // @@ -55,9 +42,28 @@ type ReimbursableExpenseTransaction struct { // // | Integration | Scenario | System behavior | // |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | CurrencyRate *decimal.Big `decimal:"number" json:"currencyRate,omitempty"` - DueDate interface{} `json:"dueDate"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + DueDate string `json:"dueDate"` // Your unique identifier for the transaction. ID string `json:"id"` // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: @@ -83,8 +89,7 @@ type ReimbursableExpenseTransaction struct { // Array of transaction lines. Lines []ReimbursableExpenseTransactionLine `json:"lines,omitempty"` // Any private, company notes about the transaction. - Notes *string `json:"notes,omitempty"` - RecordRef *ContactRef `json:"recordRef,omitempty"` + Notes *string `json:"notes,omitempty"` // User-friendly reference for the reimbursable expense. Reference *string `json:"reference,omitempty"` } @@ -100,18 +105,11 @@ func (r *ReimbursableExpenseTransaction) UnmarshalJSON(data []byte) error { return nil } -func (o *ReimbursableExpenseTransaction) GetAllOf() interface{} { - if o == nil { - return nil - } - return o.AllOf -} - -func (o *ReimbursableExpenseTransaction) GetBankAccountRef() *BankAccountReference { +func (o *ReimbursableExpenseTransaction) GetContactRef() ReimbursementContactRef { if o == nil { - return nil + return ReimbursementContactRef{} } - return o.BankAccountRef + return o.ContactRef } func (o *ReimbursableExpenseTransaction) GetCurrency() string { @@ -128,9 +126,9 @@ func (o *ReimbursableExpenseTransaction) GetCurrencyRate() *decimal.Big { return o.CurrencyRate } -func (o *ReimbursableExpenseTransaction) GetDueDate() interface{} { +func (o *ReimbursableExpenseTransaction) GetDueDate() string { if o == nil { - return nil + return "" } return o.DueDate } @@ -163,13 +161,6 @@ func (o *ReimbursableExpenseTransaction) GetNotes() *string { return o.Notes } -func (o *ReimbursableExpenseTransaction) GetRecordRef() *ContactRef { - if o == nil { - return nil - } - return o.RecordRef -} - func (o *ReimbursableExpenseTransaction) GetReference() *string { if o == nil { return nil diff --git a/sync-for-expenses/pkg/models/shared/reimbursableexpensetransactionline.go b/sync-for-expenses/pkg/models/shared/reimbursableexpensetransactionline.go index 4b2d72bd8..47af7267a 100644 --- a/sync-for-expenses/pkg/models/shared/reimbursableexpensetransactionline.go +++ b/sync-for-expenses/pkg/models/shared/reimbursableexpensetransactionline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -8,9 +8,12 @@ import ( ) type ReimbursableExpenseTransactionLine struct { - AccountRef RecordRef `json:"accountRef"` - // Unique identifier of the customer the expense is billable to. The invoiceTo object is currently only supported for QBO. + AccountRef *RecordRef `json:"accountRef,omitempty"` + // line description + Description *string `json:"description,omitempty"` + // Unique identifier for the customer billed for the transaction. The `invoiceTo` object is currently supported only for QuickBooks Online and QuickBooks Desktop. InvoiceTo *InvoiceTo `json:"invoiceTo,omitempty"` + ItemRef *ItemRef `json:"itemRef,omitempty"` // Amount of the line, exclusive of tax. NetAmount *decimal.Big `decimal:"number" json:"netAmount"` // Amount of tax for the line. @@ -30,13 +33,20 @@ func (r *ReimbursableExpenseTransactionLine) UnmarshalJSON(data []byte) error { return nil } -func (o *ReimbursableExpenseTransactionLine) GetAccountRef() RecordRef { +func (o *ReimbursableExpenseTransactionLine) GetAccountRef() *RecordRef { if o == nil { - return RecordRef{} + return nil } return o.AccountRef } +func (o *ReimbursableExpenseTransactionLine) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + func (o *ReimbursableExpenseTransactionLine) GetInvoiceTo() *InvoiceTo { if o == nil { return nil @@ -44,6 +54,13 @@ func (o *ReimbursableExpenseTransactionLine) GetInvoiceTo() *InvoiceTo { return o.InvoiceTo } +func (o *ReimbursableExpenseTransactionLine) GetItemRef() *ItemRef { + if o == nil { + return nil + } + return o.ItemRef +} + func (o *ReimbursableExpenseTransactionLine) GetNetAmount() *decimal.Big { if o == nil { return new(decimal.Big).SetFloat64(0.0) diff --git a/sync-for-expenses/pkg/models/shared/reimbursementcontactref.go b/sync-for-expenses/pkg/models/shared/reimbursementcontactref.go new file mode 100644 index 000000000..76838c554 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/reimbursementcontactref.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type ReimbursementContactRef struct { + // Identifier of contact. + ID string `json:"id"` +} + +func (o *ReimbursementContactRef) GetID() string { + if o == nil { + return "" + } + return o.ID +} diff --git a/sync-for-expenses/pkg/models/shared/schemadatatype.go b/sync-for-expenses/pkg/models/shared/schemadatatype.go index 5886f053d..8d4d8cb8c 100644 --- a/sync-for-expenses/pkg/models/shared/schemadatatype.go +++ b/sync-for-expenses/pkg/models/shared/schemadatatype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -59,7 +59,6 @@ const ( func (e SchemaDataType) ToPointer() *SchemaDataType { return &e } - func (e *SchemaDataType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/security.go b/sync-for-expenses/pkg/models/shared/security.go index 5d91435a8..e1f80d158 100644 --- a/sync-for-expenses/pkg/models/shared/security.go +++ b/sync-for-expenses/pkg/models/shared/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/status.go b/sync-for-expenses/pkg/models/shared/status.go new file mode 100644 index 000000000..b3ce257f4 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/status.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// Status - The current status of the dataset. +type Status string + +const ( + StatusInitial Status = "Initial" + StatusQueued Status = "Queued" + StatusFetching Status = "Fetching" + StatusMapQueued Status = "MapQueued" + StatusMapping Status = "Mapping" + StatusComplete Status = "Complete" + StatusFetchError Status = "FetchError" + StatusMapError Status = "MapError" + StatusInternalError Status = "InternalError" + StatusProcessingQueued Status = "ProcessingQueued" + StatusProcessing Status = "Processing" + StatusProcessingError Status = "ProcessingError" + StatusValidationQueued Status = "ValidationQueued" + StatusValidating Status = "Validating" + StatusValidationError Status = "ValidationError" + StatusAuthError Status = "AuthError" + StatusCancelled Status = "Cancelled" + StatusNotSupported Status = "NotSupported" + StatusRateLimitError Status = "RateLimitError" + StatusPermissionsError Status = "PermissionsError" + StatusPrerequisiteNotMet Status = "PrerequisiteNotMet" +) + +func (e Status) ToPointer() *Status { + return &e +} +func (e *Status) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Initial": + fallthrough + case "Queued": + fallthrough + case "Fetching": + fallthrough + case "MapQueued": + fallthrough + case "Mapping": + fallthrough + case "Complete": + fallthrough + case "FetchError": + fallthrough + case "MapError": + fallthrough + case "InternalError": + fallthrough + case "ProcessingQueued": + fallthrough + case "Processing": + fallthrough + case "ProcessingError": + fallthrough + case "ValidationQueued": + fallthrough + case "Validating": + fallthrough + case "ValidationError": + fallthrough + case "AuthError": + fallthrough + case "Cancelled": + fallthrough + case "NotSupported": + fallthrough + case "RateLimitError": + fallthrough + case "PermissionsError": + fallthrough + case "PrerequisiteNotMet": + *e = Status(v) + return nil + default: + return fmt.Errorf("invalid value for Status: %v", v) + } +} diff --git a/sync-for-expenses/pkg/models/shared/supplementaldata.go b/sync-for-expenses/pkg/models/shared/supplementaldata.go index edb51f9fc..8e62d3efc 100644 --- a/sync-for-expenses/pkg/models/shared/supplementaldata.go +++ b/sync-for-expenses/pkg/models/shared/supplementaldata.go @@ -1,15 +1,15 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared // SupplementalData - Supplemental data is additional data you can include in our standard data types. // -// It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. +// It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. type SupplementalData struct { - Content map[string]map[string]interface{} `json:"content,omitempty"` + Content map[string]map[string]any `json:"content,omitempty"` } -func (o *SupplementalData) GetContent() map[string]map[string]interface{} { +func (o *SupplementalData) GetContent() map[string]map[string]any { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/supplier.go b/sync-for-expenses/pkg/models/shared/supplier.go index 7b4b37860..37f8abf45 100644 --- a/sync-for-expenses/pkg/models/shared/supplier.go +++ b/sync-for-expenses/pkg/models/shared/supplier.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -16,7 +16,7 @@ type Supplier struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address that the supplier may be contacted on. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the supplier, unique to the company in the accounting platform. + // Identifier for the supplier, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -29,7 +29,7 @@ type Supplier struct { Status SupplierStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Name of the supplier as recorded in the accounting system, typically the company name. SupplierName *string `json:"supplierName,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/supplierdetails.go b/sync-for-expenses/pkg/models/shared/supplierdetails.go index 9d48e1f2b..221be63af 100644 --- a/sync-for-expenses/pkg/models/shared/supplierdetails.go +++ b/sync-for-expenses/pkg/models/shared/supplierdetails.go @@ -1,9 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared type SupplierDetails struct { - // Identifier for the supplier, unique to the company in the accounting platform. + // Identifier for the supplier, unique to the company in the accounting software. ID *string `json:"id,omitempty"` } diff --git a/sync-for-expenses/pkg/models/shared/suppliers.go b/sync-for-expenses/pkg/models/shared/suppliers.go index be2a81292..2073abdfa 100644 --- a/sync-for-expenses/pkg/models/shared/suppliers.go +++ b/sync-for-expenses/pkg/models/shared/suppliers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/supplierstatus.go b/sync-for-expenses/pkg/models/shared/supplierstatus.go index 57c2c2c4b..3a697817b 100644 --- a/sync-for-expenses/pkg/models/shared/supplierstatus.go +++ b/sync-for-expenses/pkg/models/shared/supplierstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -19,7 +19,6 @@ const ( func (e SupplierStatus) ToPointer() *SupplierStatus { return &e } - func (e *SupplierStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/synccompletewebhook.go b/sync-for-expenses/pkg/models/shared/synccompletewebhook.go index 7be470fdc..077671454 100644 --- a/sync-for-expenses/pkg/models/shared/synccompletewebhook.go +++ b/sync-for-expenses/pkg/models/shared/synccompletewebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/synccompletewebhookdata.go b/sync-for-expenses/pkg/models/shared/synccompletewebhookdata.go index a98a7b829..4bed4368c 100644 --- a/sync-for-expenses/pkg/models/shared/synccompletewebhookdata.go +++ b/sync-for-expenses/pkg/models/shared/synccompletewebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/syncfailedwebhook.go b/sync-for-expenses/pkg/models/shared/syncfailedwebhook.go index e4e213950..8a52bc18d 100644 --- a/sync-for-expenses/pkg/models/shared/syncfailedwebhook.go +++ b/sync-for-expenses/pkg/models/shared/syncfailedwebhook.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/syncfailedwebhookdata.go b/sync-for-expenses/pkg/models/shared/syncfailedwebhookdata.go index 21799bc24..3e052f15e 100644 --- a/sync-for-expenses/pkg/models/shared/syncfailedwebhookdata.go +++ b/sync-for-expenses/pkg/models/shared/syncfailedwebhookdata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/syncinitiated.go b/sync-for-expenses/pkg/models/shared/syncinitiated.go deleted file mode 100644 index dd4bb86b3..000000000 --- a/sync-for-expenses/pkg/models/shared/syncinitiated.go +++ /dev/null @@ -1,15 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type SyncInitiated struct { - // Unique identifier for the sync initiated. - SyncID *string `json:"syncId,omitempty"` -} - -func (o *SyncInitiated) GetSyncID() *string { - if o == nil { - return nil - } - return o.SyncID -} diff --git a/sync-for-expenses/pkg/models/shared/syncstartedwebhook.go b/sync-for-expenses/pkg/models/shared/syncstartedwebhook.go deleted file mode 100644 index 4f242165e..000000000 --- a/sync-for-expenses/pkg/models/shared/syncstartedwebhook.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -type Data struct { - // Unique identifier for the failed sync. - SyncID *string `json:"syncId,omitempty"` - // The type of sync being performed. - SyncType *string `json:"syncType,omitempty"` -} - -func (o *Data) GetSyncID() *string { - if o == nil { - return nil - } - return o.SyncID -} - -func (o *Data) GetSyncType() *string { - if o == nil { - return nil - } - return o.SyncType -} - -// SyncStartedWebhook - Webhook request body used to notify that a sync has started. -type SyncStartedWebhook struct { - // Unique identifier of the webhook event. - AlertID *string `json:"AlertId,omitempty"` - // Unique identifier for your client in Codat. - ClientID *string `json:"ClientId,omitempty"` - // Name of your client in Codat. - ClientName *string `json:"ClientName,omitempty"` - // Unique identifier for your SMB in Codat. - CompanyID *string `json:"CompanyId,omitempty"` - Data *Data `json:"Data,omitempty"` - // A human-readable message about the webhook. - Message *string `json:"Message,omitempty"` - // Unique identifier for the rule. - // - // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - RuleID *string `json:"RuleId,omitempty"` - // The type of rule. - RuleType *string `json:"RuleType,omitempty"` -} - -func (o *SyncStartedWebhook) GetAlertID() *string { - if o == nil { - return nil - } - return o.AlertID -} - -func (o *SyncStartedWebhook) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - -func (o *SyncStartedWebhook) GetClientName() *string { - if o == nil { - return nil - } - return o.ClientName -} - -func (o *SyncStartedWebhook) GetCompanyID() *string { - if o == nil { - return nil - } - return o.CompanyID -} - -func (o *SyncStartedWebhook) GetData() *Data { - if o == nil { - return nil - } - return o.Data -} - -func (o *SyncStartedWebhook) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *SyncStartedWebhook) GetRuleID() *string { - if o == nil { - return nil - } - return o.RuleID -} - -func (o *SyncStartedWebhook) GetRuleType() *string { - if o == nil { - return nil - } - return o.RuleType -} diff --git a/sync-for-expenses/pkg/models/shared/taxratemappinginfo.go b/sync-for-expenses/pkg/models/shared/taxratemappinginfo.go index 5a9a68537..ce097b7a2 100644 --- a/sync-for-expenses/pkg/models/shared/taxratemappinginfo.go +++ b/sync-for-expenses/pkg/models/shared/taxratemappinginfo.go @@ -1,72 +1,25 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared import ( - "encoding/json" - "fmt" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "github.com/ericlagergren/decimal" ) -type TaxRateMappingInfoValidTransactionTypes string - -const ( - TaxRateMappingInfoValidTransactionTypesPayment TaxRateMappingInfoValidTransactionTypes = "Payment" - TaxRateMappingInfoValidTransactionTypesRefund TaxRateMappingInfoValidTransactionTypes = "Refund" - TaxRateMappingInfoValidTransactionTypesReward TaxRateMappingInfoValidTransactionTypes = "Reward" - TaxRateMappingInfoValidTransactionTypesChargeback TaxRateMappingInfoValidTransactionTypes = "Chargeback" - TaxRateMappingInfoValidTransactionTypesTransferIn TaxRateMappingInfoValidTransactionTypes = "TransferIn" - TaxRateMappingInfoValidTransactionTypesTransferOut TaxRateMappingInfoValidTransactionTypes = "TransferOut" - TaxRateMappingInfoValidTransactionTypesAdjustmentIn TaxRateMappingInfoValidTransactionTypes = "AdjustmentIn" - TaxRateMappingInfoValidTransactionTypesAdjustmentOut TaxRateMappingInfoValidTransactionTypes = "AdjustmentOut" -) - -func (e TaxRateMappingInfoValidTransactionTypes) ToPointer() *TaxRateMappingInfoValidTransactionTypes { - return &e -} - -func (e *TaxRateMappingInfoValidTransactionTypes) UnmarshalJSON(data []byte) error { - var v string - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case "Payment": - fallthrough - case "Refund": - fallthrough - case "Reward": - fallthrough - case "Chargeback": - fallthrough - case "TransferIn": - fallthrough - case "TransferOut": - fallthrough - case "AdjustmentIn": - fallthrough - case "AdjustmentOut": - *e = TaxRateMappingInfoValidTransactionTypes(v) - return nil - default: - return fmt.Errorf("invalid value for TaxRateMappingInfoValidTransactionTypes: %v", v) - } -} - type TaxRateMappingInfo struct { - // Code for the tax rate from the accounting platform. + // Code for the tax rate from the accounting software. Code *string `json:"code,omitempty"` // Effective tax rate. EffectiveTaxRate *decimal.Big `decimal:"number" json:"effectiveTaxRate,omitempty"` // Unique identifier of tax rate. ID *string `json:"id,omitempty"` - // Name of the tax rate in the accounting platform. + // Name of the tax rate in the accounting software. Name *string `json:"name,omitempty"` // Total (not compounded) sum of the components of a tax rate. TotalTaxRate *decimal.Big `decimal:"number" json:"totalTaxRate,omitempty"` // Supported transaction types for the account. - ValidTransactionTypes []TaxRateMappingInfoValidTransactionTypes `json:"validTransactionTypes,omitempty"` + ValidTransactionTypes []ValidTransactionTypes `json:"validTransactionTypes,omitempty"` } func (t TaxRateMappingInfo) MarshalJSON() ([]byte, error) { @@ -115,7 +68,7 @@ func (o *TaxRateMappingInfo) GetTotalTaxRate() *decimal.Big { return o.TotalTaxRate } -func (o *TaxRateMappingInfo) GetValidTransactionTypes() []TaxRateMappingInfoValidTransactionTypes { +func (o *TaxRateMappingInfo) GetValidTransactionTypes() []ValidTransactionTypes { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/shared/trackingcategorymappinginfo.go b/sync-for-expenses/pkg/models/shared/trackingcategorymappinginfo.go index fd3a40a89..9f815b6c4 100644 --- a/sync-for-expenses/pkg/models/shared/trackingcategorymappinginfo.go +++ b/sync-for-expenses/pkg/models/shared/trackingcategorymappinginfo.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -7,26 +7,6 @@ type TrackingCategoryMappingInfo struct { HasChildren *bool `json:"hasChildren,omitempty"` // Unique identifier of the tracking category. ID *string `json:"id,omitempty"` - // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: - // - // ``` - // 2020-10-08T22:40:50Z - // 2021-01-01T00:00:00 - // ``` - // - // - // - // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: - // - // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` - // - Unqualified local time: `2021-11-15T01:00:00` - // - UTC time offsets: `2021-11-15T01:00:00-05:00` - // - // > Time zones - // > - // > Not all dates from Codat will contain information about time zones. - // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. - ModifiedDate *string `json:"modifiedDate,omitempty"` // Name of the tracking category as it appears in the accounting software. Name *string `json:"name,omitempty"` // ID of the parent tracking category @@ -47,13 +27,6 @@ func (o *TrackingCategoryMappingInfo) GetID() *string { return o.ID } -func (o *TrackingCategoryMappingInfo) GetModifiedDate() *string { - if o == nil { - return nil - } - return o.ModifiedDate -} - func (o *TrackingCategoryMappingInfo) GetName() *string { if o == nil { return nil diff --git a/sync-for-expenses/pkg/models/shared/trackingref.go b/sync-for-expenses/pkg/models/shared/trackingref.go index 9d80524b4..3d3e67b51 100644 --- a/sync-for-expenses/pkg/models/shared/trackingref.go +++ b/sync-for-expenses/pkg/models/shared/trackingref.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -19,7 +19,6 @@ const ( func (e TrackingRefDataType) ToPointer() *TrackingRefDataType { return &e } - func (e *TrackingRefDataType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/trackingrefadjustmenttransaction.go b/sync-for-expenses/pkg/models/shared/trackingrefadjustmenttransaction.go new file mode 100644 index 000000000..ebda095ea --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/trackingrefadjustmenttransaction.go @@ -0,0 +1,71 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" +) + +// TrackingRefAdjustmentTransactionDataType - The type of the linked reference +type TrackingRefAdjustmentTransactionDataType string + +const ( + TrackingRefAdjustmentTransactionDataTypeTrackingCategories TrackingRefAdjustmentTransactionDataType = "trackingCategories" + TrackingRefAdjustmentTransactionDataTypeCustomers TrackingRefAdjustmentTransactionDataType = "customers" + TrackingRefAdjustmentTransactionDataTypeSuppliers TrackingRefAdjustmentTransactionDataType = "suppliers" +) + +func (e TrackingRefAdjustmentTransactionDataType) ToPointer() *TrackingRefAdjustmentTransactionDataType { + return &e +} +func (e *TrackingRefAdjustmentTransactionDataType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "trackingCategories": + fallthrough + case "customers": + fallthrough + case "suppliers": + *e = TrackingRefAdjustmentTransactionDataType(v) + return nil + default: + return fmt.Errorf("invalid value for TrackingRefAdjustmentTransactionDataType: %v", v) + } +} + +type TrackingRefAdjustmentTransaction struct { + // The type of the linked reference + DataType *TrackingRefAdjustmentTransactionDataType `default:"trackingCategories" json:"dataType"` + // Unique identifier of the linked reference from mapping options or the unique identifier of the linked customer or supplier. + ID *string `json:"id,omitempty"` +} + +func (t TrackingRefAdjustmentTransaction) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TrackingRefAdjustmentTransaction) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + +func (o *TrackingRefAdjustmentTransaction) GetDataType() *TrackingRefAdjustmentTransactionDataType { + if o == nil { + return nil + } + return o.DataType +} + +func (o *TrackingRefAdjustmentTransaction) GetID() *string { + if o == nil { + return nil + } + return o.ID +} diff --git a/sync-for-expenses/pkg/models/shared/transaction.go b/sync-for-expenses/pkg/models/shared/transaction.go index 5e8779e40..1276b1130 100644 --- a/sync-for-expenses/pkg/models/shared/transaction.go +++ b/sync-for-expenses/pkg/models/shared/transaction.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/transactions.go b/sync-for-expenses/pkg/models/shared/transactions.go index 0cc78efed..0fdc54c06 100644 --- a/sync-for-expenses/pkg/models/shared/transactions.go +++ b/sync-for-expenses/pkg/models/shared/transactions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/transactionstatus.go b/sync-for-expenses/pkg/models/shared/transactionstatus.go index dcae9c8d9..b58c4d455 100644 --- a/sync-for-expenses/pkg/models/shared/transactionstatus.go +++ b/sync-for-expenses/pkg/models/shared/transactionstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -21,7 +21,6 @@ const ( func (e TransactionStatus) ToPointer() *TransactionStatus { return &e } - func (e *TransactionStatus) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { diff --git a/sync-for-expenses/pkg/models/shared/transferdetails.go b/sync-for-expenses/pkg/models/shared/transferdetails.go deleted file mode 100644 index 421a8de29..000000000 --- a/sync-for-expenses/pkg/models/shared/transferdetails.go +++ /dev/null @@ -1,40 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package shared - -import ( - "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" - "github.com/ericlagergren/decimal" -) - -type TransferDetails struct { - // Data types that reference an account, for example bill and invoice line items, use an accountRef that includes the ID and name of the linked account. - AccountRef *AccountRef `json:"accountRef,omitempty"` - // Amount of the transfer. - Amount *decimal.Big `decimal:"number" json:"amount,omitempty"` -} - -func (t TransferDetails) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(t, "", false) -} - -func (t *TransferDetails) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { - return err - } - return nil -} - -func (o *TransferDetails) GetAccountRef() *AccountRef { - if o == nil { - return nil - } - return o.AccountRef -} - -func (o *TransferDetails) GetAmount() *decimal.Big { - if o == nil { - return nil - } - return o.Amount -} diff --git a/sync-for-expenses/pkg/models/shared/transfertransactionrequest.go b/sync-for-expenses/pkg/models/shared/transfertransactionrequest.go new file mode 100644 index 000000000..962a09de0 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/transfertransactionrequest.go @@ -0,0 +1,134 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +// AccountReference - Reference of the account you are transferring money from. +type AccountReference struct { + // 'id' from the Accounts data type. + ID string `json:"id"` +} + +func (o *AccountReference) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type From struct { + // Reference of the account you are transferring money from. + AccountRef AccountReference `json:"accountRef"` + // Amount that has been transferred from the account in the native currency of the account. + Amount *decimal.Big `decimal:"number" json:"amount"` +} + +func (f From) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(f, "", false) +} + +func (f *From) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { + return err + } + return nil +} + +func (o *From) GetAccountRef() AccountReference { + if o == nil { + return AccountReference{} + } + return o.AccountRef +} + +func (o *From) GetAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.Amount +} + +// TransferTransactionRequestAccountReference - Reference of the account you are transferring money to. +type TransferTransactionRequestAccountReference struct { + // 'id' from the Accounts data type. + ID string `json:"id"` +} + +func (o *TransferTransactionRequestAccountReference) GetID() string { + if o == nil { + return "" + } + return o.ID +} + +type To struct { + // Reference of the account you are transferring money to. + AccountRef TransferTransactionRequestAccountReference `json:"accountRef"` + // Amount that has been transferred to the account in the native currency of the account. + Amount *decimal.Big `decimal:"number" json:"amount"` +} + +func (t To) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *To) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, false); err != nil { + return err + } + return nil +} + +func (o *To) GetAccountRef() TransferTransactionRequestAccountReference { + if o == nil { + return TransferTransactionRequestAccountReference{} + } + return o.AccountRef +} + +func (o *To) GetAmount() *decimal.Big { + if o == nil { + return new(decimal.Big).SetFloat64(0.0) + } + return o.Amount +} + +type TransferTransactionRequest struct { + Date string `json:"date"` + // Any private, company notes about the transaction. + Description *string `json:"description,omitempty"` + From From `json:"from"` + To To `json:"to"` +} + +func (o *TransferTransactionRequest) GetDate() string { + if o == nil { + return "" + } + return o.Date +} + +func (o *TransferTransactionRequest) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *TransferTransactionRequest) GetFrom() From { + if o == nil { + return From{} + } + return o.From +} + +func (o *TransferTransactionRequest) GetTo() To { + if o == nil { + return To{} + } + return o.To +} diff --git a/sync-for-expenses/pkg/models/shared/transfertransactionresponse.go b/sync-for-expenses/pkg/models/shared/transfertransactionresponse.go new file mode 100644 index 000000000..0e35c21e3 --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/transfertransactionresponse.go @@ -0,0 +1,15 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type TransferTransactionResponse struct { + // Unique id of sync created + SyncID *string `json:"syncId,omitempty"` +} + +func (o *TransferTransactionResponse) GetSyncID() *string { + if o == nil { + return nil + } + return o.SyncID +} diff --git a/sync-for-expenses/pkg/models/shared/updatecustomerresponse.go b/sync-for-expenses/pkg/models/shared/updatecustomerresponse.go index fa2e48ce5..6f9feb4e4 100644 --- a/sync-for-expenses/pkg/models/shared/updatecustomerresponse.go +++ b/sync-for-expenses/pkg/models/shared/updatecustomerresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -96,7 +96,7 @@ type UpdateCustomerResponseAccountingCustomer struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address the customer can be contacted by. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the customer, unique to the company in the accounting platform. + // Identifier for the customer, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -109,7 +109,7 @@ type UpdateCustomerResponseAccountingCustomer struct { Status CustomerStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Company tax number. TaxNumber *string `json:"taxNumber,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/updateexpenserequest.go b/sync-for-expenses/pkg/models/shared/updateexpenserequest.go index 6be02ab32..0d95b2f06 100644 --- a/sync-for-expenses/pkg/models/shared/updateexpenserequest.go +++ b/sync-for-expenses/pkg/models/shared/updateexpenserequest.go @@ -1,8 +1,10 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared import ( + "encoding/json" + "fmt" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "github.com/ericlagergren/decimal" ) @@ -19,20 +21,53 @@ func (o *UpdateExpenseRequestBankAccountReference) GetID() *string { return o.ID } +// UpdateExpenseRequestType - The type of transaction. +type UpdateExpenseRequestType string + +const ( + UpdateExpenseRequestTypePayment UpdateExpenseRequestType = "Payment" + UpdateExpenseRequestTypeRefund UpdateExpenseRequestType = "Refund" + UpdateExpenseRequestTypeReward UpdateExpenseRequestType = "Reward" + UpdateExpenseRequestTypeChargeback UpdateExpenseRequestType = "Chargeback" +) + +func (e UpdateExpenseRequestType) ToPointer() *UpdateExpenseRequestType { + return &e +} +func (e *UpdateExpenseRequestType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Payment": + fallthrough + case "Refund": + fallthrough + case "Reward": + fallthrough + case "Chargeback": + *e = UpdateExpenseRequestType(v) + return nil + default: + return fmt.Errorf("invalid value for UpdateExpenseRequestType: %v", v) + } +} + type UpdateExpenseRequest struct { BankAccountRef *UpdateExpenseRequestBankAccountReference `json:"bankAccountRef,omitempty"` - ContactRef *ContactRef `json:"contactRef,omitempty"` + ContactRef *ExpenseContactRef `json:"contactRef,omitempty"` // Currency the transaction was recorded in. - Currency *string `json:"currency,omitempty"` + Currency string `json:"currency"` // Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. // // Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. // // It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. // - // Where the currency rate is provided by the underlying accounting platform, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + // Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). // - // For accounting platforms which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + // For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. // // ## Examples with base currency of GBP // @@ -55,7 +90,7 @@ type UpdateExpenseRequest struct { // // | Integration | Scenario | System behavior | // |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| - // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, include the required currency rate in the expense transaction. | + // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | CurrencyRate *decimal.Big `decimal:"number" json:"currencyRate,omitempty"` // Date the transaction was recorded. IssueDate string `json:"issueDate"` @@ -64,8 +99,9 @@ type UpdateExpenseRequest struct { // Name of the merchant where the purchase took place MerchantName *string `json:"merchantName,omitempty"` // Any private, company notes about the transaction. - Notes *string `json:"notes,omitempty"` - Type interface{} `json:"type"` + Notes *string `json:"notes,omitempty"` + // The type of transaction. + Type UpdateExpenseRequestType `json:"type"` } func (u UpdateExpenseRequest) MarshalJSON() ([]byte, error) { @@ -86,16 +122,16 @@ func (o *UpdateExpenseRequest) GetBankAccountRef() *UpdateExpenseRequestBankAcco return o.BankAccountRef } -func (o *UpdateExpenseRequest) GetContactRef() *ContactRef { +func (o *UpdateExpenseRequest) GetContactRef() *ExpenseContactRef { if o == nil { return nil } return o.ContactRef } -func (o *UpdateExpenseRequest) GetCurrency() *string { +func (o *UpdateExpenseRequest) GetCurrency() string { if o == nil { - return nil + return "" } return o.Currency } @@ -135,9 +171,9 @@ func (o *UpdateExpenseRequest) GetNotes() *string { return o.Notes } -func (o *UpdateExpenseRequest) GetType() interface{} { +func (o *UpdateExpenseRequest) GetType() UpdateExpenseRequestType { if o == nil { - return nil + return UpdateExpenseRequestType("") } return o.Type } diff --git a/sync-for-expenses/pkg/models/shared/updateexpenseresponse.go b/sync-for-expenses/pkg/models/shared/updateexpenseresponse.go index 0831cdf89..80cbbf0bf 100644 --- a/sync-for-expenses/pkg/models/shared/updateexpenseresponse.go +++ b/sync-for-expenses/pkg/models/shared/updateexpenseresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/updatereimbursableexpensetransactionrequest.go b/sync-for-expenses/pkg/models/shared/updatereimbursableexpensetransactionrequest.go new file mode 100644 index 000000000..7a3bb004a --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/updatereimbursableexpensetransactionrequest.go @@ -0,0 +1,160 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" + "github.com/ericlagergren/decimal" +) + +type UpdateReimbursableExpenseTransactionRequest struct { + ContactRef ReimbursementContactRef `json:"contactRef"` + // Currency the transaction was recorded in. + Currency string `json:"currency"` + // Rate to convert the total amount of the payment into the base currency for the company at the time of the payment. + // + // Currency rates in Codat are implemented as the multiple of foreign currency units to each base currency unit. + // + // It is not possible to perform the currency conversion with two or more non-base currencies participating in the transaction. For example, if a company's base currency is USD, and it has a bill issued in EUR, then the bill payment must happen in USD or EUR. + // + // Where the currency rate is provided by the underlying accounting software, it will be available from Codat with the same precision (up to a maximum of 9 decimal places). + // + // For accounting software which do not provide an explicit currency rate, it is calculated as `baseCurrency / foreignCurrency` and will be returned to 9 decimal places. + // + // ## Examples with base currency of GBP + // + // | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (GBP) | + // | :--------------- | :------------- | :------------ | :------------------------- | + // | **USD** | $20 | 0.781 | £15.62 | + // | **EUR** | €20 | 0.885 | £17.70 | + // | **RUB** | ₽20 | 0.011 | £0.22 | + // + // ## Examples with base currency of USD + // + // | Foreign Currency | Foreign Amount | Currency Rate | Base Currency Amount (USD) | + // | :--------------- | :------------- | :------------ | :------------------------- | + // | **GBP** | £20 | 1.277 | $25.54 | + // | **EUR** | €20 | 1.134 | $22.68 | + // | **RUB** | ₽20 | 0.015 | $0.30 | + // + // + // ### Integration-specific details + // + // | Integration | Scenario | System behavior | + // |-------------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| + // | QuickBooks Online | Transaction currency differs from base currency | If currency rate value is left `null`, a rate of 1 will be used by QBO by default. To override this, specify a currencyRate in the request body. | + CurrencyRate *decimal.Big `decimal:"number" json:"currencyRate,omitempty"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + DueDate string `json:"dueDate"` + // In Codat's data model, dates and times are represented using the ISO 8601 standard. Date and time fields are formatted as strings; for example: + // + // ``` + // 2020-10-08T22:40:50Z + // 2021-01-01T00:00:00 + // ``` + // + // + // + // When syncing data that contains `DateTime` fields from Codat, make sure you support the following cases when reading time information: + // + // - Coordinated Universal Time (UTC): `2021-11-15T06:00:00Z` + // - Unqualified local time: `2021-11-15T01:00:00` + // - UTC time offsets: `2021-11-15T01:00:00-05:00` + // + // > Time zones + // > + // > Not all dates from Codat will contain information about time zones. + // > Where it is not available from the underlying platform, Codat will return these as times local to the business whose data has been synced. + IssueDate string `json:"issueDate"` + // Array of transaction lines. + Lines []ReimbursableExpenseTransactionLine `json:"lines,omitempty"` + // Any private, company notes about the transaction. + Notes *string `json:"notes,omitempty"` + // User-friendly reference for the reimbursable expense. + Reference *string `json:"reference,omitempty"` +} + +func (u UpdateReimbursableExpenseTransactionRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateReimbursableExpenseTransactionRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + return err + } + return nil +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetContactRef() ReimbursementContactRef { + if o == nil { + return ReimbursementContactRef{} + } + return o.ContactRef +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetCurrency() string { + if o == nil { + return "" + } + return o.Currency +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetCurrencyRate() *decimal.Big { + if o == nil { + return nil + } + return o.CurrencyRate +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetDueDate() string { + if o == nil { + return "" + } + return o.DueDate +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetIssueDate() string { + if o == nil { + return "" + } + return o.IssueDate +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetLines() []ReimbursableExpenseTransactionLine { + if o == nil { + return nil + } + return o.Lines +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetNotes() *string { + if o == nil { + return nil + } + return o.Notes +} + +func (o *UpdateReimbursableExpenseTransactionRequest) GetReference() *string { + if o == nil { + return nil + } + return o.Reference +} diff --git a/sync-for-expenses/pkg/models/shared/updatesupplierresponse.go b/sync-for-expenses/pkg/models/shared/updatesupplierresponse.go index af662471b..b30e031b2 100644 --- a/sync-for-expenses/pkg/models/shared/updatesupplierresponse.go +++ b/sync-for-expenses/pkg/models/shared/updatesupplierresponse.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared @@ -18,7 +18,7 @@ type UpdateSupplierResponseAccountingSupplier struct { DefaultCurrency *string `json:"defaultCurrency,omitempty"` // Email address that the supplier may be contacted on. EmailAddress *string `json:"emailAddress,omitempty"` - // Identifier for the supplier, unique to the company in the accounting platform. + // Identifier for the supplier, unique to the company in the accounting software. ID *string `json:"id,omitempty"` Metadata *Metadata `json:"metadata,omitempty"` ModifiedDate *string `json:"modifiedDate,omitempty"` @@ -31,7 +31,7 @@ type UpdateSupplierResponseAccountingSupplier struct { Status SupplierStatus `json:"status"` // Supplemental data is additional data you can include in our standard data types. // - // It is referenced as a configured dynamic key value pair that is unique to the accounting platform. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. + // It is referenced as a configured dynamic key value pair that is unique to the accounting software. [Learn more](https://docs.codat.io/using-the-api/supplemental-data/overview) about supplemental data. SupplementalData *SupplementalData `json:"supplementalData,omitempty"` // Name of the supplier as recorded in the accounting system, typically the company name. SupplierName *string `json:"supplierName,omitempty"` diff --git a/sync-for-expenses/pkg/models/shared/validation.go b/sync-for-expenses/pkg/models/shared/validation.go index bb4ce0816..9788c88dd 100644 --- a/sync-for-expenses/pkg/models/shared/validation.go +++ b/sync-for-expenses/pkg/models/shared/validation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/validationitem.go b/sync-for-expenses/pkg/models/shared/validationitem.go index 478e7bb7f..9993cc8f1 100644 --- a/sync-for-expenses/pkg/models/shared/validationitem.go +++ b/sync-for-expenses/pkg/models/shared/validationitem.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package shared diff --git a/sync-for-expenses/pkg/models/shared/validtransactiontypes.go b/sync-for-expenses/pkg/models/shared/validtransactiontypes.go new file mode 100644 index 000000000..1e3c5ccce --- /dev/null +++ b/sync-for-expenses/pkg/models/shared/validtransactiontypes.go @@ -0,0 +1,40 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +type ValidTransactionTypes string + +const ( + ValidTransactionTypesPayment ValidTransactionTypes = "Payment" + ValidTransactionTypesRefund ValidTransactionTypes = "Refund" + ValidTransactionTypesReward ValidTransactionTypes = "Reward" + ValidTransactionTypesChargeback ValidTransactionTypes = "Chargeback" +) + +func (e ValidTransactionTypes) ToPointer() *ValidTransactionTypes { + return &e +} +func (e *ValidTransactionTypes) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Payment": + fallthrough + case "Refund": + fallthrough + case "Reward": + fallthrough + case "Chargeback": + *e = ValidTransactionTypes(v) + return nil + default: + return fmt.Errorf("invalid value for ValidTransactionTypes: %v", v) + } +} diff --git a/sync-for-expenses/pkg/models/webhooks/clientratelimitreached.go b/sync-for-expenses/pkg/models/webhooks/clientratelimitreached.go index 90ff5ccd3..f9be2dcf5 100644 --- a/sync-for-expenses/pkg/models/webhooks/clientratelimitreached.go +++ b/sync-for-expenses/pkg/models/webhooks/clientratelimitreached.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks @@ -6,7 +6,7 @@ import ( "net/http" ) -type ClientRateLimitReachedResponse struct { +type ClientRateLimitReachedResponse1 struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -15,21 +15,21 @@ type ClientRateLimitReachedResponse struct { RawResponse *http.Response } -func (o *ClientRateLimitReachedResponse) GetContentType() string { +func (o *ClientRateLimitReachedResponse1) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *ClientRateLimitReachedResponse) GetStatusCode() int { +func (o *ClientRateLimitReachedResponse1) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *ClientRateLimitReachedResponse) GetRawResponse() *http.Response { +func (o *ClientRateLimitReachedResponse1) GetRawResponse() *http.Response { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/webhooks/clientratelimitreset.go b/sync-for-expenses/pkg/models/webhooks/clientratelimitreset.go index 2d0164927..3a7787447 100644 --- a/sync-for-expenses/pkg/models/webhooks/clientratelimitreset.go +++ b/sync-for-expenses/pkg/models/webhooks/clientratelimitreset.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks @@ -6,7 +6,7 @@ import ( "net/http" ) -type ClientRateLimitResetResponse struct { +type ClientRateLimitResetResponse1 struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -15,21 +15,21 @@ type ClientRateLimitResetResponse struct { RawResponse *http.Response } -func (o *ClientRateLimitResetResponse) GetContentType() string { +func (o *ClientRateLimitResetResponse1) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *ClientRateLimitResetResponse) GetStatusCode() int { +func (o *ClientRateLimitResetResponse1) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *ClientRateLimitResetResponse) GetRawResponse() *http.Response { +func (o *ClientRateLimitResetResponse1) GetRawResponse() *http.Response { if o == nil { return nil } diff --git a/sync-for-expenses/pkg/models/webhooks/synccomplete.go b/sync-for-expenses/pkg/models/webhooks/synccomplete.go index 1c6f83550..bf1892eda 100644 --- a/sync-for-expenses/pkg/models/webhooks/synccomplete.go +++ b/sync-for-expenses/pkg/models/webhooks/synccomplete.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks diff --git a/sync-for-expenses/pkg/models/webhooks/syncfailed.go b/sync-for-expenses/pkg/models/webhooks/syncfailed.go index 686181e93..aeac8ecda 100644 --- a/sync-for-expenses/pkg/models/webhooks/syncfailed.go +++ b/sync-for-expenses/pkg/models/webhooks/syncfailed.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package webhooks diff --git a/sync-for-expenses/pkg/models/webhooks/syncstarted.go b/sync-for-expenses/pkg/models/webhooks/syncstarted.go deleted file mode 100644 index a57c15824..000000000 --- a/sync-for-expenses/pkg/models/webhooks/syncstarted.go +++ /dev/null @@ -1,37 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package webhooks - -import ( - "net/http" -) - -type SyncStartedResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *SyncStartedResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *SyncStartedResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *SyncStartedResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/sync-for-expenses/pkg/retry/config.go b/sync-for-expenses/pkg/retry/config.go new file mode 100644 index 000000000..c051b0a46 --- /dev/null +++ b/sync-for-expenses/pkg/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +} diff --git a/sync-for-expenses/pkg/types/bigint.go b/sync-for-expenses/pkg/types/bigint.go index afd0cd2b8..9c6a086d5 100644 --- a/sync-for-expenses/pkg/types/bigint.go +++ b/sync-for-expenses/pkg/types/bigint.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-expenses/pkg/types/date.go b/sync-for-expenses/pkg/types/date.go index c4648fa96..5b2782f21 100644 --- a/sync-for-expenses/pkg/types/date.go +++ b/sync-for-expenses/pkg/types/date.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-expenses/pkg/types/datetime.go b/sync-for-expenses/pkg/types/datetime.go index 0529b2556..3eff332da 100644 --- a/sync-for-expenses/pkg/types/datetime.go +++ b/sync-for-expenses/pkg/types/datetime.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-expenses/pkg/types/decimal.go b/sync-for-expenses/pkg/types/decimal.go index a42284b92..d8429bc6b 100644 --- a/sync-for-expenses/pkg/types/decimal.go +++ b/sync-for-expenses/pkg/types/decimal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/sync-for-expenses/pkg/types/pointers.go b/sync-for-expenses/pkg/types/pointers.go index 4f15e99d4..35c439d26 100644 --- a/sync-for-expenses/pkg/types/pointers.go +++ b/sync-for-expenses/pkg/types/pointers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types @@ -8,3 +8,4 @@ func Int(i int) *int { return &i } func Int64(i int64) *int64 { return &i } func Float32(f float32) *float32 { return &f } func Float64(f float64) *float64 { return &f } +func Pointer[T any](v T) *T { return &v } diff --git a/sync-for-expenses/pkg/utils/contenttype.go b/sync-for-expenses/pkg/utils/contenttype.go index 8ed13e209..f6487e01e 100644 --- a/sync-for-expenses/pkg/utils/contenttype.go +++ b/sync-for-expenses/pkg/utils/contenttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -9,6 +9,10 @@ import ( ) func MatchContentType(contentType string, pattern string) bool { + if contentType == "" { + contentType = "application/octet-stream" + } + if contentType == pattern || pattern == "*" || pattern == "*/*" { return true } diff --git a/sync-for-expenses/pkg/utils/form.go b/sync-for-expenses/pkg/utils/form.go index 2f0b5f764..ed89a5baa 100644 --- a/sync-for-expenses/pkg/utils/form.go +++ b/sync-for-expenses/pkg/utils/form.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/sync-for-expenses/pkg/utils/headers.go b/sync-for-expenses/pkg/utils/headers.go index 024987627..a07608bdc 100644 --- a/sync-for-expenses/pkg/utils/headers.go +++ b/sync-for-expenses/pkg/utils/headers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -18,8 +18,7 @@ func PopulateHeaders(_ context.Context, req *http.Request, headers interface{}, } func populateHeaders(headers interface{}, globals interface{}, reqHeaders http.Header, skipFields []string) []string { - headerParamsStructType := reflect.TypeOf(headers) - headerParamsValType := reflect.ValueOf(headers) + headerParamsStructType, headerParamsValType := dereferencePointers(reflect.TypeOf(headers), reflect.ValueOf(headers)) globalsAlreadyPopulated := []string{} diff --git a/sync-for-expenses/pkg/utils/json.go b/sync-for-expenses/pkg/utils/json.go index 36d98546a..7c3df6314 100644 --- a/sync-for-expenses/pkg/utils/json.go +++ b/sync-for-expenses/pkg/utils/json.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -8,6 +8,7 @@ import ( "fmt" "math/big" "reflect" + "strconv" "strings" "time" "unsafe" @@ -164,11 +165,17 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool if field.Tag.Get("const") != "" { if r, ok := unmarhsaled[fieldName]; ok { val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { - val = val[1 : len(val)-1] + var err error + val, err = strconv.Unquote(val) + if err != nil { + return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) + } } - if val != field.Tag.Get("const") { - return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + constValue := field.Tag.Get("const") + if val != constValue { + return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } delete(unmarhsaled, fieldName) @@ -260,6 +267,18 @@ func marshalValue(v interface{}, tag reflect.StructTag) (json.RawMessage, error) typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v)) switch typ.Kind() { + case reflect.Int64: + format := tag.Get("integer") + if format == "string" { + b := val.Interface().(int64) + return []byte(fmt.Sprintf(`"%d"`, b)), nil + } + case reflect.Float64: + format := tag.Get("number") + if format == "string" { + b := val.Interface().(float64) + return []byte(fmt.Sprintf(`"%g"`, b)), nil + } case reflect.Map: if isNil(typ, val) { return []byte("null"), nil @@ -349,6 +368,16 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc if bigIntTag == "string" { return []byte(fmt.Sprintf(`"%s"`, tagValue)) } + case reflect.TypeOf(int64(0)): + format := tag.Get("integer") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } + case reflect.TypeOf(float64(0)): + format := tag.Get("number") + if format == "string" { + return []byte(fmt.Sprintf(`"%s"`, tagValue)) + } case reflect.TypeOf(decimal.Big{}): decimalTag := tag.Get("decimal") if decimalTag != "number" { @@ -377,6 +406,57 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa typ := dereferenceTypePointer(v.Type()) switch typ.Kind() { + case reflect.Int64: + var b int64 + + format := tag.Get("integer") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseInt(s, 10, 64) + if err != nil { + return fmt.Errorf("failed to parse string as int64: %w", err) + } + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } + case reflect.Float64: + var b float64 + + format := tag.Get("number") + if format == "string" { + var s string + if err := json.Unmarshal(value, &s); err != nil { + return err + } + + var err error + b, err = strconv.ParseFloat(s, 64) + if err != nil { + return fmt.Errorf("failed to parse string as float64: %w", err) + } + + if v.Kind() == reflect.Ptr { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() + } + + v.Set(reflect.ValueOf(b)) + return nil + } case reflect.Map: if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { if v.CanAddr() { @@ -407,30 +487,29 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(m) return nil case reflect.Slice, reflect.Array: - if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } + var unmarshaled []json.RawMessage - var unmarhsaled []json.RawMessage - - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } - arrVal := v + arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) - for _, value := range unmarhsaled { + for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { return err } - arrVal = reflect.Append(arrVal, itemVal.Elem()) + arrVal.Index(index).Set(itemVal.Elem()) + } + + if v.Kind() == reflect.Pointer { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() } v.Set(arrVal) diff --git a/sync-for-expenses/pkg/utils/pathparams.go b/sync-for-expenses/pkg/utils/pathparams.go index 35d99bca0..9e70d9a62 100644 --- a/sync-for-expenses/pkg/utils/pathparams.go +++ b/sync-for-expenses/pkg/utils/pathparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -38,8 +38,7 @@ func GenerateURL(_ context.Context, serverURL, path string, pathParams interface } func populateParsedParameters(pathParams interface{}, globals interface{}, parsedParameters map[string]string, skipFields []string) ([]string, error) { - pathParamsStructType := reflect.TypeOf(pathParams) - pathParamsValType := reflect.ValueOf(pathParams) + pathParamsStructType, pathParamsValType := dereferencePointers(reflect.TypeOf(pathParams), reflect.ValueOf(pathParams)) globalsAlreadyPopulated := []string{} diff --git a/sync-for-expenses/pkg/utils/queryparams.go b/sync-for-expenses/pkg/utils/queryparams.go index 8d1bf4766..11a22bc08 100644 --- a/sync-for-expenses/pkg/utils/queryparams.go +++ b/sync-for-expenses/pkg/utils/queryparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,12 +6,23 @@ import ( "context" "encoding/json" "fmt" + "math/big" "net/http" "net/url" "reflect" + "time" + + "github.com/ericlagergren/decimal" + + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/types" ) func PopulateQueryParams(_ context.Context, req *http.Request, queryParams interface{}, globals interface{}) error { + // Query parameters may already be present from overriding URL + if req.URL.RawQuery != "" { + return nil + } + values := url.Values{} globalsAlreadyPopulated, err := populateQueryParams(queryParams, globals, values, []string{}) @@ -32,8 +43,7 @@ func PopulateQueryParams(_ context.Context, req *http.Request, queryParams inter } func populateQueryParams(queryParams interface{}, globals interface{}, values url.Values, skipFields []string) ([]string, error) { - queryParamsStructType := reflect.TypeOf(queryParams) - queryParamsValType := reflect.ValueOf(queryParams) + queryParamsStructType, queryParamsValType := dereferencePointers(reflect.TypeOf(queryParams), reflect.ValueOf(queryParams)) globalsAlreadyPopulated := []string{} @@ -133,54 +143,97 @@ func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue refl return values } - if objType.Kind() == reflect.Pointer { - objType = objType.Elem() + if objValue.Kind() == reflect.Pointer { objValue = objValue.Elem() } - switch objType.Kind() { + switch objValue.Kind() { + case reflect.Map: + populateDeepObjectParamsMap(values, tag.ParamName, objValue) case reflect.Struct: - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) + populateDeepObjectParamsStruct(values, tag.ParamName, objValue) + } - if isNil(fieldType.Type, valType) { - continue - } + return values +} - if fieldType.Type.Kind() == reflect.Pointer { - valType = valType.Elem() - } +func populateDeepObjectParamsArray(qsValues url.Values, priorScope string, value reflect.Value) { + if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { + return + } - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - continue - } + for i := 0; i < value.Len(); i++ { + qsValues.Add(priorScope, valToString(value.Index(i).Interface())) + } +} - switch valType.Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < valType.Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Interface())) - } +func populateDeepObjectParamsMap(qsValues url.Values, priorScope string, mapValue reflect.Value) { + if mapValue.Kind() != reflect.Map { + return + } + + iter := mapValue.MapRange() + + for iter.Next() { + scope := priorScope + "[" + iter.Key().String() + "]" + iterValue := iter.Value() + + switch iterValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, iterValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, iterValue) + default: + qsValues.Add(scope, valToString(iterValue.Interface())) } - case reflect.Map: - iter := objValue.MapRange() - for iter.Next() { - switch iter.Value().Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < iter.Value().Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Interface())) + } +} + +func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, structValue reflect.Value) { + if structValue.Kind() != reflect.Struct { + return + } + + structType := structValue.Type() + + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + fieldValue := structValue.Field(i) + + if isNil(field.Type, fieldValue) { + continue + } + + if fieldValue.Kind() == reflect.Pointer { + fieldValue = fieldValue.Elem() + } + + qpTag := parseQueryParamTag(field) + + if qpTag == nil { + continue + } + + scope := priorScope + "[" + qpTag.ParamName + "]" + + switch fieldValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, fieldValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, fieldValue) + case reflect.Struct: + switch fieldValue.Type() { + case reflect.TypeOf(big.Int{}), reflect.TypeOf(decimal.Big{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): + qsValues.Add(scope, valToString(fieldValue.Interface())) + + continue } + + populateDeepObjectParamsStruct(qsValues, scope, fieldValue) + default: + qsValues.Add(scope, valToString(fieldValue.Interface())) } } - - return values } func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { diff --git a/sync-for-expenses/pkg/utils/requestbody.go b/sync-for-expenses/pkg/utils/requestbody.go index cfb2ba611..000226ef9 100644 --- a/sync-for-expenses/pkg/utils/requestbody.go +++ b/sync-for-expenses/pkg/utils/requestbody.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -66,15 +66,16 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF if tag != nil { // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) + val := reflect.ValueOf(requestVal.Interface()) if isNil(requestField.Type, requestVal) { if !nullable && optional { return nil, "", nil } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } } @@ -82,7 +83,7 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (io.Reader, string, error) { buf := &bytes.Buffer{} if isNil(val.Type(), val) { @@ -116,6 +117,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if err := encodeFormData(fieldName, buf, val.Interface()); err != nil { return nil, "", err } + case val.Type().Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()): + return val.Interface().(io.Reader), mediaType, nil default: val = reflect.Indirect(val) @@ -124,8 +127,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if _, err := buf.WriteString(valToString(val.Interface())); err != nil { return nil, "", err } - case val.Type() == reflect.TypeOf([]byte(nil)): - if _, err := buf.Write(val.Bytes()); err != nil { + case reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)): + if _, err := buf.Write(val.Interface().([]byte)); err != nil { return nil, "", err } default: @@ -215,7 +218,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va var fieldName string var fileName string - var content []byte + var reader io.Reader for i := 0; i < fieldType.NumField(); i++ { field := fieldType.Field(i) @@ -226,15 +229,19 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va continue } - if tag.Content { - content = val.Bytes() + if tag.Content && val.CanInterface() { + if reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)) { + reader = bytes.NewReader(val.Interface().([]byte)) + } else if reflect.TypeOf(val.Interface()).Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()) { + reader = val.Interface().(io.Reader) + } } else { fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || content == nil { + if fieldName == "" || fileName == "" || reader == nil { return fmt.Errorf("invalid multipart/form-data file") } @@ -242,7 +249,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va if err != nil { return err } - if _, err := fw.Write(content); err != nil { + if _, err := io.Copy(fw, reader); err != nil { return err } diff --git a/sync-for-expenses/pkg/utils/retries.go b/sync-for-expenses/pkg/utils/retries.go index ff39d0d84..6703f234d 100644 --- a/sync-for-expenses/pkg/utils/retries.go +++ b/sync-for-expenses/pkg/utils/retries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/sync-for-expenses/pkg/utils/security.go b/sync-for-expenses/pkg/utils/security.go index 802322546..19dfa6f46 100644 --- a/sync-for-expenses/pkg/utils/security.go +++ b/sync-for-expenses/pkg/utils/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -21,6 +21,7 @@ type securityTag struct { Name string Type string SubType string + Env string } func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { @@ -118,9 +119,14 @@ func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *secu } if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - handleBasicAuthScheme(headers, schemeVal.Interface()) - return + if schemeTag.Type == "http" { + switch schemeTag.SubType { + case "basic": + handleBasicAuthScheme(headers, schemeVal.Interface()) + return + case "custom": + return + } } for i := 0; i < schemeType.NumField(); i++ { @@ -170,6 +176,7 @@ func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag switch schemeTag.SubType { case "bearer": headers[secTag.Name] = prefixBearer(valToString(val)) + case "custom": default: panic("not supported") } @@ -196,6 +203,10 @@ func handleBasicAuthScheme(headers map[string]string, scheme interface{}) { fieldType := schemeStructType.Field(i) valType := schemeValType.Field(i) + if fieldType.Type.Kind() == reflect.Ptr { + valType = valType.Elem() + } + secTag := parseSecurityTag(fieldType) if secTag == nil || secTag.Name == "" { continue @@ -223,6 +234,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { name := "" securityType := "" securitySubType := "" + env := "" options := strings.Split(tag, ",") for _, optionConf := range options { @@ -242,6 +254,8 @@ func parseSecurityTag(field reflect.StructField) *securityTag { option = true case "scheme": scheme = true + case "env": + env = parts[1] } } @@ -253,6 +267,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { Name: name, Type: securityType, SubType: securitySubType, + Env: env, } } diff --git a/sync-for-expenses/pkg/utils/utils.go b/sync-for-expenses/pkg/utils/utils.go index a35dc9b9f..adb2f7055 100644 --- a/sync-for-expenses/pkg/utils/utils.go +++ b/sync-for-expenses/pkg/utils/utils.go @@ -1,8 +1,9 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils import ( + "context" "fmt" "io" "math/big" @@ -87,6 +88,12 @@ func MatchStatusCodes(expectedCodes []string, statusCode int) bool { return false } +func AsSecuritySource(security interface{}) func(context.Context) (interface{}, error) { + return func(context.Context) (interface{}, error) { + return security, nil + } +} + func parseStructTag(tagKey string, field reflect.StructField) map[string]string { tag := field.Tag.Get(tagKey) if tag == "" { diff --git a/sync-for-expenses/pushoperations.go b/sync-for-expenses/pushoperations.go index 3499c71e0..49eedbfd3 100644 --- a/sync-for-expenses/pushoperations.go +++ b/sync-for-expenses/pushoperations.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// PushOperations - Access create, update and delete operations made to an SMB's data connection. +// PushOperations - View historic push operations. type PushOperations struct { sdkConfiguration sdkConfiguration } @@ -40,6 +41,7 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -47,12 +49,24 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push/{pushOperationKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -67,10 +81,11 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -78,33 +93,60 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -113,15 +155,19 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -131,17 +177,25 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PushOperation if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -149,6 +203,11 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper res.PushOperation = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -166,6 +225,11 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -173,17 +237,33 @@ func (s *PushOperations) Get(ctx context.Context, request operations.GetPushOper return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List push operations @@ -199,6 +279,7 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -206,12 +287,24 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/push", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -230,10 +323,11 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -241,33 +335,60 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -276,15 +397,19 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -294,17 +419,25 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.PushOperations if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -312,6 +445,11 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp res.PushOperations = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -331,6 +469,11 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -338,15 +481,31 @@ func (s *PushOperations) List(ctx context.Context, request operations.ListPushOp return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/reimbursements.go b/sync-for-expenses/reimbursements.go index 073300157..c051bc52f 100644 --- a/sync-for-expenses/reimbursements.go +++ b/sync-for-expenses/reimbursements.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Reimbursements - Create reimbursable expense transactions. +// Reimbursements - Create and update transactions that represent your customers' repayable spend. type Reimbursements struct { sdkConfiguration sdkConfiguration } @@ -28,9 +29,17 @@ func newReimbursements(sdkConfig sdkConfiguration) *Reimbursements { } // Create reimbursable expense transaction -// Use the *Create reimbursable expense* endpoint to create a [reimbursement request](https://docs.codat.io/sync-for-expenses-api#/schemas/Reimburseable-Expense-Transactions) in the accounting platform for a given company's connection. +// Use the *Create reimbursable expense* endpoint to submit an employee expense claim in the accounting platform for a given company's connection. // -// Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. +// [Reimbursable expense requests](https://docs.codat.io/sync-for-expenses-api#/schemas/ReimbursableExpenseTransactionRequest) are reflected in the accounting software in the form of **Bills** against an employee (who exists as a supplier in the accounting platform). +// +// ### Supported Integrations +// | Integration | Supported | +// |-----------------------|-----------| +// | FreeAgent | Yes | +// | QuickBooks Desktop | Yes | +// | QuickBooks Online | Yes | +// | Oracle NetSuite | Yes | func (s *Reimbursements) Create(ctx context.Context, request operations.CreateReimbursableExpenseTransactionRequest, opts ...operations.Option) (*operations.CreateReimbursableExpenseTransactionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -42,6 +51,7 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -49,17 +59,29 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/reimbursable-expense-transactions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateReimbursableExpenseRequest", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -75,10 +97,11 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -86,33 +109,60 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -121,15 +171,19 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -139,17 +193,25 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateReimbursableExpenseResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -157,6 +219,11 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe res.CreateReimbursableExpenseResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -176,6 +243,11 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -183,23 +255,47 @@ func (s *Reimbursements) Create(ctx context.Context, request operations.CreateRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Update reimbursable expense transaction -// The *Update reimbursable expense* endpoint updates an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/operations/create-reimbursable-expense-transaction) in the accounting platform for a given company's connection. +// The *Update reimbursable expense* endpoint updates an existing employee expense claim in the accounting platform for a given company's connection. // -// Employee reimbursement requests are reflected in the accounting system in the form of Bills against an employee, who is a supplier. +// Updating an existing [reimbursable expense transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/UpdateReimbursableExpenseTransactionRequest) will update the existing **bill** against an employee (who exists as a supplier in the accounting software). +// +// ### Supported Integrations +// | Integration | Supported | +// |-----------------------|-----------| +// | FreeAgent | Yes | +// | QuickBooks Desktop | Yes | +// | QuickBooks Online | Yes | +// | Oracle NetSuite | Yes | func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateReimbursableExpenseTransactionRequest, opts ...operations.Option) (*operations.UpdateReimbursableExpenseTransactionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -211,6 +307,7 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -218,17 +315,29 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/reimbursable-expense-transactions/{transactionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateReimbursableExpenseRequest", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "UpdateReimbursableExpenseTransactionRequest", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -244,10 +353,11 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -255,33 +365,60 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -290,15 +427,19 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -308,17 +449,25 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateReimbursableExpenseResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -326,6 +475,11 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe res.CreateReimbursableExpenseResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -345,6 +499,11 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -352,15 +511,31 @@ func (s *Reimbursements) Update(ctx context.Context, request operations.UpdateRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/suppliers.go b/sync-for-expenses/suppliers.go index 08c7d67e9..aaeb7628c 100644 --- a/sync-for-expenses/suppliers.go +++ b/sync-for-expenses/suppliers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Suppliers +// Suppliers - Get, create, and update suppliers. type Suppliers struct { sdkConfiguration sdkConfiguration } @@ -48,6 +49,7 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -55,6 +57,7 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/suppliers", request, nil) if err != nil { @@ -66,6 +69,17 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -85,10 +99,11 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -96,33 +111,60 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -131,15 +173,19 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -149,17 +195,25 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CreateSupplierResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -167,6 +221,11 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie res.CreateSupplierResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -186,6 +245,11 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -193,17 +257,33 @@ func (s *Suppliers) Create(ctx context.Context, request operations.CreateSupplie return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Get supplier @@ -225,6 +305,7 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -232,12 +313,24 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/suppliers/{supplierId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -252,10 +345,11 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -263,33 +357,60 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -298,15 +419,19 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "409", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -316,17 +441,25 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Supplier if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -334,6 +467,11 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque res.Supplier = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -353,6 +491,11 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -360,17 +503,33 @@ func (s *Suppliers) Get(ctx context.Context, request operations.GetSupplierReque return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List suppliers @@ -390,6 +549,7 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -397,12 +557,24 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/data/suppliers", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -421,10 +593,11 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -432,33 +605,60 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -467,15 +667,19 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "409", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -485,17 +689,25 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Suppliers if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -503,6 +715,11 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe res.Suppliers = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -524,6 +741,11 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -531,17 +753,33 @@ func (s *Suppliers) List(ctx context.Context, request operations.ListSuppliersRe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // Update supplier @@ -565,6 +803,7 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -572,6 +811,7 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/connections/{connectionId}/push/suppliers/{supplierId}", request, nil) if err != nil { @@ -583,6 +823,17 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -602,10 +853,11 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -613,33 +865,60 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -648,15 +927,19 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -666,17 +949,25 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.UpdateSupplierResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -684,6 +975,11 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie res.UpdateSupplierResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -703,6 +999,11 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -710,15 +1011,31 @@ func (s *Suppliers) Update(ctx context.Context, request operations.UpdateSupplie return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/sync.go b/sync-for-expenses/sync.go index d47260163..60a31e20e 100644 --- a/sync-for-expenses/sync.go +++ b/sync-for-expenses/sync.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Sync - Trigger and monitor expense syncs to accounting software. +// Sync - Monitor the status of data syncs. type Sync struct { sdkConfiguration sdkConfiguration } @@ -40,6 +41,7 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -47,12 +49,24 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/{syncId}/status", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -67,10 +81,11 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -78,33 +93,60 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -113,15 +155,19 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -131,17 +177,25 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CompanySyncStatus if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -149,6 +203,11 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o res.CompanySyncStatus = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -166,6 +225,11 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -173,17 +237,33 @@ func (s *Sync) Get(ctx context.Context, request operations.GetSyncByIDRequest, o return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetLastSuccessfulSync - Last successful sync @@ -199,6 +279,7 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -206,12 +287,24 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/lastSuccessful/status", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -226,10 +319,11 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -237,33 +331,60 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -272,15 +393,19 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -290,17 +415,25 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.CompanySyncStatus if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -308,6 +441,11 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get res.CompanySyncStatus = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -325,6 +463,11 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -332,17 +475,33 @@ func (s *Sync) GetLastSuccessfulSync(ctx context.Context, request operations.Get return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // GetLatestSync - Latest sync status @@ -358,6 +517,7 @@ func (s *Sync) GetLatestSync(ctx context.Context, request operations.GetLatestSy o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -365,12 +525,24 @@ func (s *Sync) GetLatestSync(ctx context.Context, request operations.GetLatestSy return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/latest/status", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -385,10 +557,11 @@ func (s *Sync) GetLatestSync(ctx context.Context, request operations.GetLatestSy globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -396,198 +569,60 @@ func (s *Sync) GetLatestSync(ctx context.Context, request operations.GetLatestSy }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() - if err != nil { - return nil, err + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody } - req.Body = copyBody - } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, backoff.Permanent(err) - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") + return nil, backoff.Permanent(err) } - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { - return nil, err - } - } - - res := &operations.GetLatestSyncResponse{ - StatusCode: httpRes.StatusCode, - ContentType: httpRes.Header.Get("Content-Type"), - RawResponse: httpRes, - } - - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } - switch { - case httpRes.StatusCode == 200: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out shared.CompanySyncStatus - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) } + return httpRes, err + }) - res.CompanySyncStatus = &out - default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode == 401: - fallthrough - case httpRes.StatusCode == 402: - fallthrough - case httpRes.StatusCode == 403: - fallthrough - case httpRes.StatusCode == 404: - fallthrough - case httpRes.StatusCode == 429: - fallthrough - case httpRes.StatusCode == 500: - fallthrough - case httpRes.StatusCode == 503: - switch { - case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.ErrorMessage - if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { - return nil, err - } - - return nil, &out - default: - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) - } - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - default: - return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) - } - - return res, nil -} - -// InitiateSync - Initiate sync -// Initiate sync of pending transactions. -func (s *Sync) InitiateSync(ctx context.Context, request operations.InitiateSyncRequest, opts ...operations.Option) (*operations.InitiateSyncResponse, error) { - hookCtx := hooks.HookContext{ - Context: ctx, - OperationID: "initiate-sync", - OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, - } - - o := operations.Options{} - supportedOptions := []string{ - operations.SupportedOptionRetries, - } - - for _, opt := range opts { - if err := opt(&o, supportedOptions...); err != nil { - return nil, fmt.Errorf("error applying option: %w", err) - } - } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs", request, nil) - if err != nil { - return nil, fmt.Errorf("error generating URL: %w", err) - } - - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "InitiateSync", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } - - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) - if err != nil { - return nil, fmt.Errorf("error creating request: %w", err) - } - req.Header.Set("Accept", "application/json") - req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - req.Header.Set("Content-Type", reqContentType) - - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - globalRetryConfig := s.sdkConfiguration.RetryConfig - retryConfig := o.Retries - if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } + if err != nil { + return nil, err } else { - retryConfig = globalRetryConfig - } - } - - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -596,46 +631,61 @@ func (s *Sync) InitiateSync(ctx context.Context, request operations.InitiateSync } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } - res := &operations.InitiateSyncResponse{ + res := &operations.GetLatestSyncResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { - case httpRes.StatusCode == 202: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out shared.SyncInitiated + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.CompanySyncStatus if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.SyncInitiated = &out + res.CompanySyncStatus = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - case httpRes.StatusCode == 400: - fallthrough case httpRes.StatusCode == 401: fallthrough case httpRes.StatusCode == 402: @@ -644,8 +694,6 @@ func (s *Sync) InitiateSync(ctx context.Context, request operations.InitiateSync fallthrough case httpRes.StatusCode == 404: fallthrough - case httpRes.StatusCode == 422: - fallthrough case httpRes.StatusCode == 429: fallthrough case httpRes.StatusCode == 500: @@ -653,6 +701,11 @@ func (s *Sync) InitiateSync(ctx context.Context, request operations.InitiateSync case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -660,17 +713,33 @@ func (s *Sync) InitiateSync(ctx context.Context, request operations.InitiateSync return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List sync statuses @@ -686,6 +755,7 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -693,12 +763,24 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/list/status", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -713,10 +795,11 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -724,33 +807,60 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -759,15 +869,19 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -777,17 +891,25 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out []shared.CompanySyncStatus if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -795,6 +917,11 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op res.Classes = out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -812,6 +939,11 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -819,15 +951,31 @@ func (s *Sync) List(ctx context.Context, request operations.ListSyncsRequest, op return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/transactionstatus.go b/sync-for-expenses/transactionstatus.go index 5b892457e..c0dcf4d71 100644 --- a/sync-for-expenses/transactionstatus.go +++ b/sync-for-expenses/transactionstatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// TransactionStatus - Retrieve the status of transactions within a sync. +// TransactionStatus - Monitor the status of individual transactions in data syncs. type TransactionStatus struct { sdkConfiguration sdkConfiguration } @@ -40,6 +41,7 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -47,12 +49,24 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions/{transactionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -67,10 +81,11 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -78,33 +93,60 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -113,15 +155,19 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -131,17 +177,25 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out []shared.Transaction if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -149,6 +203,11 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT res.TransactionResponse = out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: @@ -166,6 +225,11 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -173,17 +237,33 @@ func (s *TransactionStatus) Get(ctx context.Context, request operations.GetSyncT return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } // List sync transactions @@ -199,6 +279,7 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -206,12 +287,24 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/syncs/{syncId}/transactions", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -230,10 +323,11 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -241,33 +335,60 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -276,15 +397,19 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -294,17 +419,25 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out shared.Transactions if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -312,6 +445,11 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn res.Transactions = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -331,6 +469,11 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -338,15 +481,31 @@ func (s *TransactionStatus) List(ctx context.Context, request operations.ListSyn return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + } diff --git a/sync-for-expenses/transfers.go b/sync-for-expenses/transfers.go index 3eb93de5f..069576750 100644 --- a/sync-for-expenses/transfers.go +++ b/sync-for-expenses/transfers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package syncforexpenses @@ -11,12 +11,13 @@ import ( "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/operations" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/sdkerrors" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/models/shared" + "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/retry" "github.com/codatio/client-sdk-go/sync-for-expenses/v4/pkg/utils" "io" "net/http" ) -// Transfers - Create transfer transactions. +// Transfers - Create and update transactions that represent the movement of your customers' money. type Transfers struct { sdkConfiguration sdkConfiguration } @@ -28,11 +29,19 @@ func newTransfers(sdkConfig sdkConfiguration) *Transfers { } // Create transfer transaction -// Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransaction) in the accounting platform for a given company's connection. +// Use the *Create transfer* endpoint to create or update a [transfer transaction](https://docs.codat.io/sync-for-expenses-api#/schemas/TransferTransactionRequest) in the accounting software for a given company's connection. // // Transfers record the movement of money between two bank accounts, or between a bank account and a nominal account. Use them to represent actions such as topping up a debit card account or a balance transfer to another credit card. // // The `from.amount` and `to.amount` fields are in the native currency of the account. +// +// ### Supported Integrations +// | Integration | Supported | +// |-----------------------|-----------| +// | FreeAgent | Yes | +// | QuickBooks Desktop | Yes | +// | QuickBooks Online | Yes | +// | Xero | Yes | func (s *Transfers) Create(ctx context.Context, request operations.CreateTransferTransactionRequest, opts ...operations.Option) (*operations.CreateTransferTransactionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -44,6 +53,7 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -51,17 +61,29 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/companies/{companyId}/sync/expenses/transfer-transactions/{transactionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "CreateTransferRequest", "json", `request:"mediaType=application/json"`) + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "TransferTransactionRequest", "json", `request:"mediaType=application/json"`) if err != nil { return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -77,10 +99,11 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { - if globalRetryConfig == nil { - retryConfig = &utils.RetryConfig{ - Strategy: "backoff", - Backoff: &utils.BackoffStrategy{ + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } else { + retryConfig = &retry.Config{ + Strategy: "backoff", Backoff: &retry.BackoffStrategy{ InitialInterval: 500, MaxInterval: 60000, Exponent: 1.5, @@ -88,33 +111,60 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe }, RetryConnectionErrors: true, } - } else { - retryConfig = globalRetryConfig } } - httpRes, err := utils.Retry(ctx, utils.Retries{ - Config: retryConfig, - StatusCodes: []string{ - "408", - "429", - "5XX", - }, - }, func() (*http.Response, error) { - if req.Body != nil { - copyBody, err := req.GetBody() + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "408", + "429", + "5XX", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) if err != nil { return nil, err } - req.Body = copyBody } - + } else { req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) + httpRes, err = s.sdkConfiguration.Client.Do(req) if err != nil || httpRes == nil { if err != nil { err = fmt.Errorf("error sending request: %w", err) @@ -123,15 +173,19 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe } _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - } - return httpRes, err - }) - if err != nil { - return nil, err - } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) - if err != nil { return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } @@ -141,24 +195,37 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out shared.CreateTransferResponse + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out shared.TransferTransactionResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.CreateTransferResponse = &out + res.TransferTransactionResponse = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: @@ -178,6 +245,11 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe case httpRes.StatusCode == 503: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ErrorMessage if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -185,15 +257,31 @@ func (s *Transfers) Create(ctx context.Context, request operations.CreateTransfe return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } return res, nil + }